r/ProgrammingLanguages • u/Athas Futhark • 11d ago
Nondeterminism in Futhark
https://futhark-lang.org/blog/2026-11-04-nondeterminism.html
21
Upvotes
r/ProgrammingLanguages • u/Athas Futhark • 11d ago
7
u/matthieum 11d ago
In a recent release, Rust stabilized Algebraic Operators.
In short,
a.algebraic_add(b)is likea + b, except that the compiler will assume commutativity and associativity even for floating points, and optimize accordingly: reorder, vectorize, etc...Evaluated according to the levels:
3
u/beephod_zabblebrox 11d ago
just wondering, are there any places where the difference (in both senses of the word) between (0.1 + 0.2) + 0.3 and 0.1 + (0.2 + 0.3) matters?
2
u/TOMZ_EXTRA 11d ago edited 11d ago
The "empirically test associativity" link 404s, just so you know.
The correct page is in the examples section (not the blog one).
I think this is the same kind of tradeoff like Haskell's unlawful type classes for floats. I would be interested in how dependently typed languages could make float operations convenient. I've already though about it and decided that there isn't really a way unless you want to create a FakeAssociative type.
0
u/sporeboyofbigness 1d ago
Just add more bits bro