
(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 14 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.6%
+-commutative83.6%
associate--l+83.6%
fma-define83.6%
sub-neg83.6%
log1p-define99.8%
Simplified99.8%
(FPCore (x y z t) :precision binary64 (fma (- y) z (- (* x (log y)) t)))
double code(double x, double y, double z, double t) {
return fma(-y, z, ((x * log(y)) - t));
}
function code(x, y, z, t) return fma(Float64(-y), z, Float64(Float64(x * log(y)) - t)) end
code[x_, y_, z_, t_] := N[((-y) * z + N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-y, z, x \cdot \log y - t\right)
\end{array}
Initial program 83.6%
+-commutative83.6%
associate--l+83.6%
fma-define83.6%
sub-neg83.6%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 98.8%
associate--l+98.8%
associate-*r*98.8%
mul-1-neg98.8%
fma-define98.8%
Simplified98.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (log y)))) (if (or (<= t -9.5e-84) (not (<= t 3.2e-123))) (- 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 <= -9.5e-84) || !(t <= 3.2e-123)) {
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 <= (-9.5d-84)) .or. (.not. (t <= 3.2d-123))) 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 <= -9.5e-84) || !(t <= 3.2e-123)) {
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 <= -9.5e-84) or not (t <= 3.2e-123): 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 <= -9.5e-84) || !(t <= 3.2e-123)) 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 <= -9.5e-84) || ~((t <= 3.2e-123))) 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, -9.5e-84], N[Not[LessEqual[t, 3.2e-123]], $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 -9.5 \cdot 10^{-84} \lor \neg \left(t \leq 3.2 \cdot 10^{-123}\right):\\
\;\;\;\;t\_1 - t\\
\mathbf{else}:\\
\;\;\;\;t\_1 - z \cdot y\\
\end{array}
\end{array}
if t < -9.49999999999999941e-84 or 3.19999999999999979e-123 < t Initial program 92.7%
+-commutative92.7%
associate--l+92.7%
fma-define92.7%
sub-neg92.7%
log1p-define99.9%
Simplified99.9%
Taylor expanded in y around 0 98.9%
associate--l+98.9%
associate-*r*98.9%
mul-1-neg98.9%
fma-define98.9%
Simplified98.9%
Taylor expanded in y around 0 91.3%
if -9.49999999999999941e-84 < t < 3.19999999999999979e-123Initial program 66.5%
+-commutative66.5%
associate--l+66.5%
fma-define66.5%
sub-neg66.5%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 98.7%
associate--l+98.7%
associate-*r*98.7%
mul-1-neg98.7%
fma-define98.7%
Simplified98.7%
Taylor expanded in t around 0 91.0%
+-commutative91.0%
mul-1-neg91.0%
unsub-neg91.0%
Simplified91.0%
Final simplification91.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.6e-142) (not (<= x 3e-67))) (- (* x (log y)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.6e-142) || !(x <= 3e-67)) {
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 <= -3.6e-142) || !(x <= 3e-67)) {
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 <= -3.6e-142) or not (x <= 3e-67): 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 <= -3.6e-142) || !(x <= 3e-67)) 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, -3.6e-142], N[Not[LessEqual[x, 3e-67]], $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 -3.6 \cdot 10^{-142} \lor \neg \left(x \leq 3 \cdot 10^{-67}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if x < -3.6e-142 or 3.00000000000000032e-67 < x Initial program 89.2%
+-commutative89.2%
associate--l+89.2%
fma-define89.2%
sub-neg89.2%
log1p-define99.7%
Simplified99.7%
Taylor expanded in y around 0 99.0%
associate--l+99.0%
associate-*r*99.0%
mul-1-neg99.0%
fma-define99.0%
Simplified99.0%
Taylor expanded in y around 0 88.1%
if -3.6e-142 < x < 3.00000000000000032e-67Initial program 73.2%
Taylor expanded in x around 0 68.8%
sub-neg68.8%
log1p-define95.7%
Simplified95.7%
Final simplification90.8%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -2.9e-133) (not (<= x 1.2e-66)))
(- (* x (log y)) t)
(-
(*
y
(-
(*
y
(+ (* z -0.5) (* y (+ (* z -0.3333333333333333) (* (* z y) -0.25)))))
z))
t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.9e-133) || !(x <= 1.2e-66)) {
tmp = (x * log(y)) - t;
} else {
tmp = (y * ((y * ((z * -0.5) + (y * ((z * -0.3333333333333333) + ((z * y) * -0.25))))) - 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 <= (-2.9d-133)) .or. (.not. (x <= 1.2d-66))) then
tmp = (x * log(y)) - t
else
tmp = (y * ((y * ((z * (-0.5d0)) + (y * ((z * (-0.3333333333333333d0)) + ((z * y) * (-0.25d0)))))) - z)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.9e-133) || !(x <= 1.2e-66)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (y * ((y * ((z * -0.5) + (y * ((z * -0.3333333333333333) + ((z * y) * -0.25))))) - z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.9e-133) or not (x <= 1.2e-66): tmp = (x * math.log(y)) - t else: tmp = (y * ((y * ((z * -0.5) + (y * ((z * -0.3333333333333333) + ((z * y) * -0.25))))) - z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.9e-133) || !(x <= 1.2e-66)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(y * Float64(Float64(y * Float64(Float64(z * -0.5) + Float64(y * Float64(Float64(z * -0.3333333333333333) + Float64(Float64(z * y) * -0.25))))) - z)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.9e-133) || ~((x <= 1.2e-66))) tmp = (x * log(y)) - t; else tmp = (y * ((y * ((z * -0.5) + (y * ((z * -0.3333333333333333) + ((z * y) * -0.25))))) - z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.9e-133], N[Not[LessEqual[x, 1.2e-66]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y * N[(N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * N[(N[(z * -0.3333333333333333), $MachinePrecision] + N[(N[(z * y), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-133} \lor \neg \left(x \leq 1.2 \cdot 10^{-66}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot \left(z \cdot -0.5 + y \cdot \left(z \cdot -0.3333333333333333 + \left(z \cdot y\right) \cdot -0.25\right)\right) - z\right) - t\\
\end{array}
\end{array}
if x < -2.8999999999999998e-133 or 1.20000000000000013e-66 < x Initial program 89.2%
+-commutative89.2%
associate--l+89.2%
fma-define89.2%
sub-neg89.2%
log1p-define99.7%
Simplified99.7%
Taylor expanded in y around 0 99.0%
associate--l+99.0%
associate-*r*99.0%
mul-1-neg99.0%
fma-define99.0%
Simplified99.0%
Taylor expanded in y around 0 88.1%
if -2.8999999999999998e-133 < x < 1.20000000000000013e-66Initial program 73.2%
Taylor expanded in x around 0 68.8%
sub-neg68.8%
log1p-define95.7%
Simplified95.7%
Taylor expanded in y around 0 95.3%
Final simplification90.6%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -2.3e+157) (not (<= x 2.25e+138)))
(* x (log y))
(-
(*
y
(-
(*
y
(+ (* z -0.5) (* y (+ (* z -0.3333333333333333) (* (* z y) -0.25)))))
z))
t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.3e+157) || !(x <= 2.25e+138)) {
tmp = x * log(y);
} else {
tmp = (y * ((y * ((z * -0.5) + (y * ((z * -0.3333333333333333) + ((z * y) * -0.25))))) - 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 <= (-2.3d+157)) .or. (.not. (x <= 2.25d+138))) then
tmp = x * log(y)
else
tmp = (y * ((y * ((z * (-0.5d0)) + (y * ((z * (-0.3333333333333333d0)) + ((z * y) * (-0.25d0)))))) - z)) - 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+157) || !(x <= 2.25e+138)) {
tmp = x * Math.log(y);
} else {
tmp = (y * ((y * ((z * -0.5) + (y * ((z * -0.3333333333333333) + ((z * y) * -0.25))))) - z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.3e+157) or not (x <= 2.25e+138): tmp = x * math.log(y) else: tmp = (y * ((y * ((z * -0.5) + (y * ((z * -0.3333333333333333) + ((z * y) * -0.25))))) - z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.3e+157) || !(x <= 2.25e+138)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(y * Float64(Float64(y * Float64(Float64(z * -0.5) + Float64(y * Float64(Float64(z * -0.3333333333333333) + Float64(Float64(z * y) * -0.25))))) - z)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.3e+157) || ~((x <= 2.25e+138))) tmp = x * log(y); else tmp = (y * ((y * ((z * -0.5) + (y * ((z * -0.3333333333333333) + ((z * y) * -0.25))))) - z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.3e+157], N[Not[LessEqual[x, 2.25e+138]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * N[(N[(z * -0.3333333333333333), $MachinePrecision] + N[(N[(z * y), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+157} \lor \neg \left(x \leq 2.25 \cdot 10^{+138}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot \left(z \cdot -0.5 + y \cdot \left(z \cdot -0.3333333333333333 + \left(z \cdot y\right) \cdot -0.25\right)\right) - z\right) - t\\
\end{array}
\end{array}
if x < -2.30000000000000004e157 or 2.24999999999999991e138 < x Initial program 96.9%
+-commutative96.9%
associate--l+96.9%
fma-define96.9%
sub-neg96.9%
log1p-define99.6%
Simplified99.6%
Taylor expanded in y around 0 99.6%
associate--l+99.6%
associate-*r*99.6%
mul-1-neg99.6%
fma-define99.6%
Simplified99.6%
Taylor expanded in x around inf 84.5%
if -2.30000000000000004e157 < x < 2.24999999999999991e138Initial program 78.6%
Taylor expanded in x around 0 56.0%
sub-neg56.0%
log1p-define77.0%
Simplified77.0%
Taylor expanded in y around 0 76.6%
Final simplification78.8%
(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.6%
Taylor expanded in y around 0 98.8%
+-commutative98.8%
mul-1-neg98.8%
unsub-neg98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t)
:precision binary64
(-
(*
y
(-
(* y (+ (* z -0.5) (* y (+ (* z -0.3333333333333333) (* (* z y) -0.25)))))
z))
t))
double code(double x, double y, double z, double t) {
return (y * ((y * ((z * -0.5) + (y * ((z * -0.3333333333333333) + ((z * y) * -0.25))))) - 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 * (-0.5d0)) + (y * ((z * (-0.3333333333333333d0)) + ((z * y) * (-0.25d0)))))) - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * ((y * ((z * -0.5) + (y * ((z * -0.3333333333333333) + ((z * y) * -0.25))))) - z)) - t;
}
def code(x, y, z, t): return (y * ((y * ((z * -0.5) + (y * ((z * -0.3333333333333333) + ((z * y) * -0.25))))) - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(Float64(y * Float64(Float64(z * -0.5) + Float64(y * Float64(Float64(z * -0.3333333333333333) + Float64(Float64(z * y) * -0.25))))) - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * ((y * ((z * -0.5) + (y * ((z * -0.3333333333333333) + ((z * y) * -0.25))))) - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * N[(N[(z * -0.3333333333333333), $MachinePrecision] + N[(N[(z * y), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(y \cdot \left(z \cdot -0.5 + y \cdot \left(z \cdot -0.3333333333333333 + \left(z \cdot y\right) \cdot -0.25\right)\right) - z\right) - t
\end{array}
Initial program 83.6%
Taylor expanded in x around 0 44.5%
sub-neg44.5%
log1p-define60.2%
Simplified60.2%
Taylor expanded in y around 0 59.9%
Final simplification59.9%
(FPCore (x y z t) :precision binary64 (- (* y (- (* y (* z (+ -0.5 (* y -0.3333333333333333)))) z)) t))
double code(double x, double y, double z, double t) {
return (y * ((y * (z * (-0.5 + (y * -0.3333333333333333)))) - 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 * ((-0.5d0) + (y * (-0.3333333333333333d0))))) - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * ((y * (z * (-0.5 + (y * -0.3333333333333333)))) - z)) - t;
}
def code(x, y, z, t): return (y * ((y * (z * (-0.5 + (y * -0.3333333333333333)))) - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(Float64(y * Float64(z * Float64(-0.5 + Float64(y * -0.3333333333333333)))) - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * ((y * (z * (-0.5 + (y * -0.3333333333333333)))) - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[(y * N[(z * N[(-0.5 + N[(y * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(y \cdot \left(z \cdot \left(-0.5 + y \cdot -0.3333333333333333\right)\right) - z\right) - t
\end{array}
Initial program 83.6%
Taylor expanded in x around 0 44.5%
sub-neg44.5%
log1p-define60.2%
Simplified60.2%
Taylor expanded in y around 0 59.8%
neg-mul-159.8%
+-commutative59.8%
unsub-neg59.8%
associate-*r*59.8%
distribute-rgt-out59.8%
Simplified59.8%
Final simplification59.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.1e-19) (not (<= t 5.4e-135))) (- t) (* z (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.1e-19) || !(t <= 5.4e-135)) {
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 <= (-6.1d-19)) .or. (.not. (t <= 5.4d-135))) 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 <= -6.1e-19) || !(t <= 5.4e-135)) {
tmp = -t;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.1e-19) or not (t <= 5.4e-135): tmp = -t else: tmp = z * -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.1e-19) || !(t <= 5.4e-135)) 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 <= -6.1e-19) || ~((t <= 5.4e-135))) tmp = -t; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.1e-19], N[Not[LessEqual[t, 5.4e-135]], $MachinePrecision]], (-t), N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.1 \cdot 10^{-19} \lor \neg \left(t \leq 5.4 \cdot 10^{-135}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -6.1000000000000003e-19 or 5.39999999999999997e-135 < t Initial program 93.4%
+-commutative93.4%
associate--l+93.4%
fma-define93.4%
sub-neg93.4%
log1p-define99.9%
Simplified99.9%
Taylor expanded in y around 0 99.3%
associate--l+99.3%
associate-*r*99.3%
mul-1-neg99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in t around inf 63.7%
neg-mul-163.7%
Simplified63.7%
if -6.1000000000000003e-19 < t < 5.39999999999999997e-135Initial program 68.3%
+-commutative68.3%
associate--l+68.3%
fma-define68.3%
sub-neg68.3%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 98.2%
associate--l+98.2%
associate-*r*98.2%
mul-1-neg98.2%
fma-define98.2%
Simplified98.2%
Taylor expanded in y around inf 33.7%
associate-*r*33.7%
mul-1-neg33.7%
Simplified33.7%
Final simplification52.0%
(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.6%
Taylor expanded in x around 0 44.5%
sub-neg44.5%
log1p-define60.2%
Simplified60.2%
Taylor expanded in y around 0 59.6%
neg-mul-159.6%
+-commutative59.6%
associate-*r*59.6%
neg-mul-159.6%
distribute-rgt-out59.6%
Simplified59.6%
Final simplification59.6%
(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.6%
+-commutative83.6%
associate--l+83.6%
fma-define83.6%
sub-neg83.6%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 98.8%
associate--l+98.8%
associate-*r*98.8%
mul-1-neg98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in x around 0 59.2%
associate-*r*59.2%
mul-1-neg59.2%
Simplified59.2%
Final simplification59.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 83.6%
+-commutative83.6%
associate--l+83.6%
fma-define83.6%
sub-neg83.6%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 98.8%
associate--l+98.8%
associate-*r*98.8%
mul-1-neg98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in t around inf 43.1%
neg-mul-143.1%
Simplified43.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 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.6%
+-commutative83.6%
associate--l+83.6%
fma-define83.6%
sub-neg83.6%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 98.8%
associate--l+98.8%
associate-*r*98.8%
mul-1-neg98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in t around inf 43.1%
neg-mul-143.1%
Simplified43.1%
neg-sub043.1%
sub-neg43.1%
add-sqr-sqrt20.0%
sqrt-unprod11.6%
sqr-neg11.6%
sqrt-unprod1.1%
add-sqr-sqrt2.3%
Applied egg-rr2.3%
+-lft-identity2.3%
Simplified2.3%
(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))