
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (fma (+ x -1.0) (log y) (fma (+ -1.0 z) (log1p (- y)) (- t))))
double code(double x, double y, double z, double t) {
return fma((x + -1.0), log(y), fma((-1.0 + z), log1p(-y), -t));
}
function code(x, y, z, t) return fma(Float64(x + -1.0), log(y), fma(Float64(-1.0 + z), log1p(Float64(-y)), Float64(-t))) end
code[x_, y_, z_, t_] := N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), -t\right)\right)
\end{array}
Initial program 91.1%
associate--l+91.1%
fma-def91.2%
sub-neg91.2%
metadata-eval91.2%
fma-neg91.2%
sub-neg91.2%
metadata-eval91.2%
sub-neg91.2%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (fma (+ -1.0 z) (log1p (- y)) (* (+ x -1.0) (log y))) t))
double code(double x, double y, double z, double t) {
return fma((-1.0 + z), log1p(-y), ((x + -1.0) * log(y))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-1.0 + z), log1p(Float64(-y)), Float64(Float64(x + -1.0) * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 + z), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t
\end{array}
Initial program 91.1%
+-commutative91.1%
fma-def91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (fma z (log1p (- y)) (- (* (+ x -1.0) (log y)) t)))
double code(double x, double y, double z, double t) {
return fma(z, log1p(-y), (((x + -1.0) * log(y)) - t));
}
function code(x, y, z, t) return fma(z, log1p(Float64(-y)), Float64(Float64(Float64(x + -1.0) * log(y)) - t)) end
code[x_, y_, z_, t_] := N[(z * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y - t\right)
\end{array}
Initial program 91.1%
Taylor expanded in z around inf 90.9%
*-commutative90.9%
sub-neg90.9%
mul-1-neg90.9%
log1p-def99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 90.9%
+-commutative90.9%
*-commutative90.9%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* z (log1p (- y)))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (z * log1p(-y))) - t;
}
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + (z * Math.log1p(-y))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (z * math.log1p(-y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(z * log1p(Float64(-y)))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + z \cdot \mathsf{log1p}\left(-y\right)\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in z around inf 90.9%
*-commutative90.9%
sub-neg90.9%
mul-1-neg90.9%
log1p-def99.5%
mul-1-neg99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (- (* (* y y) (+ 0.5 (* z -0.5))) (* y (+ -1.0 z)))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (((y * y) * (0.5 + (z * -0.5))) - (y * (-1.0 + z)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x + (-1.0d0)) * log(y)) + (((y * y) * (0.5d0 + (z * (-0.5d0)))) - (y * ((-1.0d0) + z)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + (((y * y) * (0.5 + (z * -0.5))) - (y * (-1.0 + z)))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (((y * y) * (0.5 + (z * -0.5))) - (y * (-1.0 + z)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(Float64(Float64(y * y) * Float64(0.5 + Float64(z * -0.5))) - Float64(y * Float64(-1.0 + z)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + (((y * y) * (0.5 + (z * -0.5))) - (y * (-1.0 + z)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y * y), $MachinePrecision] * N[(0.5 + N[(z * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + \left(\left(y \cdot y\right) \cdot \left(0.5 + z \cdot -0.5\right) - y \cdot \left(-1 + z\right)\right)\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
unsub-neg98.9%
associate-*r*98.9%
*-commutative98.9%
unpow298.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
distribute-lft-in98.9%
metadata-eval98.9%
*-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* z (- (* (* y y) -0.5) y))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (z * (((y * y) * -0.5) - y))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x + (-1.0d0)) * log(y)) + (z * (((y * y) * (-0.5d0)) - y))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + (z * (((y * y) * -0.5) - y))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (z * (((y * y) * -0.5) - y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(z * Float64(Float64(Float64(y * y) * -0.5) - y))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + (z * (((y * y) * -0.5) - y))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[(N[(N[(y * y), $MachinePrecision] * -0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + z \cdot \left(\left(y \cdot y\right) \cdot -0.5 - y\right)\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in z around inf 90.9%
*-commutative90.9%
sub-neg90.9%
mul-1-neg90.9%
log1p-def99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in y around 0 98.8%
+-commutative98.8%
associate-*r*98.8%
associate-*r*98.8%
distribute-rgt-out98.8%
neg-mul-198.8%
unpow298.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* y (- 1.0 z))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (y * (1.0 - z))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x + (-1.0d0)) * log(y)) + (y * (1.0d0 - z))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + (y * (1.0 - z))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (y * (1.0 - z))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(y * Float64(1.0 - z))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + (y * (1.0 - z))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + y \cdot \left(1 - z\right)\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
unsub-neg98.9%
associate-*r*98.9%
*-commutative98.9%
unpow298.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
distribute-lft-in98.9%
metadata-eval98.9%
*-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in y around 0 98.4%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (- (- (* (+ x -1.0) (log y)) (* y z)) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) - (y * z)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x + (-1.0d0)) * log(y)) - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) - (y * z)) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) - (y * z)) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) - Float64(y * z)) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) - (y * z)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y - y \cdot z\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in z around inf 90.9%
*-commutative90.9%
sub-neg90.9%
mul-1-neg90.9%
log1p-def99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in y around 0 98.3%
+-commutative98.3%
sub-neg98.3%
metadata-eval98.3%
mul-1-neg98.3%
unsub-neg98.3%
*-commutative98.3%
+-commutative98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.9e+18) (not (<= x 3.7e+87))) (* x (log y)) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.9e+18) || !(x <= 3.7e+87)) {
tmp = x * log(y);
} else {
tmp = -t - log(y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-2.9d+18)) .or. (.not. (x <= 3.7d+87))) then
tmp = x * log(y)
else
tmp = -t - log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.9e+18) || !(x <= 3.7e+87)) {
tmp = x * Math.log(y);
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.9e+18) or not (x <= 3.7e+87): tmp = x * math.log(y) else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.9e+18) || !(x <= 3.7e+87)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(-t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.9e+18) || ~((x <= 3.7e+87))) tmp = x * log(y); else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.9e+18], N[Not[LessEqual[x, 3.7e+87]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{+18} \lor \neg \left(x \leq 3.7 \cdot 10^{+87}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if x < -2.9e18 or 3.70000000000000003e87 < x Initial program 96.5%
Taylor expanded in z around inf 96.5%
*-commutative96.5%
sub-neg96.5%
mul-1-neg96.5%
log1p-def99.6%
mul-1-neg99.6%
Simplified99.6%
Taylor expanded in x around inf 75.8%
if -2.9e18 < x < 3.70000000000000003e87Initial program 87.3%
Taylor expanded in y around 0 84.6%
fma-neg84.6%
sub-neg84.6%
metadata-eval84.6%
+-commutative84.6%
Simplified84.6%
Taylor expanded in x around 0 77.7%
mul-1-neg77.7%
Simplified77.7%
Final simplification76.9%
(FPCore (x y z t) :precision binary64 (if (<= t -2e+31) (- t) (if (<= t 1.22e+23) (* x (log y)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2e+31) {
tmp = -t;
} else if (t <= 1.22e+23) {
tmp = x * log(y);
} else {
tmp = -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-2d+31)) then
tmp = -t
else if (t <= 1.22d+23) then
tmp = x * log(y)
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2e+31) {
tmp = -t;
} else if (t <= 1.22e+23) {
tmp = x * Math.log(y);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2e+31: tmp = -t elif t <= 1.22e+23: tmp = x * math.log(y) else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2e+31) tmp = Float64(-t); elseif (t <= 1.22e+23) tmp = Float64(x * log(y)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2e+31) tmp = -t; elseif (t <= 1.22e+23) tmp = x * log(y); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2e+31], (-t), If[LessEqual[t, 1.22e+23], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{+31}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 1.22 \cdot 10^{+23}:\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -1.9999999999999999e31 or 1.22e23 < t Initial program 97.4%
Taylor expanded in t around inf 80.4%
mul-1-neg80.4%
Simplified80.4%
if -1.9999999999999999e31 < t < 1.22e23Initial program 85.9%
Taylor expanded in z around inf 85.4%
*-commutative85.4%
sub-neg85.4%
mul-1-neg85.4%
log1p-def99.2%
mul-1-neg99.2%
Simplified99.2%
Taylor expanded in x around inf 53.1%
Final simplification65.6%
(FPCore (x y z t) :precision binary64 (- (* (+ x -1.0) (log y)) t))
double code(double x, double y, double z, double t) {
return ((x + -1.0) * log(y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + (-1.0d0)) * log(y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x + -1.0) * Math.log(y)) - t;
}
def code(x, y, z, t): return ((x + -1.0) * math.log(y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(x + -1.0) * log(y)) - t) end
function tmp = code(x, y, z, t) tmp = ((x + -1.0) * log(y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x + -1\right) \cdot \log y - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 89.2%
Final simplification89.2%
(FPCore (x y z t) :precision binary64 (if (<= t -44.0) (- t) (if (<= t 370000.0) (* z (- (* y (* y -0.5)) y)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -44.0) {
tmp = -t;
} else if (t <= 370000.0) {
tmp = z * ((y * (y * -0.5)) - y);
} else {
tmp = -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-44.0d0)) then
tmp = -t
else if (t <= 370000.0d0) then
tmp = z * ((y * (y * (-0.5d0))) - y)
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -44.0) {
tmp = -t;
} else if (t <= 370000.0) {
tmp = z * ((y * (y * -0.5)) - y);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -44.0: tmp = -t elif t <= 370000.0: tmp = z * ((y * (y * -0.5)) - y) else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -44.0) tmp = Float64(-t); elseif (t <= 370000.0) tmp = Float64(z * Float64(Float64(y * Float64(y * -0.5)) - y)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -44.0) tmp = -t; elseif (t <= 370000.0) tmp = z * ((y * (y * -0.5)) - y); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -44.0], (-t), If[LessEqual[t, 370000.0], N[(z * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -44:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 370000:\\
\;\;\;\;z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -44 or 3.7e5 < t Initial program 96.9%
Taylor expanded in t around inf 74.7%
mul-1-neg74.7%
Simplified74.7%
if -44 < t < 3.7e5Initial program 85.2%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
unsub-neg99.2%
associate-*r*99.2%
*-commutative99.2%
unpow299.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
distribute-lft-in99.2%
metadata-eval99.2%
*-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in z around inf 17.2%
*-commutative17.2%
*-commutative17.2%
unpow217.2%
associate-*l*17.2%
Simplified17.2%
Final simplification46.4%
(FPCore (x y z t) :precision binary64 (if (<= t -80.0) (- t) (if (<= t 320000.0) (* y (- z)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -80.0) {
tmp = -t;
} else if (t <= 320000.0) {
tmp = y * -z;
} else {
tmp = -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-80.0d0)) then
tmp = -t
else if (t <= 320000.0d0) then
tmp = y * -z
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -80.0) {
tmp = -t;
} else if (t <= 320000.0) {
tmp = y * -z;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -80.0: tmp = -t elif t <= 320000.0: tmp = y * -z else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -80.0) tmp = Float64(-t); elseif (t <= 320000.0) tmp = Float64(y * Float64(-z)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -80.0) tmp = -t; elseif (t <= 320000.0) tmp = y * -z; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -80.0], (-t), If[LessEqual[t, 320000.0], N[(y * (-z)), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -80:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 320000:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -80 or 3.2e5 < t Initial program 96.9%
Taylor expanded in t around inf 74.7%
mul-1-neg74.7%
Simplified74.7%
if -80 < t < 3.2e5Initial program 85.2%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
unsub-neg99.2%
associate-*r*99.2%
*-commutative99.2%
unpow299.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
distribute-lft-in99.2%
metadata-eval99.2%
*-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in z around 0 98.5%
*-commutative98.5%
unpow298.5%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in z around inf 16.5%
associate-*r*16.5%
mul-1-neg16.5%
Simplified16.5%
Final simplification46.0%
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
return -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t
end function
public static double code(double x, double y, double z, double t) {
return -t;
}
def code(x, y, z, t): return -t
function code(x, y, z, t) return Float64(-t) end
function tmp = code(x, y, z, t) tmp = -t; end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 91.1%
Taylor expanded in t around inf 39.3%
mul-1-neg39.3%
Simplified39.3%
Final simplification39.3%
herbie shell --seed 2023279
(FPCore (x y z t)
:name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"
:precision binary64
(- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))