Open
Description
Thanks for Herbie! I think this is a very nice addition to the Haskell tool-suite.. I gave it a shot, however, and am a bit confused about some of the output. I tried the following program:
module Test where
foo :: Float -> Float -> Float
foo x y = (x * x) + (2 * x * y) + (y * y)
Herbie said:
Compiling with Herbie floating point stabilization
Found math expression within binding foo :: Float -> Float -> Float
original expression = (x * x) + (2 * x * y) + (y * y)
improved expression = (x * x) + (2 * y * x) + (y * y)
original error = 1.5625e-2 bits
improved error = 3.90625e-3 bits
WARNING: Not substituting the improved expression into your code
WARNING: Cannot satisfy the constraint: Num Float
Given the complete symmetry between x
and y
; is the improvement due to NaN
/Infinity
results only? When both expressions produce actual floating point values, can they actually differ? What does it mean to have the error bits in this case?
It would be uber cool if Herbie printed examples of x
and y
when the results differed, to start with.
Also, I'm not sure what to make of the WARNING
, as Float
is clearly an instance of Num
.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels