3 ms·
Maybe instead of --fast-math we need a new type aprox_float to indicate, we (the programmes) allow this variable to take some shortcuts during computation. Whil
by Qantourisc 10y ago
Maybe instead of --fast-math we need a new type aprox_float to indicate, we (the programmes) allow this variable to take some shortcuts during computation. While we promise not to do things like div0.
Edit: we must agree on a max deviation/error for this type.
- jsheard 10y agoThat's actually how GPU shader languages work, albeit in reverse. HLSL/GLSL always allow floating point shortcuts unless they could affect the value of a variable declared with the "precise" qualifier.
- lmm 10y agoIf you can figure out a sensible way to formally specify what you want, that would be a good idea. But that gets very complex very quickly. E.g. if you allow the compiler to compute any algebraically equivalent expression in place of the expression you wrote, it can just add FLOAT_MAX and then subtract FLOAT_MAX (which mathematically should make no difference, right?), and then if it knows the input was reasonably small then it can optimize the result to 0.