
(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 82.3%
+-commutative82.3%
associate--l+82.3%
fma-define82.3%
sub-neg82.3%
log1p-define99.9%
Simplified99.9%
(FPCore (x y z t) :precision binary64 (- (+ (* x (log y)) (* y (- (* y (+ (* z -0.5) (* -0.3333333333333333 (* z y)))) z))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (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 * ((y * ((z * (-0.5d0)) + ((-0.3333333333333333d0) * (z * y)))) - z))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (z * y)))) - z))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (z * y)))) - z))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(y * Float64(Float64(y * Float64(Float64(z * -0.5) + Float64(-0.3333333333333333 * Float64(z * y)))) - z))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (z * y)))) - z))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(y * N[(N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(-0.3333333333333333 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + y \cdot \left(y \cdot \left(z \cdot -0.5 + -0.3333333333333333 \cdot \left(z \cdot y\right)\right) - z\right)\right) - t
\end{array}
Initial program 82.3%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(if (<= z -7e+75)
(- (* z (log1p (- y))) t)
(if (<= z 4.7e+152)
(- (* x (log y)) t)
(- (* y (* z (+ -1.0 (* y -0.5)))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e+75) {
tmp = (z * log1p(-y)) - t;
} else if (z <= 4.7e+152) {
tmp = (x * log(y)) - t;
} else {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e+75) {
tmp = (z * Math.log1p(-y)) - t;
} else if (z <= 4.7e+152) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7e+75: tmp = (z * math.log1p(-y)) - t elif z <= 4.7e+152: tmp = (x * math.log(y)) - t else: tmp = (y * (z * (-1.0 + (y * -0.5)))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7e+75) tmp = Float64(Float64(z * log1p(Float64(-y))) - t); elseif (z <= 4.7e+152) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5)))) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -7e+75], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[z, 4.7e+152], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+75}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+152}:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\
\end{array}
\end{array}
if z < -6.9999999999999997e75Initial program 46.2%
Taylor expanded in x around 0 35.5%
sub-neg35.5%
log1p-define89.7%
Simplified89.7%
if -6.9999999999999997e75 < z < 4.70000000000000024e152Initial program 96.1%
add-cube-cbrt95.3%
pow395.3%
Applied egg-rr95.3%
Taylor expanded in y around 0 95.7%
if 4.70000000000000024e152 < z Initial program 44.4%
Taylor expanded in x around 0 31.6%
sub-neg31.6%
log1p-define87.2%
Simplified87.2%
Taylor expanded in y around 0 87.2%
Taylor expanded in z around 0 87.2%
Taylor expanded in y around 0 87.2%
associate-*r*87.2%
distribute-rgt-out87.2%
*-commutative87.2%
Simplified87.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -7e+75)
(- (* y (- (* y (* z (- (* y -0.3333333333333333) 0.5))) z)) t)
(if (<= z 3.6e+153)
(- (* x (log y)) t)
(- (* y (* z (+ -1.0 (* y -0.5)))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e+75) {
tmp = (y * ((y * (z * ((y * -0.3333333333333333) - 0.5))) - z)) - t;
} else if (z <= 3.6e+153) {
tmp = (x * log(y)) - t;
} else {
tmp = (y * (z * (-1.0 + (y * -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 (z <= (-7d+75)) then
tmp = (y * ((y * (z * ((y * (-0.3333333333333333d0)) - 0.5d0))) - z)) - t
else if (z <= 3.6d+153) then
tmp = (x * log(y)) - t
else
tmp = (y * (z * ((-1.0d0) + (y * (-0.5d0))))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e+75) {
tmp = (y * ((y * (z * ((y * -0.3333333333333333) - 0.5))) - z)) - t;
} else if (z <= 3.6e+153) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7e+75: tmp = (y * ((y * (z * ((y * -0.3333333333333333) - 0.5))) - z)) - t elif z <= 3.6e+153: tmp = (x * math.log(y)) - t else: tmp = (y * (z * (-1.0 + (y * -0.5)))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7e+75) tmp = Float64(Float64(y * Float64(Float64(y * Float64(z * Float64(Float64(y * -0.3333333333333333) - 0.5))) - z)) - t); elseif (z <= 3.6e+153) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7e+75) tmp = (y * ((y * (z * ((y * -0.3333333333333333) - 0.5))) - z)) - t; elseif (z <= 3.6e+153) tmp = (x * log(y)) - t; else tmp = (y * (z * (-1.0 + (y * -0.5)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7e+75], N[(N[(y * N[(N[(y * N[(z * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[z, 3.6e+153], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+75}:\\
\;\;\;\;y \cdot \left(y \cdot \left(z \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right) - z\right) - t\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+153}:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\
\end{array}
\end{array}
if z < -6.9999999999999997e75Initial program 46.2%
Taylor expanded in x around 0 35.5%
sub-neg35.5%
log1p-define89.7%
Simplified89.7%
Taylor expanded in y around 0 89.7%
Taylor expanded in z around 0 89.7%
pow189.7%
mul-1-neg89.7%
Applied egg-rr89.7%
unpow189.7%
Simplified89.7%
if -6.9999999999999997e75 < z < 3.6000000000000001e153Initial program 96.1%
add-cube-cbrt95.3%
pow395.3%
Applied egg-rr95.3%
Taylor expanded in y around 0 95.7%
if 3.6000000000000001e153 < z Initial program 44.4%
Taylor expanded in x around 0 31.6%
sub-neg31.6%
log1p-define87.2%
Simplified87.2%
Taylor expanded in y around 0 87.2%
Taylor expanded in z around 0 87.2%
Taylor expanded in y around 0 87.2%
associate-*r*87.2%
distribute-rgt-out87.2%
*-commutative87.2%
Simplified87.2%
Final simplification93.8%
(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 82.3%
Taylor expanded in y around 0 99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.15e+110) (not (<= x 7.6e+117))) (* x (log y)) (- (* y (- (* y (* z (- (* y -0.3333333333333333) 0.5))) z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.15e+110) || !(x <= 7.6e+117)) {
tmp = x * log(y);
} else {
tmp = (y * ((y * (z * ((y * -0.3333333333333333) - 0.5))) - z)) - 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 <= (-1.15d+110)) .or. (.not. (x <= 7.6d+117))) then
tmp = x * log(y)
else
tmp = (y * ((y * (z * ((y * (-0.3333333333333333d0)) - 0.5d0))) - z)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.15e+110) || !(x <= 7.6e+117)) {
tmp = x * Math.log(y);
} else {
tmp = (y * ((y * (z * ((y * -0.3333333333333333) - 0.5))) - z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.15e+110) or not (x <= 7.6e+117): tmp = x * math.log(y) else: tmp = (y * ((y * (z * ((y * -0.3333333333333333) - 0.5))) - z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.15e+110) || !(x <= 7.6e+117)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(y * Float64(Float64(y * Float64(z * Float64(Float64(y * -0.3333333333333333) - 0.5))) - z)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.15e+110) || ~((x <= 7.6e+117))) tmp = x * log(y); else tmp = (y * ((y * (z * ((y * -0.3333333333333333) - 0.5))) - z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.15e+110], N[Not[LessEqual[x, 7.6e+117]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(N[(y * N[(z * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+110} \lor \neg \left(x \leq 7.6 \cdot 10^{+117}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot \left(z \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right) - z\right) - t\\
\end{array}
\end{array}
if x < -1.15e110 or 7.6000000000000003e117 < x Initial program 98.6%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in x around inf 83.4%
if -1.15e110 < x < 7.6000000000000003e117Initial program 76.0%
Taylor expanded in x around 0 56.1%
sub-neg56.1%
log1p-define80.0%
Simplified80.0%
Taylor expanded in y around 0 80.0%
Taylor expanded in z around 0 80.0%
pow180.0%
mul-1-neg80.0%
Applied egg-rr80.0%
unpow180.0%
Simplified80.0%
Final simplification80.9%
(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 82.3%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
mul-1-neg99.2%
unsub-neg99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (- (* y (- (* y (* z (- (* y -0.3333333333333333) 0.5))) z)) t))
double code(double x, double y, double z, double t) {
return (y * ((y * (z * ((y * -0.3333333333333333) - 0.5))) - 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 = (y * ((y * (z * ((y * (-0.3333333333333333d0)) - 0.5d0))) - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * ((y * (z * ((y * -0.3333333333333333) - 0.5))) - z)) - t;
}
def code(x, y, z, t): return (y * ((y * (z * ((y * -0.3333333333333333) - 0.5))) - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(Float64(y * Float64(z * Float64(Float64(y * -0.3333333333333333) - 0.5))) - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * ((y * (z * ((y * -0.3333333333333333) - 0.5))) - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[(y * N[(z * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(y \cdot \left(z \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right) - z\right) - t
\end{array}
Initial program 82.3%
Taylor expanded in x around 0 45.0%
sub-neg45.0%
log1p-define62.6%
Simplified62.6%
Taylor expanded in y around 0 62.6%
Taylor expanded in z around 0 62.6%
pow162.6%
mul-1-neg62.6%
Applied egg-rr62.6%
unpow162.6%
Simplified62.6%
Final simplification62.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.5e-134) (not (<= t 1.5e-33))) (- t) (* y (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e-134) || !(t <= 1.5e-33)) {
tmp = -t;
} else {
tmp = y * -z;
}
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 <= (-2.5d-134)) .or. (.not. (t <= 1.5d-33))) then
tmp = -t
else
tmp = y * -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e-134) || !(t <= 1.5e-33)) {
tmp = -t;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.5e-134) or not (t <= 1.5e-33): tmp = -t else: tmp = y * -z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.5e-134) || !(t <= 1.5e-33)) tmp = Float64(-t); else tmp = Float64(y * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.5e-134) || ~((t <= 1.5e-33))) tmp = -t; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.5e-134], N[Not[LessEqual[t, 1.5e-33]], $MachinePrecision]], (-t), N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-134} \lor \neg \left(t \leq 1.5 \cdot 10^{-33}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if t < -2.5000000000000002e-134 or 1.5000000000000001e-33 < t Initial program 88.8%
Taylor expanded in x around 0 62.4%
sub-neg62.4%
log1p-define73.5%
Simplified73.5%
Taylor expanded in z around 0 61.6%
neg-mul-161.6%
Simplified61.6%
if -2.5000000000000002e-134 < t < 1.5000000000000001e-33Initial program 69.0%
Taylor expanded in y around 0 98.6%
+-commutative98.6%
mul-1-neg98.6%
unsub-neg98.6%
Simplified98.6%
Taylor expanded in y around inf 34.6%
neg-mul-134.6%
distribute-rgt-neg-in34.6%
Simplified34.6%
Final simplification52.6%
(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 82.3%
Taylor expanded in x around 0 45.0%
sub-neg45.0%
log1p-define62.6%
Simplified62.6%
Taylor expanded in y around 0 62.6%
Taylor expanded in z around 0 62.6%
Taylor expanded in y around 0 62.4%
associate-*r*62.4%
distribute-rgt-out62.4%
*-commutative62.4%
Simplified62.4%
(FPCore (x y z t) :precision binary64 (- (* y (- z)) t))
double code(double x, double y, double z, double t) {
return (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 = (y * -z) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * -z) - t;
}
def code(x, y, z, t): return (y * -z) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(-z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * -z) - t; end
code[x_, y_, z_, t_] := N[(N[(y * (-z)), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(-z\right) - t
\end{array}
Initial program 82.3%
Taylor expanded in x around 0 45.0%
sub-neg45.0%
log1p-define62.6%
Simplified62.6%
Taylor expanded in y around 0 62.0%
associate-*r*62.0%
neg-mul-162.0%
*-commutative62.0%
Simplified62.0%
Final simplification62.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 82.3%
Taylor expanded in x around 0 45.0%
sub-neg45.0%
log1p-define62.6%
Simplified62.6%
Taylor expanded in z around 0 43.8%
neg-mul-143.8%
Simplified43.8%
(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 2024170
(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))