(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 x)) (* a (log t))) (+ (+ t (log (/ 1.0 z))) (* (log t) 0.5))))
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 + x)) + (a * log(t))) - ((t + log((1.0 / z))) + (log(t) * 0.5));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((log((x + y)) + log(z)) - t) + ((a - 0.5d0) * log(t))
end function
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (log((y + x)) + (a * log(t))) - ((t + log((1.0d0 / z))) + (log(t) * 0.5d0))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log((x + y)) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
}
public static double code(double x, double y, double z, double t, double a) {
return (Math.log((y + x)) + (a * Math.log(t))) - ((t + Math.log((1.0 / z))) + (Math.log(t) * 0.5));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
def code(x, y, z, t, a): return (math.log((y + x)) + (a * math.log(t))) - ((t + math.log((1.0 / z))) + (math.log(t) * 0.5))
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(Float64(y + x)) + Float64(a * log(t))) - Float64(Float64(t + log(Float64(1.0 / z))) + Float64(log(t) * 0.5))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t)); end
function tmp = code(x, y, z, t, a) tmp = (log((y + x)) + (a * log(t))) - ((t + log((1.0 / z))) + (log(t) * 0.5)); 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[N[(y + x), $MachinePrecision]], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t + N[Log[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\left(\log \left(y + x\right) + a \cdot \log t\right) - \left(\left(t + \log \left(\frac{1}{z}\right)\right) + \log t \cdot 0.5\right)




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 0.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
Initial program 0.3
Simplified0.3
Taylor expanded in z around inf 0.3
Applied associate-+r+_binary640.3
Final simplification0.3
herbie shell --seed 2022129
(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))))