(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
(FPCore (x y z t a) :precision binary64 (+ (+ (log y) (fma (log t) (+ -0.5 a) (log z))) (- (/ x y) t)))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
double code(double x, double y, double z, double t, double a) {
return (log(y) + fma(log(t), (-0.5 + a), log(z))) + ((x / y) - t);
}
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t))) end
function code(x, y, z, t, a) return Float64(Float64(log(y) + fma(log(t), Float64(-0.5 + a), log(z))) + Float64(Float64(x / y) - t)) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(-0.5 + a), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\left(\log y + \mathsf{fma}\left(\log t, -0.5 + a, \log z\right)\right) + \left(\frac{x}{y} - t\right)




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 0.2 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
Initial program 0.2
Taylor expanded in x around 0 0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2022170
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))