
(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 (+ (- (log z) t) (fma (+ a -0.5) (log t) (log (+ x y)))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + fma((a + -0.5), log(t), log((x + y)));
}
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + fma(Float64(a + -0.5), log(t), log(Float64(x + y)))) end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \mathsf{fma}\left(a + -0.5, \log t, \log \left(x + y\right)\right)
\end{array}
Initial program 99.6%
+-commutative99.6%
associate--l+99.6%
associate-+r+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
(FPCore (x y z t a) :precision binary64 (if (<= t 0.425) (+ (+ (log z) (log y)) (* (+ a -0.5) (log t))) (+ (- (log z) t) (+ (log y) (* a (log t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 0.425) {
tmp = (log(z) + log(y)) + ((a + -0.5) * log(t));
} else {
tmp = (log(z) - t) + (log(y) + (a * log(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 <= 0.425d0) then
tmp = (log(z) + log(y)) + ((a + (-0.5d0)) * log(t))
else
tmp = (log(z) - t) + (log(y) + (a * log(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 <= 0.425) {
tmp = (Math.log(z) + Math.log(y)) + ((a + -0.5) * Math.log(t));
} else {
tmp = (Math.log(z) - t) + (Math.log(y) + (a * Math.log(t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 0.425: tmp = (math.log(z) + math.log(y)) + ((a + -0.5) * math.log(t)) else: tmp = (math.log(z) - t) + (math.log(y) + (a * math.log(t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 0.425) tmp = Float64(Float64(log(z) + log(y)) + Float64(Float64(a + -0.5) * log(t))); else tmp = Float64(Float64(log(z) - t) + Float64(log(y) + Float64(a * log(t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 0.425) tmp = (log(z) + log(y)) + ((a + -0.5) * log(t)); else tmp = (log(z) - t) + (log(y) + (a * log(t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 0.425], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.425:\\
\;\;\;\;\left(\log z + \log y\right) + \left(a + -0.5\right) \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + \left(\log y + a \cdot \log t\right)\\
\end{array}
\end{array}
if t < 0.424999999999999989Initial program 99.4%
+-commutative99.4%
associate--l+99.4%
associate-+r+99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 68.0%
Taylor expanded in t around 0 67.4%
associate-+r+67.5%
sub-neg67.5%
metadata-eval67.5%
Simplified67.5%
if 0.424999999999999989 < t Initial program 99.8%
+-commutative99.8%
associate--l+99.8%
associate-+r+99.8%
+-commutative99.8%
fma-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 75.1%
Taylor expanded in a around inf 75.1%
Final simplification71.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t 7.5e-6)
(+ (+ (log z) (log y)) (* (+ a -0.5) (log t)))
(if (<= t 1.9e+151)
(+ (* (log t) (- a 0.5)) (- (log (* z (+ x y))) t))
(- t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 7.5e-6) {
tmp = (log(z) + log(y)) + ((a + -0.5) * log(t));
} else if (t <= 1.9e+151) {
tmp = (log(t) * (a - 0.5)) + (log((z * (x + y))) - 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 <= 7.5d-6) then
tmp = (log(z) + log(y)) + ((a + (-0.5d0)) * log(t))
else if (t <= 1.9d+151) then
tmp = (log(t) * (a - 0.5d0)) + (log((z * (x + y))) - 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 <= 7.5e-6) {
tmp = (Math.log(z) + Math.log(y)) + ((a + -0.5) * Math.log(t));
} else if (t <= 1.9e+151) {
tmp = (Math.log(t) * (a - 0.5)) + (Math.log((z * (x + y))) - t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 7.5e-6: tmp = (math.log(z) + math.log(y)) + ((a + -0.5) * math.log(t)) elif t <= 1.9e+151: tmp = (math.log(t) * (a - 0.5)) + (math.log((z * (x + y))) - t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 7.5e-6) tmp = Float64(Float64(log(z) + log(y)) + Float64(Float64(a + -0.5) * log(t))); elseif (t <= 1.9e+151) tmp = Float64(Float64(log(t) * Float64(a - 0.5)) + Float64(log(Float64(z * Float64(x + y))) - t)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 7.5e-6) tmp = (log(z) + log(y)) + ((a + -0.5) * log(t)); elseif (t <= 1.9e+151) tmp = (log(t) * (a - 0.5)) + (log((z * (x + y))) - t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 7.5e-6], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.9e+151], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 7.5 \cdot 10^{-6}:\\
\;\;\;\;\left(\log z + \log y\right) + \left(a + -0.5\right) \cdot \log t\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{+151}:\\
\;\;\;\;\log t \cdot \left(a - 0.5\right) + \left(\log \left(z \cdot \left(x + y\right)\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 7.50000000000000019e-6Initial program 99.4%
+-commutative99.4%
associate--l+99.4%
associate-+r+99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 68.8%
Taylor expanded in t around 0 68.6%
associate-+r+68.7%
sub-neg68.7%
metadata-eval68.7%
Simplified68.7%
if 7.50000000000000019e-6 < t < 1.9e151Initial program 99.8%
sum-log80.2%
Applied egg-rr80.2%
if 1.9e151 < 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-undefine99.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 83.6%
neg-mul-183.6%
Simplified83.6%
Final simplification75.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (log t) (- a 0.5))))
(if (<= t 1.6e-5)
(+ (log y) (+ (log z) t_1))
(if (<= t 7.6e+150) (+ t_1 (- (log (* z (+ x y))) t)) (- t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = log(t) * (a - 0.5);
double tmp;
if (t <= 1.6e-5) {
tmp = log(y) + (log(z) + t_1);
} else if (t <= 7.6e+150) {
tmp = t_1 + (log((z * (x + y))) - 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) :: t_1
real(8) :: tmp
t_1 = log(t) * (a - 0.5d0)
if (t <= 1.6d-5) then
tmp = log(y) + (log(z) + t_1)
else if (t <= 7.6d+150) then
tmp = t_1 + (log((z * (x + y))) - 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 t_1 = Math.log(t) * (a - 0.5);
double tmp;
if (t <= 1.6e-5) {
tmp = Math.log(y) + (Math.log(z) + t_1);
} else if (t <= 7.6e+150) {
tmp = t_1 + (Math.log((z * (x + y))) - t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = math.log(t) * (a - 0.5) tmp = 0 if t <= 1.6e-5: tmp = math.log(y) + (math.log(z) + t_1) elif t <= 7.6e+150: tmp = t_1 + (math.log((z * (x + y))) - t) else: tmp = -t return tmp
function code(x, y, z, t, a) t_1 = Float64(log(t) * Float64(a - 0.5)) tmp = 0.0 if (t <= 1.6e-5) tmp = Float64(log(y) + Float64(log(z) + t_1)); elseif (t <= 7.6e+150) tmp = Float64(t_1 + Float64(log(Float64(z * Float64(x + y))) - t)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = log(t) * (a - 0.5); tmp = 0.0; if (t <= 1.6e-5) tmp = log(y) + (log(z) + t_1); elseif (t <= 7.6e+150) tmp = t_1 + (log((z * (x + y))) - t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 1.6e-5], N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.6e+150], N[(t$95$1 + N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], (-t)]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log t \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t \leq 1.6 \cdot 10^{-5}:\\
\;\;\;\;\log y + \left(\log z + t\_1\right)\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{+150}:\\
\;\;\;\;t\_1 + \left(\log \left(z \cdot \left(x + y\right)\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 1.59999999999999993e-5Initial program 99.4%
+-commutative99.4%
associate--l+99.4%
associate-+r+99.4%
+-commutative99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around 0 68.8%
Taylor expanded in t around 0 68.6%
if 1.59999999999999993e-5 < t < 7.59999999999999978e150Initial program 99.8%
sum-log80.2%
Applied egg-rr80.2%
if 7.59999999999999978e150 < 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-undefine99.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 83.6%
neg-mul-183.6%
Simplified83.6%
Final simplification75.5%
(FPCore (x y z t a) :precision binary64 (+ (- (+ (log z) (log (+ x y))) t) (* (log t) (- a 0.5))))
double code(double x, double y, double z, double t, double a) {
return ((log(z) + log((x + y))) - 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(z) + log((x + y))) - 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(z) + Math.log((x + y))) - t) + (Math.log(t) * (a - 0.5));
}
def code(x, y, z, t, a): return ((math.log(z) + math.log((x + y))) - t) + (math.log(t) * (a - 0.5))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(z) + log(Float64(x + y))) - t) + Float64(log(t) * Float64(a - 0.5))) end
function tmp = code(x, y, z, t, a) tmp = ((log(z) + log((x + y))) - t) + (log(t) * (a - 0.5)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[z], $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log z + \log \left(x + y\right)\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 z) t) (log (+ x y))) (* (+ a -0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
return ((log(z) - t) + log((x + y))) + ((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(z) - t) + log((x + y))) + ((a + (-0.5d0)) * log(t))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((Math.log(z) - t) + Math.log((x + y))) + ((a + -0.5) * Math.log(t));
}
def code(x, y, z, t, a): return ((math.log(z) - t) + math.log((x + y))) + ((a + -0.5) * math.log(t))
function code(x, y, z, t, a) return Float64(Float64(Float64(log(z) - t) + log(Float64(x + y))) + Float64(Float64(a + -0.5) * log(t))) end
function tmp = code(x, y, z, t, a) tmp = ((log(z) - t) + log((x + y))) + ((a + -0.5) * log(t)); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log z - t\right) + \log \left(x + y\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 z) t) (+ (log y) (* (log t) (- a 0.5)))))
double code(double x, double y, double z, double t, double a) {
return (log(z) - t) + (log(y) + (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(z) - t) + (log(y) + (log(t) * (a - 0.5d0)))
end function
public static double code(double x, double y, double z, double t, double a) {
return (Math.log(z) - t) + (Math.log(y) + (Math.log(t) * (a - 0.5)));
}
def code(x, y, z, t, a): return (math.log(z) - t) + (math.log(y) + (math.log(t) * (a - 0.5)))
function code(x, y, z, t, a) return Float64(Float64(log(z) - t) + Float64(log(y) + Float64(log(t) * Float64(a - 0.5)))) end
function tmp = code(x, y, z, t, a) tmp = (log(z) - t) + (log(y) + (log(t) * (a - 0.5))); end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\log z - t\right) + \left(\log y + \log t \cdot \left(a - 0.5\right)\right)
\end{array}
Initial program 99.6%
+-commutative99.6%
associate--l+99.6%
associate-+r+99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 71.5%
(FPCore (x y z t a) :precision binary64 (if (<= t 4.3e+151) (+ (* (log t) (- a 0.5)) (- (log (* z (+ x y))) t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 4.3e+151) {
tmp = (log(t) * (a - 0.5)) + (log((z * (x + y))) - 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 <= 4.3d+151) then
tmp = (log(t) * (a - 0.5d0)) + (log((z * (x + y))) - 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 <= 4.3e+151) {
tmp = (Math.log(t) * (a - 0.5)) + (Math.log((z * (x + y))) - t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 4.3e+151: tmp = (math.log(t) * (a - 0.5)) + (math.log((z * (x + y))) - t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 4.3e+151) tmp = Float64(Float64(log(t) * Float64(a - 0.5)) + Float64(log(Float64(z * Float64(x + y))) - t)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 4.3e+151) tmp = (log(t) * (a - 0.5)) + (log((z * (x + y))) - t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 4.3e+151], N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.3 \cdot 10^{+151}:\\
\;\;\;\;\log t \cdot \left(a - 0.5\right) + \left(\log \left(z \cdot \left(x + y\right)\right) - t\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 4.29999999999999983e151Initial program 99.5%
sum-log76.1%
Applied egg-rr76.1%
if 4.29999999999999983e151 < 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-undefine99.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 83.6%
neg-mul-183.6%
Simplified83.6%
Final simplification78.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -820000000000.0) (not (<= a 2.25e+26))) (* a (log t)) (+ (- (log z) t) (log y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -820000000000.0) || !(a <= 2.25e+26)) {
tmp = a * log(t);
} else {
tmp = (log(z) - t) + log(y);
}
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 <= (-820000000000.0d0)) .or. (.not. (a <= 2.25d+26))) then
tmp = a * log(t)
else
tmp = (log(z) - t) + log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -820000000000.0) || !(a <= 2.25e+26)) {
tmp = a * Math.log(t);
} else {
tmp = (Math.log(z) - t) + Math.log(y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -820000000000.0) or not (a <= 2.25e+26): tmp = a * math.log(t) else: tmp = (math.log(z) - t) + math.log(y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -820000000000.0) || !(a <= 2.25e+26)) tmp = Float64(a * log(t)); else tmp = Float64(Float64(log(z) - t) + log(y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -820000000000.0) || ~((a <= 2.25e+26))) tmp = a * log(t); else tmp = (log(z) - t) + log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -820000000000.0], N[Not[LessEqual[a, 2.25e+26]], $MachinePrecision]], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -820000000000 \lor \neg \left(a \leq 2.25 \cdot 10^{+26}\right):\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;\left(\log z - t\right) + \log y\\
\end{array}
\end{array}
if a < -8.2e11 or 2.24999999999999989e26 < a 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-undefine99.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in a around inf 74.7%
*-commutative74.7%
Simplified74.7%
if -8.2e11 < a < 2.24999999999999989e26Initial program 99.6%
associate-+l-99.6%
associate--l+99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
fma-undefine99.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 98.9%
mul-1-neg98.9%
associate-/l*98.8%
distribute-lft-neg-in98.8%
log-rec98.8%
remove-double-neg98.8%
Simplified98.8%
Taylor expanded in x around 0 67.1%
Taylor expanded in t around inf 42.4%
Final simplification58.4%
(FPCore (x y z t a) :precision binary64 (if (<= t 2.65e+14) (* a (log t)) (- t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 2.65e+14) {
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 <= 2.65d+14) 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 <= 2.65e+14) {
tmp = a * Math.log(t);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 2.65e+14: tmp = a * math.log(t) else: tmp = -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 2.65e+14) 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 <= 2.65e+14) tmp = a * log(t); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.65e+14], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.65 \cdot 10^{+14}:\\
\;\;\;\;a \cdot \log t\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < 2.65e14Initial program 99.4%
associate-+l-99.4%
associate--l+99.4%
sub-neg99.4%
+-commutative99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
fma-undefine99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
metadata-eval99.4%
metadata-eval99.4%
unsub-neg99.4%
Simplified99.4%
Taylor expanded in a around inf 54.0%
*-commutative54.0%
Simplified54.0%
if 2.65e14 < t Initial program 99.8%
associate-+l-99.8%
associate--l+99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-undefine99.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 77.4%
neg-mul-177.4%
Simplified77.4%
Final simplification65.1%
(FPCore (x y z t a) :precision binary64 (+ (* t (+ (/ 1.0 t) -1.0)) -1.0))
double code(double x, double y, double z, double t, double a) {
return (t * ((1.0 / t) + -1.0)) + -1.0;
}
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 * ((1.0d0 / t) + (-1.0d0))) + (-1.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return (t * ((1.0 / t) + -1.0)) + -1.0;
}
def code(x, y, z, t, a): return (t * ((1.0 / t) + -1.0)) + -1.0
function code(x, y, z, t, a) return Float64(Float64(t * Float64(Float64(1.0 / t) + -1.0)) + -1.0) end
function tmp = code(x, y, z, t, a) tmp = (t * ((1.0 / t) + -1.0)) + -1.0; end
code[x_, y_, z_, t_, a_] := N[(N[(t * N[(N[(1.0 / t), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(\frac{1}{t} + -1\right) + -1
\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-undefine99.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 38.3%
neg-mul-138.3%
Simplified38.3%
expm1-log1p-u1.4%
expm1-undefine1.4%
Applied egg-rr1.4%
sub-neg1.4%
log1p-undefine1.4%
rem-exp-log38.3%
unsub-neg38.3%
metadata-eval38.3%
Simplified38.3%
Taylor expanded in t around inf 38.4%
Final simplification38.4%
(FPCore (x y z t a) :precision binary64 (+ -1.0 (- 1.0 t)))
double code(double x, double y, double z, double t, double a) {
return -1.0 + (1.0 - 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 = (-1.0d0) + (1.0d0 - t)
end function
public static double code(double x, double y, double z, double t, double a) {
return -1.0 + (1.0 - t);
}
def code(x, y, z, t, a): return -1.0 + (1.0 - t)
function code(x, y, z, t, a) return Float64(-1.0 + Float64(1.0 - t)) end
function tmp = code(x, y, z, t, a) tmp = -1.0 + (1.0 - t); end
code[x_, y_, z_, t_, a_] := N[(-1.0 + N[(1.0 - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1 + \left(1 - t\right)
\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-undefine99.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 38.3%
neg-mul-138.3%
Simplified38.3%
expm1-log1p-u1.4%
expm1-undefine1.4%
Applied egg-rr1.4%
sub-neg1.4%
log1p-undefine1.4%
rem-exp-log38.3%
unsub-neg38.3%
metadata-eval38.3%
Simplified38.3%
Final simplification38.3%
(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-undefine99.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 38.3%
neg-mul-138.3%
Simplified38.3%
(FPCore (x y z t a) :precision binary64 0.0)
double code(double x, double y, double z, double t, double a) {
return 0.0;
}
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 = 0.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
return 0.0;
}
def code(x, y, z, t, a): return 0.0
function code(x, y, z, t, a) return 0.0 end
function tmp = code(x, y, z, t, a) tmp = 0.0; end
code[x_, y_, z_, t_, a_] := 0.0
\begin{array}{l}
\\
0
\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-undefine99.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 38.3%
neg-mul-138.3%
Simplified38.3%
expm1-log1p-u1.4%
expm1-undefine1.4%
Applied egg-rr1.4%
sub-neg1.4%
log1p-undefine1.4%
rem-exp-log38.3%
unsub-neg38.3%
metadata-eval38.3%
Simplified38.3%
Taylor expanded in t around 0 2.4%
metadata-eval2.4%
Applied egg-rr2.4%
(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 2024144
(FPCore (x y z t a)
:name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (+ (log (+ x y)) (+ (- (log z) t) (* (- a 1/2) (log t)))))
(+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))