
(FPCore (x y z t a) :precision binary64 (+ (- (+ (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((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
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
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));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(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 tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(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]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (- (+ (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((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
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
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));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + ((a - 0.5) * math.log(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 tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(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]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\end{array}
(FPCore (x y z t a) :precision binary64 (- (fma (+ a -0.5) (log t) (+ (log (+ x y)) (log z))) t))
double code(double x, double y, double z, double t, double a) {
return fma((a + -0.5), log(t), (log((x + y)) + log(z))) - t;
}
function code(x, y, z, t, a) return Float64(fma(Float64(a + -0.5), log(t), Float64(log(Float64(x + y)) + log(z))) - t) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a + -0.5, \log t, \log \left(x + y\right) + \log z\right) - t
\end{array}
Initial program 99.6%
+-commutative99.6%
associate-+r-99.6%
fma-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (log (+ x y))))
(if (<= t 280.0)
(+ t_1 (+ (log z) (* (log t) (- a 0.5))))
(+ (* (+ a -0.5) (log t)) (- t_1 t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log((x + y));
double tmp;
if (t <= 280.0) {
tmp = t_1 + (log(z) + (log(t) * (a - 0.5)));
} else {
tmp = ((a + -0.5) * log(t)) + (t_1 - t);
}
return tmp;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = log((x + y))
if (t <= 280.0d0) then
tmp = t_1 + (log(z) + (log(t) * (a - 0.5d0)))
else
tmp = ((a + (-0.5d0)) * log(t)) + (t_1 - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = Math.log((x + y));
double tmp;
if (t <= 280.0) {
tmp = t_1 + (Math.log(z) + (Math.log(t) * (a - 0.5)));
} else {
tmp = ((a + -0.5) * Math.log(t)) + (t_1 - t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log((x + y)) tmp = 0 if t <= 280.0: tmp = t_1 + (math.log(z) + (math.log(t) * (a - 0.5))) else: tmp = ((a + -0.5) * math.log(t)) + (t_1 - t) return tmp
function code(x, y, z, t, a) t_1 = log(Float64(x + y)) tmp = 0.0 if (t <= 280.0) tmp = Float64(t_1 + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))); else tmp = Float64(Float64(Float64(a + -0.5) * log(t)) + Float64(t_1 - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log((x + y)); tmp = 0.0; if (t <= 280.0) tmp = t_1 + (log(z) + (log(t) * (a - 0.5))); else tmp = ((a + -0.5) * log(t)) + (t_1 - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 280.0], N[(t$95$1 + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(x + y\right)\\
\mathbf{if}\;t \leq 280:\\
\;\;\;\;t_1 + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a + -0.5\right) \cdot \log t + \left(t_1 - t\right)\\
\end{array}
\end{array}
if t < 280Initial program 99.2%
associate-+l-99.2%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-udef99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in t around 0 98.4%
if 280 < t Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
expm1-log1p-u0.0%
Applied egg-rr0.0%
Taylor expanded in t around inf 98.8%
neg-mul-198.8%
Simplified98.8%
Final simplification98.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 470.0) (+ (log y) (- (log z) (* (log t) (- 0.5 a)))) (+ (* (+ a -0.5) (log t)) (- (log (+ x y)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 470.0) {
tmp = log(y) + (log(z) - (log(t) * (0.5 - a)));
} else {
tmp = ((a + -0.5) * log(t)) + (log((x + y)) - t);
}
return tmp;
}
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
real(8) :: tmp
if (t <= 470.0d0) then
tmp = log(y) + (log(z) - (log(t) * (0.5d0 - a)))
else
tmp = ((a + (-0.5d0)) * log(t)) + (log((x + y)) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 470.0) {
tmp = Math.log(y) + (Math.log(z) - (Math.log(t) * (0.5 - a)));
} else {
tmp = ((a + -0.5) * Math.log(t)) + (Math.log((x + y)) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 470.0: tmp = math.log(y) + (math.log(z) - (math.log(t) * (0.5 - a))) else: tmp = ((a + -0.5) * math.log(t)) + (math.log((x + y)) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 470.0) tmp = Float64(log(y) + Float64(log(z) - Float64(log(t) * Float64(0.5 - a)))); else tmp = Float64(Float64(Float64(a + -0.5) * log(t)) + Float64(log(Float64(x + y)) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 470.0) tmp = log(y) + (log(z) - (log(t) * (0.5 - a))); else tmp = ((a + -0.5) * log(t)) + (log((x + y)) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 470.0], N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * N[(0.5 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 470:\\
\;\;\;\;\log y + \left(\log z - \log t \cdot \left(0.5 - a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a + -0.5\right) \cdot \log t + \left(\log \left(x + y\right) - t\right)\\
\end{array}
\end{array}
if t < 470Initial program 99.2%
associate--l+99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around 0 67.3%
Taylor expanded in t around 0 66.4%
if 470 < t Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
expm1-log1p-u0.0%
Applied egg-rr0.0%
Taylor expanded in t around inf 98.8%
neg-mul-198.8%
Simplified98.8%
Final simplification83.9%
(FPCore (x y z t a) :precision binary64 (+ (+ (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((x + y)) + (log(z) - t)) + ((a + -0.5) * log(t));
}
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
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));
}
def code(x, y, z, t, a): return (math.log((x + y)) + (math.log(z) - t)) + ((a + -0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(log(Float64(x + y)) + Float64(log(z) - t)) + Float64(Float64(a + -0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = (log((x + y)) + (log(z) - t)) + ((a + -0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + -0.5\right) \cdot \log t
\end{array}
Initial program 99.6%
associate--l+99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log (+ x y)) (log z)) t) (* (log t) (- a 0.5))))
double code(double x, double y, double z, double t, double a) {
return ((log((x + y)) + log(z)) - t) + (log(t) * (a - 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) + (log(t) * (a - 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) + (Math.log(t) * (a - 0.5));
}
def code(x, y, z, t, a): return ((math.log((x + y)) + math.log(z)) - t) + (math.log(t) * (a - 0.5))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(log(t) * Float64(a - 0.5))) end
function tmp = code(x, y, z, t, a) tmp = ((log((x + y)) + log(z)) - t) + (log(t) * (a - 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[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \log t \cdot \left(a - 0.5\right)
\end{array}
Initial program 99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (- (+ (log y) (- (log z) (* (log t) (- 0.5 a)))) t))
double code(double x, double y, double z, double t, double a) {
return (log(y) + (log(z) - (log(t) * (0.5 - a)))) - t;
}
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) + (log(z) - (log(t) * (0.5d0 - a)))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(y) + (Math.log(z) - (Math.log(t) * (0.5 - a)))) - t;
}
def code(x, y, z, t, a): return (math.log(y) + (math.log(z) - (math.log(t) * (0.5 - a)))) - t
function code(x, y, z, t, a) return Float64(Float64(log(y) + Float64(log(z) - Float64(log(t) * Float64(0.5 - a)))) - t) end
function tmp = code(x, y, z, t, a) tmp = (log(y) + (log(z) - (log(t) * (0.5 - a)))) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * N[(0.5 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y + \left(\log z - \log t \cdot \left(0.5 - a\right)\right)\right) - t
\end{array}
Initial program 99.6%
associate--l+99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 69.2%
Final simplification69.2%
(FPCore (x y z t a)
:precision binary64
(if (<= (- a 0.5) -3.2e+16)
(- (* a (log t)) t)
(if (<= (- a 0.5) -0.49999998)
(+ (- (log (* (+ x y) z)) t) (* (log t) (- a 0.5)))
(+ (* (+ a -0.5) (log t)) (- (log (+ x y)) t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a - 0.5) <= -3.2e+16) {
tmp = (a * log(t)) - t;
} else if ((a - 0.5) <= -0.49999998) {
tmp = (log(((x + y) * z)) - t) + (log(t) * (a - 0.5));
} else {
tmp = ((a + -0.5) * log(t)) + (log((x + y)) - t);
}
return tmp;
}
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
real(8) :: tmp
if ((a - 0.5d0) <= (-3.2d+16)) then
tmp = (a * log(t)) - t
else if ((a - 0.5d0) <= (-0.49999998d0)) then
tmp = (log(((x + y) * z)) - t) + (log(t) * (a - 0.5d0))
else
tmp = ((a + (-0.5d0)) * log(t)) + (log((x + y)) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a - 0.5) <= -3.2e+16) {
tmp = (a * Math.log(t)) - t;
} else if ((a - 0.5) <= -0.49999998) {
tmp = (Math.log(((x + y) * z)) - t) + (Math.log(t) * (a - 0.5));
} else {
tmp = ((a + -0.5) * Math.log(t)) + (Math.log((x + y)) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a - 0.5) <= -3.2e+16: tmp = (a * math.log(t)) - t elif (a - 0.5) <= -0.49999998: tmp = (math.log(((x + y) * z)) - t) + (math.log(t) * (a - 0.5)) else: tmp = ((a + -0.5) * math.log(t)) + (math.log((x + y)) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(a - 0.5) <= -3.2e+16) tmp = Float64(Float64(a * log(t)) - t); elseif (Float64(a - 0.5) <= -0.49999998) tmp = Float64(Float64(log(Float64(Float64(x + y) * z)) - t) + Float64(log(t) * Float64(a - 0.5))); else tmp = Float64(Float64(Float64(a + -0.5) * log(t)) + Float64(log(Float64(x + y)) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a - 0.5) <= -3.2e+16) tmp = (a * log(t)) - t; elseif ((a - 0.5) <= -0.49999998) tmp = (log(((x + y) * z)) - t) + (log(t) * (a - 0.5)); else tmp = ((a + -0.5) * log(t)) + (log((x + y)) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a - 0.5), $MachinePrecision], -3.2e+16], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(a - 0.5), $MachinePrecision], -0.49999998], N[(N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -3.2 \cdot 10^{+16}:\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{elif}\;a - 0.5 \leq -0.49999998:\\
\;\;\;\;\left(\log \left(\left(x + y\right) \cdot z\right) - t\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a + -0.5\right) \cdot \log t + \left(\log \left(x + y\right) - t\right)\\
\end{array}
\end{array}
if (-.f64 a 1/2) < -3.2e16Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 69.8%
Taylor expanded in a around inf 99.8%
*-commutative99.8%
Simplified99.8%
if -3.2e16 < (-.f64 a 1/2) < -0.49999998000000001Initial program 99.5%
sum-log77.9%
Applied egg-rr77.9%
if -0.49999998000000001 < (-.f64 a 1/2) Initial program 99.5%
associate--l+99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
expm1-log1p-u24.4%
Applied egg-rr24.4%
Taylor expanded in t around inf 99.5%
neg-mul-199.5%
Simplified99.5%
Final simplification88.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -4.6) (not (<= a 2.3e-8))) (- (* a (log t)) t) (+ (log (+ x y)) (- (log z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -4.6) || !(a <= 2.3e-8)) {
tmp = (a * log(t)) - t;
} else {
tmp = log((x + y)) + (log(z) - t);
}
return tmp;
}
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
real(8) :: tmp
if ((a <= (-4.6d0)) .or. (.not. (a <= 2.3d-8))) then
tmp = (a * log(t)) - t
else
tmp = log((x + y)) + (log(z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -4.6) || !(a <= 2.3e-8)) {
tmp = (a * Math.log(t)) - t;
} else {
tmp = Math.log((x + y)) + (Math.log(z) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -4.6) or not (a <= 2.3e-8): tmp = (a * math.log(t)) - t else: tmp = math.log((x + y)) + (math.log(z) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -4.6) || !(a <= 2.3e-8)) tmp = Float64(Float64(a * log(t)) - t); else tmp = Float64(log(Float64(x + y)) + Float64(log(z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -4.6) || ~((a <= 2.3e-8))) tmp = (a * log(t)) - t; else tmp = log((x + y)) + (log(z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -4.6], N[Not[LessEqual[a, 2.3e-8]], $MachinePrecision]], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.6 \lor \neg \left(a \leq 2.3 \cdot 10^{-8}\right):\\
\;\;\;\;a \cdot \log t - t\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + y\right) + \left(\log z - t\right)\\
\end{array}
\end{array}
if a < -4.5999999999999996 or 2.3000000000000001e-8 < a Initial program 99.7%
associate--l+99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 74.0%
Taylor expanded in a around inf 99.1%
*-commutative99.1%
Simplified99.1%
if -4.5999999999999996 < a < 2.3000000000000001e-8Initial program 99.5%
associate-+l-99.5%
associate--l+99.5%
sub-neg99.5%
+-commutative99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
fma-udef99.5%
sub-neg99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in t around inf 60.6%
Final simplification79.9%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.8e-7) (+ (log (* (+ x y) z)) (* (log t) (- a 0.5))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.8e-7) {
tmp = log(((x + y) * z)) + (log(t) * (a - 0.5));
} else {
tmp = (a * log(t)) - t;
}
return tmp;
}
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
real(8) :: tmp
if (t <= 1.8d-7) then
tmp = log(((x + y) * z)) + (log(t) * (a - 0.5d0))
else
tmp = (a * log(t)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.8e-7) {
tmp = Math.log(((x + y) * z)) + (Math.log(t) * (a - 0.5));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.8e-7: tmp = math.log(((x + y) * z)) + (math.log(t) * (a - 0.5)) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.8e-7) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(log(t) * Float64(a - 0.5))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.8e-7) tmp = log(((x + y) * z)) + (log(t) * (a - 0.5)); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.8e-7], N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.8 \cdot 10^{-7}:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 1.79999999999999997e-7Initial program 99.3%
associate-+l-99.3%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-udef99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in t around 0 99.2%
log-prod71.1%
+-commutative71.1%
Simplified71.1%
if 1.79999999999999997e-7 < t Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 71.9%
Taylor expanded in a around inf 97.5%
*-commutative97.5%
Simplified97.5%
Final simplification85.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 2.15e-7) (+ (log (* (+ x y) z)) (* (log t) (- a 0.5))) (+ (* (+ a -0.5) (log t)) (- (log (+ x y)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.15e-7) {
tmp = log(((x + y) * z)) + (log(t) * (a - 0.5));
} else {
tmp = ((a + -0.5) * log(t)) + (log((x + y)) - t);
}
return tmp;
}
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
real(8) :: tmp
if (t <= 2.15d-7) then
tmp = log(((x + y) * z)) + (log(t) * (a - 0.5d0))
else
tmp = ((a + (-0.5d0)) * log(t)) + (log((x + y)) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.15e-7) {
tmp = Math.log(((x + y) * z)) + (Math.log(t) * (a - 0.5));
} else {
tmp = ((a + -0.5) * Math.log(t)) + (Math.log((x + y)) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2.15e-7: tmp = math.log(((x + y) * z)) + (math.log(t) * (a - 0.5)) else: tmp = ((a + -0.5) * math.log(t)) + (math.log((x + y)) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2.15e-7) tmp = Float64(log(Float64(Float64(x + y) * z)) + Float64(log(t) * Float64(a - 0.5))); else tmp = Float64(Float64(Float64(a + -0.5) * log(t)) + Float64(log(Float64(x + y)) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 2.15e-7) tmp = log(((x + y) * z)) + (log(t) * (a - 0.5)); else tmp = ((a + -0.5) * log(t)) + (log((x + y)) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.15e-7], N[(N[Log[N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.15 \cdot 10^{-7}:\\
\;\;\;\;\log \left(\left(x + y\right) \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a + -0.5\right) \cdot \log t + \left(\log \left(x + y\right) - t\right)\\
\end{array}
\end{array}
if t < 2.1500000000000001e-7Initial program 99.3%
associate-+l-99.3%
associate--l+99.2%
sub-neg99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-udef99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
metadata-eval99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Taylor expanded in t around 0 99.2%
log-prod71.1%
+-commutative71.1%
Simplified71.1%
if 2.1500000000000001e-7 < t Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
expm1-log1p-u2.7%
Applied egg-rr2.7%
Taylor expanded in t around inf 97.6%
neg-mul-197.6%
Simplified97.6%
Final simplification85.9%
(FPCore (x y z t a) :precision binary64 (if (<= t 2.35e-8) (+ (log (* y z)) (* (log t) (- a 0.5))) (- (* a (log t)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.35e-8) {
tmp = log((y * z)) + (log(t) * (a - 0.5));
} else {
tmp = (a * log(t)) - t;
}
return tmp;
}
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
real(8) :: tmp
if (t <= 2.35d-8) then
tmp = log((y * z)) + (log(t) * (a - 0.5d0))
else
tmp = (a * log(t)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.35e-8) {
tmp = Math.log((y * z)) + (Math.log(t) * (a - 0.5));
} else {
tmp = (a * Math.log(t)) - t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2.35e-8: tmp = math.log((y * z)) + (math.log(t) * (a - 0.5)) else: tmp = (a * math.log(t)) - t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2.35e-8) tmp = Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5))); else tmp = Float64(Float64(a * log(t)) - t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 2.35e-8) tmp = log((y * z)) + (log(t) * (a - 0.5)); else tmp = (a * log(t)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.35e-8], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.35 \cdot 10^{-8}:\\
\;\;\;\;\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \log t - t\\
\end{array}
\end{array}
if t < 2.3499999999999999e-8Initial program 99.3%
associate--l+99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 65.8%
Taylor expanded in t around 0 65.8%
Taylor expanded in t around inf 65.8%
associate-+r+65.9%
log-prod49.5%
mul-1-neg49.5%
unsub-neg49.5%
*-commutative49.5%
log-rec49.5%
sub-neg49.5%
metadata-eval49.5%
Simplified49.5%
Taylor expanded in t around 0 49.5%
mul-1-neg49.5%
sub-neg49.5%
metadata-eval49.5%
distribute-rgt-neg-in49.5%
neg-sub049.5%
+-commutative49.5%
associate--r+49.5%
metadata-eval49.5%
Simplified49.5%
if 2.3499999999999999e-8 < t Initial program 99.8%
associate--l+99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 71.9%
Taylor expanded in a around inf 97.5%
*-commutative97.5%
Simplified97.5%
Final simplification76.3%
(FPCore (x y z t a) :precision binary64 (if (<= t 1.72e+86) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.72e+86) {
tmp = a * log(t);
} else {
tmp = -t;
}
return tmp;
}
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
real(8) :: tmp
if (t <= 1.72d+86) then
tmp = a * log(t)
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.72e+86) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 1.72e+86: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.72e+86) tmp = Float64(a * log(t)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 1.72e+86) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.72e+86], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.72 \cdot 10^{+86}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 1.72e86Initial program 99.3%
associate-+l-99.4%
associate--l+99.3%
sub-neg99.3%
+-commutative99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
fma-udef99.3%
sub-neg99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in a around inf 51.1%
*-commutative51.1%
Simplified51.1%
if 1.72e86 < t Initial program 99.9%
associate-+l-99.9%
associate--l+99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-udef99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 81.5%
neg-mul-181.5%
Simplified81.5%
Final simplification64.1%
(FPCore (x y z t a) :precision binary64 (- (* a (log t)) t))
double code(double x, double y, double z, double t, double a) {
return (a * log(t)) - t;
}
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 = (a * log(t)) - t
end function
public static double code(double x, double y, double z, double t, double a) {
return (a * Math.log(t)) - t;
}
def code(x, y, z, t, a): return (a * math.log(t)) - t
function code(x, y, z, t, a) return Float64(Float64(a * log(t)) - t) end
function tmp = code(x, y, z, t, a) tmp = (a * log(t)) - t; end
code[x_, y_, z_, t_, a_] := N[(N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \log t - t
\end{array}
Initial program 99.6%
associate--l+99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 69.2%
Taylor expanded in a around inf 76.1%
*-commutative76.1%
Simplified76.1%
Final simplification76.1%
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
return -t;
}
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 = -t
end function
public static double code(double x, double y, double z, double t, double a) {
return -t;
}
def code(x, y, z, t, a): return -t
function code(x, y, z, t, a) return Float64(-t) end
function tmp = code(x, y, z, t, a) tmp = -t; end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 99.6%
associate-+l-99.6%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-udef99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in t around inf 40.3%
neg-mul-140.3%
Simplified40.3%
Final simplification40.3%
(FPCore (x y z t a) :precision binary64 (+ (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((x + y)) + ((log(z) - t) + ((a - 0.5) * log(t)));
}
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
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)));
}
def code(x, y, z, t, a): return math.log((x + y)) + ((math.log(z) - t) + ((a - 0.5) * math.log(t)))
function code(x, y, z, t, a) return Float64(log(Float64(x + y)) + Float64(Float64(log(z) - t) + Float64(Float64(a - 0.5) * log(t)))) end
function tmp = code(x, y, z, t, a) tmp = log((x + y)) + ((log(z) - t) + ((a - 0.5) * log(t))); end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + y\right) + \left(\left(\log z - t\right) + \left(a - 0.5\right) \cdot \log t\right)
\end{array}
herbie shell --seed 2024024
(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))))