
(FPCore (x y z t) :precision binary64 (- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (z * 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 * log(y)) + (z * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (z * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (z * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(z * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (z * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (z * 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 * log(y)) + (z * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (z * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (z * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(z * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (z * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (- (fma z (log1p (- y)) (* x (log y))) t))
double code(double x, double y, double z, double t) {
return fma(z, log1p(-y), (x * log(y))) - t;
}
function code(x, y, z, t) return Float64(fma(z, log1p(Float64(-y)), Float64(x * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(z * N[Log[1 + (-y)], $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), x \cdot \log y\right) - t
\end{array}
Initial program 86.9%
+-commutative86.9%
fma-def86.9%
sub-neg86.9%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (fma -0.5 (* z (* y y)) (* z (- y))) (* x (log y))) t))
double code(double x, double y, double z, double t) {
return (fma(-0.5, (z * (y * y)), (z * -y)) + (x * log(y))) - t;
}
function code(x, y, z, t) return Float64(Float64(fma(-0.5, Float64(z * Float64(y * y)), Float64(z * Float64(-y))) + Float64(x * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-0.5 * N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(z * (-y)), $MachinePrecision]), $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(-0.5, z \cdot \left(y \cdot y\right), z \cdot \left(-y\right)\right) + x \cdot \log y\right) - t
\end{array}
Initial program 86.9%
Taylor expanded in y around 0 99.2%
fma-def99.2%
unpow299.2%
associate-*r*99.2%
mul-1-neg99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -2.2e+121)
t_1
(if (<= x -7.2e+62)
(- (* z (- (* y (* y -0.5)) y)) t)
(if (or (<= x -4.2e+26) (not (<= x 9e+96)))
t_1
(- (* -0.5 (* y (* z y))) (+ t (* z y))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -2.2e+121) {
tmp = t_1;
} else if (x <= -7.2e+62) {
tmp = (z * ((y * (y * -0.5)) - y)) - t;
} else if ((x <= -4.2e+26) || !(x <= 9e+96)) {
tmp = t_1;
} else {
tmp = (-0.5 * (y * (z * y))) - (t + (z * 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) :: t_1
real(8) :: tmp
t_1 = x * log(y)
if (x <= (-2.2d+121)) then
tmp = t_1
else if (x <= (-7.2d+62)) then
tmp = (z * ((y * (y * (-0.5d0))) - y)) - t
else if ((x <= (-4.2d+26)) .or. (.not. (x <= 9d+96))) then
tmp = t_1
else
tmp = ((-0.5d0) * (y * (z * y))) - (t + (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * Math.log(y);
double tmp;
if (x <= -2.2e+121) {
tmp = t_1;
} else if (x <= -7.2e+62) {
tmp = (z * ((y * (y * -0.5)) - y)) - t;
} else if ((x <= -4.2e+26) || !(x <= 9e+96)) {
tmp = t_1;
} else {
tmp = (-0.5 * (y * (z * y))) - (t + (z * y));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -2.2e+121: tmp = t_1 elif x <= -7.2e+62: tmp = (z * ((y * (y * -0.5)) - y)) - t elif (x <= -4.2e+26) or not (x <= 9e+96): tmp = t_1 else: tmp = (-0.5 * (y * (z * y))) - (t + (z * y)) return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -2.2e+121) tmp = t_1; elseif (x <= -7.2e+62) tmp = Float64(Float64(z * Float64(Float64(y * Float64(y * -0.5)) - y)) - t); elseif ((x <= -4.2e+26) || !(x <= 9e+96)) tmp = t_1; else tmp = Float64(Float64(-0.5 * Float64(y * Float64(z * y))) - Float64(t + Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (x <= -2.2e+121) tmp = t_1; elseif (x <= -7.2e+62) tmp = (z * ((y * (y * -0.5)) - y)) - t; elseif ((x <= -4.2e+26) || ~((x <= 9e+96))) tmp = t_1; else tmp = (-0.5 * (y * (z * y))) - (t + (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.2e+121], t$95$1, If[LessEqual[x, -7.2e+62], N[(N[(z * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[Or[LessEqual[x, -4.2e+26], N[Not[LessEqual[x, 9e+96]], $MachinePrecision]], t$95$1, N[(N[(-0.5 * N[(y * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{+121}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -7.2 \cdot 10^{+62}:\\
\;\;\;\;z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{+26} \lor \neg \left(x \leq 9 \cdot 10^{+96}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(y \cdot \left(z \cdot y\right)\right) - \left(t + z \cdot y\right)\\
\end{array}
\end{array}
if x < -2.20000000000000001e121 or -7.2e62 < x < -4.2000000000000002e26 or 8.99999999999999914e96 < x Initial program 98.5%
+-commutative98.5%
fma-def98.5%
sub-neg98.5%
log1p-def99.7%
Simplified99.7%
Taylor expanded in z around 0 97.5%
fma-neg97.5%
Simplified97.5%
Taylor expanded in x around inf 82.2%
if -2.20000000000000001e121 < x < -7.2e62Initial program 64.5%
+-commutative64.5%
fma-def64.5%
sub-neg64.5%
log1p-def99.7%
Simplified99.7%
Taylor expanded in x around 0 37.1%
fma-neg37.1%
sub-neg37.1%
mul-1-neg37.1%
log1p-def69.9%
mul-1-neg69.9%
Simplified69.9%
Taylor expanded in y around 0 69.9%
mul-1-neg69.9%
+-commutative69.9%
associate-+r+69.9%
associate-*r*69.9%
associate-*r*69.9%
distribute-rgt-out69.9%
mul-1-neg69.9%
unsub-neg69.9%
*-commutative69.9%
unpow269.9%
associate-*l*69.9%
Simplified69.9%
if -4.2000000000000002e26 < x < 8.99999999999999914e96Initial program 81.7%
+-commutative81.7%
fma-def81.7%
sub-neg81.7%
log1p-def99.9%
Simplified99.9%
Taylor expanded in x around 0 65.7%
fma-neg65.7%
sub-neg65.7%
mul-1-neg65.7%
log1p-def83.4%
mul-1-neg83.4%
Simplified83.4%
Taylor expanded in y around 0 82.8%
expm1-log1p-u75.8%
expm1-udef75.6%
unpow275.6%
associate-*l*75.6%
Applied egg-rr75.6%
expm1-def75.8%
expm1-log1p82.8%
Simplified82.8%
Final simplification82.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.12e-162) (not (<= x 6e-34))) (- (* x (log y)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.12e-162) || !(x <= 6e-34)) {
tmp = (x * log(y)) - t;
} else {
tmp = (z * log1p(-y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.12e-162) || !(x <= 6e-34)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.12e-162) or not (x <= 6e-34): tmp = (x * math.log(y)) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.12e-162) || !(x <= 6e-34)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.12e-162], N[Not[LessEqual[x, 6e-34]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.12 \cdot 10^{-162} \lor \neg \left(x \leq 6 \cdot 10^{-34}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if x < -1.12e-162 or 6e-34 < x Initial program 90.9%
+-commutative90.9%
fma-def90.9%
sub-neg90.9%
log1p-def99.7%
Simplified99.7%
Taylor expanded in z around 0 89.2%
if -1.12e-162 < x < 6e-34Initial program 79.6%
Taylor expanded in x around 0 73.4%
sub-neg73.4%
mul-1-neg73.4%
log1p-def93.8%
mul-1-neg93.8%
Simplified93.8%
Final simplification90.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7e-164) (not (<= x 6e-34))) (- (* x (log y)) t) (- (* -0.5 (* y (* z y))) (+ t (* z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7e-164) || !(x <= 6e-34)) {
tmp = (x * log(y)) - t;
} else {
tmp = (-0.5 * (y * (z * y))) - (t + (z * 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 <= (-7d-164)) .or. (.not. (x <= 6d-34))) then
tmp = (x * log(y)) - t
else
tmp = ((-0.5d0) * (y * (z * y))) - (t + (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7e-164) || !(x <= 6e-34)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (-0.5 * (y * (z * y))) - (t + (z * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7e-164) or not (x <= 6e-34): tmp = (x * math.log(y)) - t else: tmp = (-0.5 * (y * (z * y))) - (t + (z * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7e-164) || !(x <= 6e-34)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(-0.5 * Float64(y * Float64(z * y))) - Float64(t + Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7e-164) || ~((x <= 6e-34))) tmp = (x * log(y)) - t; else tmp = (-0.5 * (y * (z * y))) - (t + (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7e-164], N[Not[LessEqual[x, 6e-34]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(-0.5 * N[(y * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-164} \lor \neg \left(x \leq 6 \cdot 10^{-34}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(y \cdot \left(z \cdot y\right)\right) - \left(t + z \cdot y\right)\\
\end{array}
\end{array}
if x < -6.9999999999999999e-164 or 6e-34 < x Initial program 90.9%
+-commutative90.9%
fma-def90.9%
sub-neg90.9%
log1p-def99.7%
Simplified99.7%
Taylor expanded in z around 0 89.2%
if -6.9999999999999999e-164 < x < 6e-34Initial program 79.6%
+-commutative79.6%
fma-def79.6%
sub-neg79.6%
log1p-def99.9%
Simplified99.9%
Taylor expanded in x around 0 73.4%
fma-neg73.4%
sub-neg73.4%
mul-1-neg73.4%
log1p-def93.8%
mul-1-neg93.8%
Simplified93.8%
Taylor expanded in y around 0 93.3%
expm1-log1p-u85.7%
expm1-udef85.5%
unpow285.5%
associate-*l*85.5%
Applied egg-rr85.5%
expm1-def85.7%
expm1-log1p93.3%
Simplified93.3%
Final simplification90.7%
(FPCore (x y z t) :precision binary64 (- (- (* x (log y)) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) - (z * 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 * log(y)) - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) - (z * y)) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y - z \cdot y\right) - t
\end{array}
Initial program 86.9%
Taylor expanded in y around 0 98.6%
+-commutative98.6%
*-commutative98.6%
log-pow46.2%
mul-1-neg46.2%
unsub-neg46.2%
log-pow98.6%
*-commutative98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (- (* -0.5 (* y (* z y))) (+ t (* z y))))
double code(double x, double y, double z, double t) {
return (-0.5 * (y * (z * y))) - (t + (z * y));
}
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 = ((-0.5d0) * (y * (z * y))) - (t + (z * y))
end function
public static double code(double x, double y, double z, double t) {
return (-0.5 * (y * (z * y))) - (t + (z * y));
}
def code(x, y, z, t): return (-0.5 * (y * (z * y))) - (t + (z * y))
function code(x, y, z, t) return Float64(Float64(-0.5 * Float64(y * Float64(z * y))) - Float64(t + Float64(z * y))) end
function tmp = code(x, y, z, t) tmp = (-0.5 * (y * (z * y))) - (t + (z * y)); end
code[x_, y_, z_, t_] := N[(N[(-0.5 * N[(y * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \left(y \cdot \left(z \cdot y\right)\right) - \left(t + z \cdot y\right)
\end{array}
Initial program 86.9%
+-commutative86.9%
fma-def86.9%
sub-neg86.9%
log1p-def99.8%
Simplified99.8%
Taylor expanded in x around 0 46.8%
fma-neg46.8%
sub-neg46.8%
mul-1-neg46.8%
log1p-def59.4%
mul-1-neg59.4%
Simplified59.4%
Taylor expanded in y around 0 58.8%
expm1-log1p-u51.8%
expm1-udef51.7%
unpow251.7%
associate-*l*51.7%
Applied egg-rr51.7%
expm1-def51.8%
expm1-log1p58.8%
Simplified58.8%
Final simplification58.8%
(FPCore (x y z t) :precision binary64 (- (* z (- (* y (* y -0.5)) y)) t))
double code(double x, double y, double z, double t) {
return (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 = (z * ((y * (y * (-0.5d0))) - y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * ((y * (y * -0.5)) - y)) - t;
}
def code(x, y, z, t): return (z * ((y * (y * -0.5)) - y)) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(Float64(y * Float64(y * -0.5)) - y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * ((y * (y * -0.5)) - y)) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t
\end{array}
Initial program 86.9%
+-commutative86.9%
fma-def86.9%
sub-neg86.9%
log1p-def99.8%
Simplified99.8%
Taylor expanded in x around 0 46.8%
fma-neg46.8%
sub-neg46.8%
mul-1-neg46.8%
log1p-def59.4%
mul-1-neg59.4%
Simplified59.4%
Taylor expanded in y around 0 58.8%
mul-1-neg58.8%
+-commutative58.8%
associate-+r+58.8%
associate-*r*58.8%
associate-*r*58.8%
distribute-rgt-out58.8%
mul-1-neg58.8%
unsub-neg58.8%
*-commutative58.8%
unpow258.8%
associate-*l*58.8%
Simplified58.8%
Final simplification58.8%
(FPCore (x y z t) :precision binary64 (- (* z (- y)) t))
double code(double x, double y, double z, double t) {
return (z * -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 = (z * -y) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * -y) - t;
}
def code(x, y, z, t): return (z * -y) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(-y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * -y) - t; end
code[x_, y_, z_, t_] := N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(-y\right) - t
\end{array}
Initial program 86.9%
+-commutative86.9%
fma-def86.9%
sub-neg86.9%
log1p-def99.8%
Simplified99.8%
Taylor expanded in x around 0 46.8%
fma-neg46.8%
sub-neg46.8%
mul-1-neg46.8%
log1p-def59.4%
mul-1-neg59.4%
Simplified59.4%
Taylor expanded in y around 0 58.2%
mul-1-neg58.2%
+-commutative58.2%
unsub-neg58.2%
mul-1-neg58.2%
distribute-rgt-neg-in58.2%
Simplified58.2%
Final simplification58.2%
(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 86.9%
+-commutative86.9%
fma-def86.9%
sub-neg86.9%
log1p-def99.8%
Simplified99.8%
Taylor expanded in t around inf 44.8%
mul-1-neg44.8%
Simplified44.8%
Final simplification44.8%
(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 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 86.9%
+-commutative86.9%
fma-def86.9%
sub-neg86.9%
log1p-def99.8%
Simplified99.8%
Taylor expanded in z around 0 84.9%
fma-neg84.9%
Simplified84.9%
add-exp-log42.7%
add-sqr-sqrt34.1%
sqrt-unprod34.2%
sqr-neg34.2%
sqrt-unprod8.4%
add-sqr-sqrt21.4%
Applied egg-rr21.4%
Taylor expanded in x around 0 2.2%
Final simplification2.2%
(FPCore (x y z t)
:precision binary64
(-
(*
(- z)
(+
(+ (* 0.5 (* y y)) y)
(* (/ 0.3333333333333333 (* 1.0 (* 1.0 1.0))) (* y (* y y)))))
(- t (* x (log y)))))
double code(double x, double y, double z, double t) {
return (-z * (((0.5 * (y * y)) + y) + ((0.3333333333333333 / (1.0 * (1.0 * 1.0))) * (y * (y * y))))) - (t - (x * log(y)));
}
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 = (-z * (((0.5d0 * (y * y)) + y) + ((0.3333333333333333d0 / (1.0d0 * (1.0d0 * 1.0d0))) * (y * (y * y))))) - (t - (x * log(y)))
end function
public static double code(double x, double y, double z, double t) {
return (-z * (((0.5 * (y * y)) + y) + ((0.3333333333333333 / (1.0 * (1.0 * 1.0))) * (y * (y * y))))) - (t - (x * Math.log(y)));
}
def code(x, y, z, t): return (-z * (((0.5 * (y * y)) + y) + ((0.3333333333333333 / (1.0 * (1.0 * 1.0))) * (y * (y * y))))) - (t - (x * math.log(y)))
function code(x, y, z, t) return Float64(Float64(Float64(-z) * Float64(Float64(Float64(0.5 * Float64(y * y)) + y) + Float64(Float64(0.3333333333333333 / Float64(1.0 * Float64(1.0 * 1.0))) * Float64(y * Float64(y * y))))) - Float64(t - Float64(x * log(y)))) end
function tmp = code(x, y, z, t) tmp = (-z * (((0.5 * (y * y)) + y) + ((0.3333333333333333 / (1.0 * (1.0 * 1.0))) * (y * (y * y))))) - (t - (x * log(y))); end
code[x_, y_, z_, t_] := N[(N[((-z) * N[(N[(N[(0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] + N[(N[(0.3333333333333333 / N[(1.0 * N[(1.0 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t - N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-z\right) \cdot \left(\left(0.5 \cdot \left(y \cdot y\right) + y\right) + \frac{0.3333333333333333}{1 \cdot \left(1 \cdot 1\right)} \cdot \left(y \cdot \left(y \cdot y\right)\right)\right) - \left(t - x \cdot \log y\right)
\end{array}
herbie shell --seed 2023257
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(- (* (- z) (+ (+ (* 0.5 (* y y)) y) (* (/ 0.3333333333333333 (* 1.0 (* 1.0 1.0))) (* y (* y y))))) (- t (* x (log y))))
(- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))