(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
↓
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(if (<= (* z z) 2e+107)
(/ (/ 1.0 x) (* y (+ 1.0 (* z z))))
(/ (/ 1.0 (* y (* x z))) z)))
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
↓
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 2d+107) then
tmp = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
else
tmp = (1.0d0 / (y * (x * z))) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.
Herbie found 11 alternatives:
Alternative
Accuracy
Speedup
Accuracy vs Speed
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.