\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(\left(\frac{0.083333333333333}{x} + \frac{z}{\sqrt{x}} \cdot \left(\frac{z}{\sqrt{x}} \cdot \left(y + 0.0007936500793651\right)\right)\right) - 0.0027777777777778 \cdot \frac{z}{x}\right)(FPCore (x y z)
:precision binary64
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x)))(FPCore (x y z)
:precision binary64
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(-
(+
(/ 0.083333333333333 x)
(* (/ z (sqrt x)) (* (/ z (sqrt x)) (+ y 0.0007936500793651))))
(* 0.0027777777777778 (/ z x)))))double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (((0.083333333333333 / x) + ((z / sqrt(x)) * ((z / sqrt(x)) * (y + 0.0007936500793651)))) - (0.0027777777777778 * (z / x)));
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 5.6 |
|---|---|
| Target | 1.2 |
| Herbie | 0.3 |
Initial program 5.6
Taylor expanded around 0 5.8
Simplified3.8
rmApplied add-sqr-sqrt_binary643.9
Applied times-frac_binary640.4
Applied associate-*l*_binary640.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2021118
(FPCore (x y z)
:name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(+ (+ (+ (* (- x 0.5) (log x)) (- 0.91893853320467 x)) (/ 0.083333333333333 x)) (* (/ z x) (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
(+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))