
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * 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 = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * 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 = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
(FPCore (x y z t)
:precision binary64
(if (<= y -9.2e-127)
(+ x (* (/ -0.3333333333333333 z) (+ y (/ -1.0 (/ y t)))))
(if (<= y 9e-114)
(/ (+ (* 0.3333333333333333 (/ t z)) (* y x)) y)
(+ x (* (/ -0.3333333333333333 z) (- y (/ t y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.2e-127) {
tmp = x + ((-0.3333333333333333 / z) * (y + (-1.0 / (y / t))));
} else if (y <= 9e-114) {
tmp = ((0.3333333333333333 * (t / z)) + (y * x)) / y;
} else {
tmp = x + ((-0.3333333333333333 / z) * (y - (t / 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 (y <= (-9.2d-127)) then
tmp = x + (((-0.3333333333333333d0) / z) * (y + ((-1.0d0) / (y / t))))
else if (y <= 9d-114) then
tmp = ((0.3333333333333333d0 * (t / z)) + (y * x)) / y
else
tmp = x + (((-0.3333333333333333d0) / z) * (y - (t / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.2e-127) {
tmp = x + ((-0.3333333333333333 / z) * (y + (-1.0 / (y / t))));
} else if (y <= 9e-114) {
tmp = ((0.3333333333333333 * (t / z)) + (y * x)) / y;
} else {
tmp = x + ((-0.3333333333333333 / z) * (y - (t / y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -9.2e-127: tmp = x + ((-0.3333333333333333 / z) * (y + (-1.0 / (y / t)))) elif y <= 9e-114: tmp = ((0.3333333333333333 * (t / z)) + (y * x)) / y else: tmp = x + ((-0.3333333333333333 / z) * (y - (t / y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -9.2e-127) tmp = Float64(x + Float64(Float64(-0.3333333333333333 / z) * Float64(y + Float64(-1.0 / Float64(y / t))))); elseif (y <= 9e-114) tmp = Float64(Float64(Float64(0.3333333333333333 * Float64(t / z)) + Float64(y * x)) / y); else tmp = Float64(x + Float64(Float64(-0.3333333333333333 / z) * Float64(y - Float64(t / y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -9.2e-127) tmp = x + ((-0.3333333333333333 / z) * (y + (-1.0 / (y / t)))); elseif (y <= 9e-114) tmp = ((0.3333333333333333 * (t / z)) + (y * x)) / y; else tmp = x + ((-0.3333333333333333 / z) * (y - (t / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -9.2e-127], N[(x + N[(N[(-0.3333333333333333 / z), $MachinePrecision] * N[(y + N[(-1.0 / N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e-114], N[(N[(N[(0.3333333333333333 * N[(t / z), $MachinePrecision]), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x + N[(N[(-0.3333333333333333 / z), $MachinePrecision] * N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.2 \cdot 10^{-127}:\\
\;\;\;\;x + \frac{-0.3333333333333333}{z} \cdot \left(y + \frac{-1}{\frac{y}{t}}\right)\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-114}:\\
\;\;\;\;\frac{0.3333333333333333 \cdot \frac{t}{z} + y \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)\\
\end{array}
\end{array}
if y < -9.20000000000000075e-127Initial program 99.8%
sub-neg99.8%
associate-+l+99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
sub-neg99.8%
distribute-frac-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-/l*99.8%
*-commutative99.8%
neg-mul-199.8%
times-frac99.8%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
clear-num99.8%
inv-pow99.8%
Applied egg-rr99.8%
unpow-199.8%
Simplified99.8%
if -9.20000000000000075e-127 < y < 8.99999999999999937e-114Initial program 96.0%
sub-neg96.0%
associate-+l+96.0%
distribute-frac-neg96.0%
neg-mul-196.0%
*-commutative96.0%
times-frac96.0%
fma-define96.0%
metadata-eval96.0%
associate-*l*95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in y around 0 98.6%
if 8.99999999999999937e-114 < y Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
remove-double-neg99.7%
distribute-frac-neg99.7%
sub-neg99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
*-commutative99.7%
neg-mul-199.7%
times-frac98.6%
distribute-lft-out--98.6%
*-commutative98.6%
associate-/r*98.7%
metadata-eval98.7%
Simplified98.7%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ -0.3333333333333333 z))))
(if (<= y -1.6e+132)
t_1
(if (<= y -2.15e+32)
x
(if (<= y 2.5e-53)
(* 0.3333333333333333 (/ t (* z y)))
(if (<= y 2.3e+41) x t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (-0.3333333333333333 / z);
double tmp;
if (y <= -1.6e+132) {
tmp = t_1;
} else if (y <= -2.15e+32) {
tmp = x;
} else if (y <= 2.5e-53) {
tmp = 0.3333333333333333 * (t / (z * y));
} else if (y <= 2.3e+41) {
tmp = x;
} else {
tmp = t_1;
}
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 = y * ((-0.3333333333333333d0) / z)
if (y <= (-1.6d+132)) then
tmp = t_1
else if (y <= (-2.15d+32)) then
tmp = x
else if (y <= 2.5d-53) then
tmp = 0.3333333333333333d0 * (t / (z * y))
else if (y <= 2.3d+41) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (-0.3333333333333333 / z);
double tmp;
if (y <= -1.6e+132) {
tmp = t_1;
} else if (y <= -2.15e+32) {
tmp = x;
} else if (y <= 2.5e-53) {
tmp = 0.3333333333333333 * (t / (z * y));
} else if (y <= 2.3e+41) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (-0.3333333333333333 / z) tmp = 0 if y <= -1.6e+132: tmp = t_1 elif y <= -2.15e+32: tmp = x elif y <= 2.5e-53: tmp = 0.3333333333333333 * (t / (z * y)) elif y <= 2.3e+41: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(-0.3333333333333333 / z)) tmp = 0.0 if (y <= -1.6e+132) tmp = t_1; elseif (y <= -2.15e+32) tmp = x; elseif (y <= 2.5e-53) tmp = Float64(0.3333333333333333 * Float64(t / Float64(z * y))); elseif (y <= 2.3e+41) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (-0.3333333333333333 / z); tmp = 0.0; if (y <= -1.6e+132) tmp = t_1; elseif (y <= -2.15e+32) tmp = x; elseif (y <= 2.5e-53) tmp = 0.3333333333333333 * (t / (z * y)); elseif (y <= 2.3e+41) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.6e+132], t$95$1, If[LessEqual[y, -2.15e+32], x, If[LessEqual[y, 2.5e-53], N[(0.3333333333333333 * N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e+41], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{if}\;y \leq -1.6 \cdot 10^{+132}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.15 \cdot 10^{+32}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-53}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{t}{z \cdot y}\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+41}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.5999999999999999e132 or 2.2999999999999998e41 < y Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
*-commutative99.7%
times-frac99.7%
fma-define99.7%
metadata-eval99.7%
associate-*l*99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in y around inf 75.3%
associate-*r/75.3%
associate-*l/75.4%
*-commutative75.4%
Simplified75.4%
if -1.5999999999999999e132 < y < -2.1499999999999999e32 or 2.5e-53 < y < 2.2999999999999998e41Initial program 99.8%
sub-neg99.8%
associate-+l+99.8%
distribute-frac-neg99.8%
neg-mul-199.8%
*-commutative99.8%
times-frac99.8%
fma-define99.8%
metadata-eval99.8%
associate-*l*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 59.9%
if -2.1499999999999999e32 < y < 2.5e-53Initial program 97.2%
sub-neg97.2%
associate-+l+97.2%
distribute-frac-neg97.2%
neg-mul-197.2%
*-commutative97.2%
times-frac97.2%
fma-define97.1%
metadata-eval97.1%
associate-*l*97.1%
*-commutative97.1%
Simplified97.1%
Taylor expanded in z around 0 90.3%
Taylor expanded in y around 0 66.8%
Final simplification68.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.9e-127) (not (<= y 7.5e-110))) (+ x (* (/ -0.3333333333333333 z) (- y (/ t y)))) (/ (+ (* 0.3333333333333333 (/ t z)) (* y x)) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.9e-127) || !(y <= 7.5e-110)) {
tmp = x + ((-0.3333333333333333 / z) * (y - (t / y)));
} else {
tmp = ((0.3333333333333333 * (t / z)) + (y * x)) / 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 ((y <= (-6.9d-127)) .or. (.not. (y <= 7.5d-110))) then
tmp = x + (((-0.3333333333333333d0) / z) * (y - (t / y)))
else
tmp = ((0.3333333333333333d0 * (t / z)) + (y * x)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.9e-127) || !(y <= 7.5e-110)) {
tmp = x + ((-0.3333333333333333 / z) * (y - (t / y)));
} else {
tmp = ((0.3333333333333333 * (t / z)) + (y * x)) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.9e-127) or not (y <= 7.5e-110): tmp = x + ((-0.3333333333333333 / z) * (y - (t / y))) else: tmp = ((0.3333333333333333 * (t / z)) + (y * x)) / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.9e-127) || !(y <= 7.5e-110)) tmp = Float64(x + Float64(Float64(-0.3333333333333333 / z) * Float64(y - Float64(t / y)))); else tmp = Float64(Float64(Float64(0.3333333333333333 * Float64(t / z)) + Float64(y * x)) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.9e-127) || ~((y <= 7.5e-110))) tmp = x + ((-0.3333333333333333 / z) * (y - (t / y))); else tmp = ((0.3333333333333333 * (t / z)) + (y * x)) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.9e-127], N[Not[LessEqual[y, 7.5e-110]], $MachinePrecision]], N[(x + N[(N[(-0.3333333333333333 / z), $MachinePrecision] * N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.3333333333333333 * N[(t / z), $MachinePrecision]), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.9 \cdot 10^{-127} \lor \neg \left(y \leq 7.5 \cdot 10^{-110}\right):\\
\;\;\;\;x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333 \cdot \frac{t}{z} + y \cdot x}{y}\\
\end{array}
\end{array}
if y < -6.90000000000000015e-127 or 7.50000000000000053e-110 < y Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
remove-double-neg99.7%
distribute-frac-neg99.7%
sub-neg99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
*-commutative99.7%
neg-mul-199.7%
times-frac99.2%
distribute-lft-out--99.2%
*-commutative99.2%
associate-/r*99.3%
metadata-eval99.3%
Simplified99.3%
if -6.90000000000000015e-127 < y < 7.50000000000000053e-110Initial program 96.0%
sub-neg96.0%
associate-+l+96.0%
distribute-frac-neg96.0%
neg-mul-196.0%
*-commutative96.0%
times-frac96.0%
fma-define96.0%
metadata-eval96.0%
associate-*l*95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in y around 0 98.6%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.25e-201) (not (<= y 9e-113))) (+ x (* (/ -0.3333333333333333 z) (- y (/ t y)))) (+ x (* 0.3333333333333333 (/ t (* z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.25e-201) || !(y <= 9e-113)) {
tmp = x + ((-0.3333333333333333 / z) * (y - (t / y)));
} else {
tmp = x + (0.3333333333333333 * (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 ((y <= (-1.25d-201)) .or. (.not. (y <= 9d-113))) then
tmp = x + (((-0.3333333333333333d0) / z) * (y - (t / y)))
else
tmp = x + (0.3333333333333333d0 * (t / (z * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.25e-201) || !(y <= 9e-113)) {
tmp = x + ((-0.3333333333333333 / z) * (y - (t / y)));
} else {
tmp = x + (0.3333333333333333 * (t / (z * y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.25e-201) or not (y <= 9e-113): tmp = x + ((-0.3333333333333333 / z) * (y - (t / y))) else: tmp = x + (0.3333333333333333 * (t / (z * y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.25e-201) || !(y <= 9e-113)) tmp = Float64(x + Float64(Float64(-0.3333333333333333 / z) * Float64(y - Float64(t / y)))); else tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(z * y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.25e-201) || ~((y <= 9e-113))) tmp = x + ((-0.3333333333333333 / z) * (y - (t / y))); else tmp = x + (0.3333333333333333 * (t / (z * y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.25e-201], N[Not[LessEqual[y, 9e-113]], $MachinePrecision]], N[(x + N[(N[(-0.3333333333333333 / z), $MachinePrecision] * N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(0.3333333333333333 * N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{-201} \lor \neg \left(y \leq 9 \cdot 10^{-113}\right):\\
\;\;\;\;x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{z \cdot y}\\
\end{array}
\end{array}
if y < -1.25e-201 or 9.0000000000000002e-113 < y Initial program 98.8%
sub-neg98.8%
associate-+l+98.8%
remove-double-neg98.8%
distribute-frac-neg98.8%
sub-neg98.8%
distribute-frac-neg98.8%
neg-mul-198.8%
*-commutative98.8%
associate-/l*98.8%
*-commutative98.8%
neg-mul-198.8%
times-frac98.8%
distribute-lft-out--98.8%
*-commutative98.8%
associate-/r*98.8%
metadata-eval98.8%
Simplified98.8%
if -1.25e-201 < y < 9.0000000000000002e-113Initial program 97.8%
sub-neg97.8%
associate-+l+97.8%
remove-double-neg97.8%
distribute-frac-neg97.8%
sub-neg97.8%
distribute-frac-neg97.8%
neg-mul-197.8%
*-commutative97.8%
associate-/l*97.8%
*-commutative97.8%
neg-mul-197.8%
times-frac82.6%
distribute-lft-out--82.6%
*-commutative82.6%
associate-/r*82.5%
metadata-eval82.5%
Simplified82.5%
Taylor expanded in y around 0 97.6%
Final simplification98.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.9e+39) (not (<= y 37.0))) (+ x (* y (/ -0.3333333333333333 z))) (+ x (* 0.3333333333333333 (/ t (* z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.9e+39) || !(y <= 37.0)) {
tmp = x + (y * (-0.3333333333333333 / z));
} else {
tmp = x + (0.3333333333333333 * (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 ((y <= (-4.9d+39)) .or. (.not. (y <= 37.0d0))) then
tmp = x + (y * ((-0.3333333333333333d0) / z))
else
tmp = x + (0.3333333333333333d0 * (t / (z * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.9e+39) || !(y <= 37.0)) {
tmp = x + (y * (-0.3333333333333333 / z));
} else {
tmp = x + (0.3333333333333333 * (t / (z * y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.9e+39) or not (y <= 37.0): tmp = x + (y * (-0.3333333333333333 / z)) else: tmp = x + (0.3333333333333333 * (t / (z * y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.9e+39) || !(y <= 37.0)) tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); else tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(z * y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.9e+39) || ~((y <= 37.0))) tmp = x + (y * (-0.3333333333333333 / z)); else tmp = x + (0.3333333333333333 * (t / (z * y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.9e+39], N[Not[LessEqual[y, 37.0]], $MachinePrecision]], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(0.3333333333333333 * N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.9 \cdot 10^{+39} \lor \neg \left(y \leq 37\right):\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{z \cdot y}\\
\end{array}
\end{array}
if y < -4.89999999999999987e39 or 37 < y Initial program 99.8%
sub-neg99.8%
associate-+l+99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
sub-neg99.8%
distribute-frac-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-/l*99.8%
*-commutative99.8%
neg-mul-199.8%
times-frac99.7%
distribute-lft-out--99.7%
*-commutative99.7%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 95.1%
if -4.89999999999999987e39 < y < 37Initial program 97.5%
sub-neg97.5%
associate-+l+97.5%
remove-double-neg97.5%
distribute-frac-neg97.5%
sub-neg97.5%
distribute-frac-neg97.5%
neg-mul-197.5%
*-commutative97.5%
associate-/l*97.4%
*-commutative97.4%
neg-mul-197.4%
times-frac90.6%
distribute-lft-out--90.6%
*-commutative90.6%
associate-/r*90.6%
metadata-eval90.6%
Simplified90.6%
Taylor expanded in y around 0 92.3%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.2e-54) (not (<= y 1.05e-64))) (+ x (* y (/ -0.3333333333333333 z))) (/ 0.3333333333333333 (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.2e-54) || !(y <= 1.05e-64)) {
tmp = x + (y * (-0.3333333333333333 / z));
} else {
tmp = 0.3333333333333333 / (y * (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 ((y <= (-6.2d-54)) .or. (.not. (y <= 1.05d-64))) then
tmp = x + (y * ((-0.3333333333333333d0) / z))
else
tmp = 0.3333333333333333d0 / (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.2e-54) || !(y <= 1.05e-64)) {
tmp = x + (y * (-0.3333333333333333 / z));
} else {
tmp = 0.3333333333333333 / (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.2e-54) or not (y <= 1.05e-64): tmp = x + (y * (-0.3333333333333333 / z)) else: tmp = 0.3333333333333333 / (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.2e-54) || !(y <= 1.05e-64)) tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); else tmp = Float64(0.3333333333333333 / Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.2e-54) || ~((y <= 1.05e-64))) tmp = x + (y * (-0.3333333333333333 / z)); else tmp = 0.3333333333333333 / (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.2e-54], N[Not[LessEqual[y, 1.05e-64]], $MachinePrecision]], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 / N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-54} \lor \neg \left(y \leq 1.05 \cdot 10^{-64}\right):\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{y \cdot \frac{z}{t}}\\
\end{array}
\end{array}
if y < -6.20000000000000008e-54 or 1.05000000000000006e-64 < y Initial program 99.8%
sub-neg99.8%
associate-+l+99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
sub-neg99.8%
distribute-frac-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-/l*99.7%
*-commutative99.7%
neg-mul-199.7%
times-frac99.1%
distribute-lft-out--99.2%
*-commutative99.2%
associate-/r*99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in y around inf 88.5%
if -6.20000000000000008e-54 < y < 1.05000000000000006e-64Initial program 96.7%
sub-neg96.7%
associate-+l+96.7%
distribute-frac-neg96.7%
neg-mul-196.7%
*-commutative96.7%
times-frac96.7%
fma-define96.7%
metadata-eval96.7%
associate-*l*96.7%
*-commutative96.7%
Simplified96.7%
Taylor expanded in z around 0 88.4%
Taylor expanded in y around 0 72.4%
clear-num72.3%
un-div-inv72.4%
associate-/l*74.4%
Applied egg-rr74.4%
Final simplification83.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5.6e-53) (not (<= y 3.4e-63))) (+ x (* y (/ -0.3333333333333333 z))) (* 0.3333333333333333 (/ t (* z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.6e-53) || !(y <= 3.4e-63)) {
tmp = x + (y * (-0.3333333333333333 / z));
} else {
tmp = 0.3333333333333333 * (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 ((y <= (-5.6d-53)) .or. (.not. (y <= 3.4d-63))) then
tmp = x + (y * ((-0.3333333333333333d0) / z))
else
tmp = 0.3333333333333333d0 * (t / (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.6e-53) || !(y <= 3.4e-63)) {
tmp = x + (y * (-0.3333333333333333 / z));
} else {
tmp = 0.3333333333333333 * (t / (z * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5.6e-53) or not (y <= 3.4e-63): tmp = x + (y * (-0.3333333333333333 / z)) else: tmp = 0.3333333333333333 * (t / (z * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5.6e-53) || !(y <= 3.4e-63)) tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); else tmp = Float64(0.3333333333333333 * Float64(t / Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -5.6e-53) || ~((y <= 3.4e-63))) tmp = x + (y * (-0.3333333333333333 / z)); else tmp = 0.3333333333333333 * (t / (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.6e-53], N[Not[LessEqual[y, 3.4e-63]], $MachinePrecision]], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 * N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{-53} \lor \neg \left(y \leq 3.4 \cdot 10^{-63}\right):\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{t}{z \cdot y}\\
\end{array}
\end{array}
if y < -5.59999999999999971e-53 or 3.39999999999999998e-63 < y Initial program 99.8%
sub-neg99.8%
associate-+l+99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
sub-neg99.8%
distribute-frac-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-/l*99.7%
*-commutative99.7%
neg-mul-199.7%
times-frac99.1%
distribute-lft-out--99.2%
*-commutative99.2%
associate-/r*99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in y around inf 88.5%
if -5.59999999999999971e-53 < y < 3.39999999999999998e-63Initial program 96.7%
sub-neg96.7%
associate-+l+96.7%
distribute-frac-neg96.7%
neg-mul-196.7%
*-commutative96.7%
times-frac96.7%
fma-define96.7%
metadata-eval96.7%
associate-*l*96.7%
*-commutative96.7%
Simplified96.7%
Taylor expanded in z around 0 88.4%
Taylor expanded in y around 0 72.4%
Final simplification82.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.5e+132) (not (<= y 2.2e+43))) (* y (/ -0.3333333333333333 z)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.5e+132) || !(y <= 2.2e+43)) {
tmp = y * (-0.3333333333333333 / z);
} else {
tmp = x;
}
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 ((y <= (-9.5d+132)) .or. (.not. (y <= 2.2d+43))) then
tmp = y * ((-0.3333333333333333d0) / z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.5e+132) || !(y <= 2.2e+43)) {
tmp = y * (-0.3333333333333333 / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9.5e+132) or not (y <= 2.2e+43): tmp = y * (-0.3333333333333333 / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9.5e+132) || !(y <= 2.2e+43)) tmp = Float64(y * Float64(-0.3333333333333333 / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -9.5e+132) || ~((y <= 2.2e+43))) tmp = y * (-0.3333333333333333 / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9.5e+132], N[Not[LessEqual[y, 2.2e+43]], $MachinePrecision]], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+132} \lor \neg \left(y \leq 2.2 \cdot 10^{+43}\right):\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.5000000000000005e132 or 2.20000000000000001e43 < y Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
*-commutative99.7%
times-frac99.7%
fma-define99.7%
metadata-eval99.7%
associate-*l*99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in y around inf 75.3%
associate-*r/75.3%
associate-*l/75.4%
*-commutative75.4%
Simplified75.4%
if -9.5000000000000005e132 < y < 2.20000000000000001e43Initial program 97.9%
sub-neg97.9%
associate-+l+97.9%
distribute-frac-neg97.9%
neg-mul-197.9%
*-commutative97.9%
times-frac97.9%
fma-define97.8%
metadata-eval97.8%
associate-*l*97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in x around inf 36.3%
Final simplification50.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.6e+132) (not (<= y 1.1e+43))) (* -0.3333333333333333 (/ y z)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.6e+132) || !(y <= 1.1e+43)) {
tmp = -0.3333333333333333 * (y / z);
} else {
tmp = x;
}
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 ((y <= (-1.6d+132)) .or. (.not. (y <= 1.1d+43))) then
tmp = (-0.3333333333333333d0) * (y / z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.6e+132) || !(y <= 1.1e+43)) {
tmp = -0.3333333333333333 * (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.6e+132) or not (y <= 1.1e+43): tmp = -0.3333333333333333 * (y / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.6e+132) || !(y <= 1.1e+43)) tmp = Float64(-0.3333333333333333 * Float64(y / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.6e+132) || ~((y <= 1.1e+43))) tmp = -0.3333333333333333 * (y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.6e+132], N[Not[LessEqual[y, 1.1e+43]], $MachinePrecision]], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+132} \lor \neg \left(y \leq 1.1 \cdot 10^{+43}\right):\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.5999999999999999e132 or 1.1e43 < y Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
*-commutative99.7%
times-frac99.7%
fma-define99.7%
metadata-eval99.7%
associate-*l*99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around 0 95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in y around inf 75.3%
if -1.5999999999999999e132 < y < 1.1e43Initial program 97.9%
sub-neg97.9%
associate-+l+97.9%
distribute-frac-neg97.9%
neg-mul-197.9%
*-commutative97.9%
times-frac97.9%
fma-define97.8%
metadata-eval97.8%
associate-*l*97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in x around inf 36.3%
Final simplification50.8%
(FPCore (x y z t) :precision binary64 (+ (+ (/ t (* z (* y 3.0))) x) (/ y (* z -3.0))))
double code(double x, double y, double z, double t) {
return ((t / (z * (y * 3.0))) + x) + (y / (z * -3.0));
}
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 / (z * (y * 3.0d0))) + x) + (y / (z * (-3.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return ((t / (z * (y * 3.0))) + x) + (y / (z * -3.0));
}
def code(x, y, z, t): return ((t / (z * (y * 3.0))) + x) + (y / (z * -3.0))
function code(x, y, z, t) return Float64(Float64(Float64(t / Float64(z * Float64(y * 3.0))) + x) + Float64(y / Float64(z * -3.0))) end
function tmp = code(x, y, z, t) tmp = ((t / (z * (y * 3.0))) + x) + (y / (z * -3.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(t / N[(z * N[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{t}{z \cdot \left(y \cdot 3\right)} + x\right) + \frac{y}{z \cdot -3}
\end{array}
Initial program 98.6%
+-commutative98.6%
associate-+r-98.6%
sub-neg98.6%
associate-*l*98.6%
*-commutative98.6%
distribute-frac-neg298.6%
distribute-rgt-neg-in98.6%
metadata-eval98.6%
Simplified98.6%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 98.6%
sub-neg98.6%
associate-+l+98.6%
distribute-frac-neg98.6%
neg-mul-198.6%
*-commutative98.6%
times-frac98.5%
fma-define98.5%
metadata-eval98.5%
associate-*l*98.6%
*-commutative98.6%
Simplified98.6%
Taylor expanded in x around inf 30.7%
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y)))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / 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 = (x - (y / (z * 3.0d0))) + ((t / (z * 3.0d0)) / y)
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y)
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / Float64(z * 3.0)) / y)) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(z * 3.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}
\end{array}
herbie shell --seed 2024182
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:alt
(! :herbie-platform default (+ (- x (/ y (* z 3))) (/ (/ t (* z 3)) y)))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))