
(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 12 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 fma(z, log1p(Float64(-y)), Float64(Float64(x * log(y)) - t)) end
code[x_, y_, z_, t_] := N[(z * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), x \cdot \log y - t\right)
\end{array}
Initial program 83.8%
+-commutative83.8%
associate--l+83.8%
fma-define83.8%
sub-neg83.8%
log1p-define99.8%
Simplified99.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (log y)))) (if (or (<= t -4.1e-71) (not (<= t 7.8e-58))) (- t_1 t) (- t_1 (* z y)))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if ((t <= -4.1e-71) || !(t <= 7.8e-58)) {
tmp = t_1 - t;
} else {
tmp = t_1 - (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 ((t <= (-4.1d-71)) .or. (.not. (t <= 7.8d-58))) then
tmp = t_1 - t
else
tmp = t_1 - (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 ((t <= -4.1e-71) || !(t <= 7.8e-58)) {
tmp = t_1 - t;
} else {
tmp = t_1 - (z * y);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if (t <= -4.1e-71) or not (t <= 7.8e-58): tmp = t_1 - t else: tmp = t_1 - (z * y) return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if ((t <= -4.1e-71) || !(t <= 7.8e-58)) tmp = Float64(t_1 - t); else tmp = Float64(t_1 - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if ((t <= -4.1e-71) || ~((t <= 7.8e-58))) tmp = t_1 - t; else tmp = t_1 - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -4.1e-71], N[Not[LessEqual[t, 7.8e-58]], $MachinePrecision]], N[(t$95$1 - t), $MachinePrecision], N[(t$95$1 - N[(z * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;t \leq -4.1 \cdot 10^{-71} \lor \neg \left(t \leq 7.8 \cdot 10^{-58}\right):\\
\;\;\;\;t\_1 - t\\
\mathbf{else}:\\
\;\;\;\;t\_1 - z \cdot y\\
\end{array}
\end{array}
if t < -4.09999999999999993e-71 or 7.79999999999999985e-58 < t Initial program 95.0%
add-cbrt-cube63.1%
pow363.1%
Applied egg-rr63.1%
Taylor expanded in y around 0 94.4%
if -4.09999999999999993e-71 < t < 7.79999999999999985e-58Initial program 69.0%
add-cube-cbrt68.1%
pow368.1%
Applied egg-rr68.1%
Taylor expanded in y around 0 98.7%
associate-*r*98.7%
mul-1-neg98.7%
Simplified98.7%
Taylor expanded in t around 0 87.6%
+-commutative87.6%
associate-*r*87.6%
mul-1-neg87.6%
cancel-sign-sub-inv87.6%
Simplified87.6%
Final simplification91.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.3e-133) (not (<= x 3.4e-58))) (- (* x (log y)) t) (- (* y (* z (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5))))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.3e-133) || !(x <= 3.4e-58)) {
tmp = (x * log(y)) - t;
} else {
tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - 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 ((x <= (-2.3d-133)) .or. (.not. (x <= 3.4d-58))) then
tmp = (x * log(y)) - t
else
tmp = (y * (z * ((-1.0d0) + (y * ((y * (-0.3333333333333333d0)) - 0.5d0))))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.3e-133) || !(x <= 3.4e-58)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.3e-133) or not (x <= 3.4e-58): tmp = (x * math.log(y)) - t else: tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.3e-133) || !(x <= 3.4e-58)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5))))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.3e-133) || ~((x <= 3.4e-58))) tmp = (x * log(y)) - t; else tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.3e-133], N[Not[LessEqual[x, 3.4e-58]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y * N[(z * N[(-1.0 + N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-133} \lor \neg \left(x \leq 3.4 \cdot 10^{-58}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right) - t\\
\end{array}
\end{array}
if x < -2.3e-133 or 3.39999999999999973e-58 < x Initial program 91.1%
add-cbrt-cube43.0%
pow342.9%
Applied egg-rr42.9%
Taylor expanded in y around 0 90.7%
if -2.3e-133 < x < 3.39999999999999973e-58Initial program 71.9%
Taylor expanded in x around 0 62.0%
sub-neg62.0%
log1p-define90.2%
Simplified90.2%
Taylor expanded in y around 0 90.1%
Taylor expanded in z around 0 90.2%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (- (+ (* x (log y)) (* y (- (* -0.5 (* z y)) z))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (y * ((-0.5 * (z * 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 * log(y)) + (y * (((-0.5d0) * (z * y)) - z))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (y * ((-0.5 * (z * y)) - z))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (y * ((-0.5 * (z * y)) - z))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(y * Float64(Float64(-0.5 * Float64(z * y)) - z))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (y * ((-0.5 * (z * y)) - z))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(y * N[(N[(-0.5 * N[(z * y), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + y \cdot \left(-0.5 \cdot \left(z \cdot y\right) - z\right)\right) - t
\end{array}
Initial program 83.8%
Taylor expanded in y around 0 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.5e+170) (not (<= x 1.52e+77))) (* x (log y)) (- (* y (* z (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5))))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.5e+170) || !(x <= 1.52e+77)) {
tmp = x * log(y);
} else {
tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - 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 ((x <= (-6.5d+170)) .or. (.not. (x <= 1.52d+77))) then
tmp = x * log(y)
else
tmp = (y * (z * ((-1.0d0) + (y * ((y * (-0.3333333333333333d0)) - 0.5d0))))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.5e+170) || !(x <= 1.52e+77)) {
tmp = x * Math.log(y);
} else {
tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.5e+170) or not (x <= 1.52e+77): tmp = x * math.log(y) else: tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.5e+170) || !(x <= 1.52e+77)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5))))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -6.5e+170) || ~((x <= 1.52e+77))) tmp = x * log(y); else tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.5e+170], N[Not[LessEqual[x, 1.52e+77]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z * N[(-1.0 + N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+170} \lor \neg \left(x \leq 1.52 \cdot 10^{+77}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right) - t\\
\end{array}
\end{array}
if x < -6.5e170 or 1.5200000000000001e77 < x Initial program 96.6%
+-commutative96.6%
associate--l+96.6%
fma-define96.6%
sub-neg96.6%
log1p-define99.6%
Simplified99.6%
Taylor expanded in z around inf 60.8%
associate--l+60.8%
div-sub61.5%
sub-neg61.5%
log1p-define64.5%
Simplified64.5%
Taylor expanded in y around 0 60.4%
div-sub61.1%
Simplified61.1%
Taylor expanded in x around inf 80.3%
if -6.5e170 < x < 1.5200000000000001e77Initial program 78.1%
Taylor expanded in x around 0 58.5%
sub-neg58.5%
log1p-define80.1%
Simplified80.1%
Taylor expanded in y around 0 80.1%
Taylor expanded in z around 0 80.1%
Final simplification80.2%
(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 83.8%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
mul-1-neg99.6%
unsub-neg99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (- (* y (* z (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5))))) t))
double code(double x, double y, double z, double t) {
return (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - 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 = (y * (z * ((-1.0d0) + (y * ((y * (-0.3333333333333333d0)) - 0.5d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t;
}
def code(x, y, z, t): return (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(z * N[(-1.0 + N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(z \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right) - t
\end{array}
Initial program 83.8%
Taylor expanded in x around 0 45.7%
sub-neg45.7%
log1p-define61.3%
Simplified61.3%
Taylor expanded in y around 0 61.3%
Taylor expanded in z around 0 61.3%
Final simplification61.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.26e-70) (not (<= t 1.45e-59))) (- t) (* z (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.26e-70) || !(t <= 1.45e-59)) {
tmp = -t;
} else {
tmp = 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 ((t <= (-1.26d-70)) .or. (.not. (t <= 1.45d-59))) then
tmp = -t
else
tmp = z * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.26e-70) || !(t <= 1.45e-59)) {
tmp = -t;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.26e-70) or not (t <= 1.45e-59): tmp = -t else: tmp = z * -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.26e-70) || !(t <= 1.45e-59)) tmp = Float64(-t); else tmp = Float64(z * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.26e-70) || ~((t <= 1.45e-59))) tmp = -t; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.26e-70], N[Not[LessEqual[t, 1.45e-59]], $MachinePrecision]], (-t), N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.26 \cdot 10^{-70} \lor \neg \left(t \leq 1.45 \cdot 10^{-59}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -1.2600000000000001e-70 or 1.45000000000000008e-59 < t Initial program 95.0%
Taylor expanded in x around 0 69.4%
sub-neg69.4%
log1p-define73.4%
Simplified73.4%
Taylor expanded in z around 0 68.7%
neg-mul-168.7%
Simplified68.7%
if -1.2600000000000001e-70 < t < 1.45000000000000008e-59Initial program 69.0%
+-commutative69.0%
associate--l+69.0%
fma-define69.0%
sub-neg69.0%
log1p-define99.8%
Simplified99.8%
Taylor expanded in z around inf 58.0%
associate--l+58.0%
div-sub58.0%
sub-neg58.0%
log1p-define88.8%
Simplified88.8%
Taylor expanded in z around inf 3.9%
sub-neg3.9%
mul-1-neg3.9%
log1p-define34.3%
mul-1-neg34.3%
Simplified34.3%
Taylor expanded in y around 0 34.1%
associate-*r*45.1%
mul-1-neg45.1%
Simplified34.1%
Final simplification53.8%
(FPCore (x y z t) :precision binary64 (- (* y (* z (+ -1.0 (* y -0.5)))) t))
double code(double x, double y, double z, double t) {
return (y * (z * (-1.0 + (y * -0.5)))) - 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 = (y * (z * ((-1.0d0) + (y * (-0.5d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (z * (-1.0 + (y * -0.5)))) - t;
}
def code(x, y, z, t): return (y * (z * (-1.0 + (y * -0.5)))) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5)))) - t) end
function tmp = code(x, y, z, t) tmp = (y * (z * (-1.0 + (y * -0.5)))) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t
\end{array}
Initial program 83.8%
Taylor expanded in x around 0 45.7%
sub-neg45.7%
log1p-define61.3%
Simplified61.3%
Taylor expanded in y around 0 61.3%
Taylor expanded in y around 0 61.3%
associate-*r*61.3%
distribute-rgt-out61.3%
*-commutative61.3%
Simplified61.3%
(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 83.8%
Taylor expanded in x around 0 45.7%
sub-neg45.7%
log1p-define61.3%
Simplified61.3%
Taylor expanded in y around 0 61.1%
associate-*r*61.1%
mul-1-neg61.1%
Simplified61.1%
Final simplification61.1%
(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 83.8%
Taylor expanded in x around 0 45.7%
sub-neg45.7%
log1p-define61.3%
Simplified61.3%
Taylor expanded in z around 0 45.0%
neg-mul-145.0%
Simplified45.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 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 83.8%
Taylor expanded in x around 0 45.7%
sub-neg45.7%
log1p-define61.3%
Simplified61.3%
Taylor expanded in z around 0 45.0%
neg-mul-145.0%
Simplified45.0%
neg-sub045.0%
sub-neg45.0%
add-sqr-sqrt22.1%
sqrt-unprod10.9%
sqr-neg10.9%
sqrt-unprod1.1%
add-sqr-sqrt2.2%
Applied egg-rr2.2%
+-lft-identity2.2%
Simplified2.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 2024163
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"
:precision binary64
:alt
(! :herbie-platform default (- (* (- z) (+ (+ (* 1/2 (* y y)) y) (* (/ 1/3 (* 1 (* 1 1))) (* y (* y y))))) (- t (* x (log y)))))
(- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))