
(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 14 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 (<= (* z 3.0) 1e-61) (+ x (/ (- y (/ t y)) (* z -3.0))) (+ (+ x (/ t (* z (* 3.0 y)))) (/ 1.0 (* -3.0 (/ z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * 3.0) <= 1e-61) {
tmp = x + ((y - (t / y)) / (z * -3.0));
} else {
tmp = (x + (t / (z * (3.0 * y)))) + (1.0 / (-3.0 * (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 ((z * 3.0d0) <= 1d-61) then
tmp = x + ((y - (t / y)) / (z * (-3.0d0)))
else
tmp = (x + (t / (z * (3.0d0 * y)))) + (1.0d0 / ((-3.0d0) * (z / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * 3.0) <= 1e-61) {
tmp = x + ((y - (t / y)) / (z * -3.0));
} else {
tmp = (x + (t / (z * (3.0 * y)))) + (1.0 / (-3.0 * (z / y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * 3.0) <= 1e-61: tmp = x + ((y - (t / y)) / (z * -3.0)) else: tmp = (x + (t / (z * (3.0 * y)))) + (1.0 / (-3.0 * (z / y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * 3.0) <= 1e-61) tmp = Float64(x + Float64(Float64(y - Float64(t / y)) / Float64(z * -3.0))); else tmp = Float64(Float64(x + Float64(t / Float64(z * Float64(3.0 * y)))) + Float64(1.0 / Float64(-3.0 * Float64(z / y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * 3.0) <= 1e-61) tmp = x + ((y - (t / y)) / (z * -3.0)); else tmp = (x + (t / (z * (3.0 * y)))) + (1.0 / (-3.0 * (z / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], 1e-61], N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(t / N[(z * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(-3.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq 10^{-61}:\\
\;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;\left(x + \frac{t}{z \cdot \left(3 \cdot y\right)}\right) + \frac{1}{-3 \cdot \frac{z}{y}}\\
\end{array}
\end{array}
if (*.f64 z #s(literal 3 binary64)) < 1e-61Initial program 91.1%
sub-neg91.1%
associate-+l+91.1%
remove-double-neg91.1%
distribute-frac-neg91.1%
sub-neg91.1%
distribute-frac-neg91.1%
neg-mul-191.1%
*-commutative91.1%
associate-/l*91.1%
*-commutative91.1%
neg-mul-191.1%
times-frac97.0%
distribute-lft-out--98.7%
*-commutative98.7%
associate-/r*98.7%
metadata-eval98.7%
Simplified98.7%
div-inv98.7%
Applied egg-rr98.7%
*-commutative98.7%
clear-num98.7%
un-div-inv98.7%
div-inv98.7%
div-inv98.7%
metadata-eval98.7%
Applied egg-rr98.7%
if 1e-61 < (*.f64 z #s(literal 3 binary64)) Initial program 99.7%
+-commutative99.7%
associate-+r-99.7%
sub-neg99.7%
associate-*l*99.7%
*-commutative99.7%
distribute-frac-neg299.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
clear-num99.8%
inv-pow99.8%
*-commutative99.8%
*-un-lft-identity99.8%
times-frac99.8%
metadata-eval99.8%
Applied egg-rr99.8%
unpow-199.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (<= (* z 3.0) 1e-61) (+ x (/ (- y (/ t y)) (* z -3.0))) (+ (+ x (/ t (* z (* 3.0 y)))) (/ y (* z -3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * 3.0) <= 1e-61) {
tmp = x + ((y - (t / y)) / (z * -3.0));
} else {
tmp = (x + (t / (z * (3.0 * y)))) + (y / (z * -3.0));
}
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 * 3.0d0) <= 1d-61) then
tmp = x + ((y - (t / y)) / (z * (-3.0d0)))
else
tmp = (x + (t / (z * (3.0d0 * y)))) + (y / (z * (-3.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * 3.0) <= 1e-61) {
tmp = x + ((y - (t / y)) / (z * -3.0));
} else {
tmp = (x + (t / (z * (3.0 * y)))) + (y / (z * -3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * 3.0) <= 1e-61: tmp = x + ((y - (t / y)) / (z * -3.0)) else: tmp = (x + (t / (z * (3.0 * y)))) + (y / (z * -3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * 3.0) <= 1e-61) tmp = Float64(x + Float64(Float64(y - Float64(t / y)) / Float64(z * -3.0))); else tmp = Float64(Float64(x + Float64(t / Float64(z * Float64(3.0 * y)))) + Float64(y / Float64(z * -3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * 3.0) <= 1e-61) tmp = x + ((y - (t / y)) / (z * -3.0)); else tmp = (x + (t / (z * (3.0 * y)))) + (y / (z * -3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], 1e-61], N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(t / N[(z * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq 10^{-61}:\\
\;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;\left(x + \frac{t}{z \cdot \left(3 \cdot y\right)}\right) + \frac{y}{z \cdot -3}\\
\end{array}
\end{array}
if (*.f64 z #s(literal 3 binary64)) < 1e-61Initial program 91.1%
sub-neg91.1%
associate-+l+91.1%
remove-double-neg91.1%
distribute-frac-neg91.1%
sub-neg91.1%
distribute-frac-neg91.1%
neg-mul-191.1%
*-commutative91.1%
associate-/l*91.1%
*-commutative91.1%
neg-mul-191.1%
times-frac97.0%
distribute-lft-out--98.7%
*-commutative98.7%
associate-/r*98.7%
metadata-eval98.7%
Simplified98.7%
div-inv98.7%
Applied egg-rr98.7%
*-commutative98.7%
clear-num98.7%
un-div-inv98.7%
div-inv98.7%
div-inv98.7%
metadata-eval98.7%
Applied egg-rr98.7%
if 1e-61 < (*.f64 z #s(literal 3 binary64)) Initial program 99.7%
+-commutative99.7%
associate-+r-99.7%
sub-neg99.7%
associate-*l*99.7%
*-commutative99.7%
distribute-frac-neg299.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.25e+48) (not (<= y 5.5e+38))) (+ x (/ y (* z -3.0))) (- x (/ (/ (* t -0.3333333333333333) y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.25e+48) || !(y <= 5.5e+38)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = x - (((t * -0.3333333333333333) / 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 ((y <= (-1.25d+48)) .or. (.not. (y <= 5.5d+38))) then
tmp = x + (y / (z * (-3.0d0)))
else
tmp = x - (((t * (-0.3333333333333333d0)) / y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.25e+48) || !(y <= 5.5e+38)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = x - (((t * -0.3333333333333333) / y) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.25e+48) or not (y <= 5.5e+38): tmp = x + (y / (z * -3.0)) else: tmp = x - (((t * -0.3333333333333333) / y) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.25e+48) || !(y <= 5.5e+38)) tmp = Float64(x + Float64(y / Float64(z * -3.0))); else tmp = Float64(x - Float64(Float64(Float64(t * -0.3333333333333333) / y) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.25e+48) || ~((y <= 5.5e+38))) tmp = x + (y / (z * -3.0)); else tmp = x - (((t * -0.3333333333333333) / y) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.25e+48], N[Not[LessEqual[y, 5.5e+38]], $MachinePrecision]], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(N[(t * -0.3333333333333333), $MachinePrecision] / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+48} \lor \neg \left(y \leq 5.5 \cdot 10^{+38}\right):\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\frac{t \cdot -0.3333333333333333}{y}}{z}\\
\end{array}
\end{array}
if y < -1.24999999999999993e48 or 5.5000000000000003e38 < y Initial program 97.0%
sub-neg97.0%
associate-+l+97.0%
remove-double-neg97.0%
distribute-frac-neg97.0%
sub-neg97.0%
distribute-frac-neg97.0%
neg-mul-197.0%
*-commutative97.0%
associate-/l*97.0%
*-commutative97.0%
neg-mul-197.0%
times-frac97.0%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 96.1%
*-commutative96.1%
metadata-eval96.1%
times-frac96.2%
*-rgt-identity96.2%
Simplified96.2%
if -1.24999999999999993e48 < y < 5.5000000000000003e38Initial program 91.5%
sub-neg91.5%
associate-+l+91.5%
distribute-frac-neg91.5%
neg-mul-191.5%
*-commutative91.5%
times-frac91.5%
fma-define91.5%
metadata-eval91.5%
associate-*l*91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in z around -inf 94.8%
mul-1-neg94.8%
metadata-eval94.8%
cancel-sign-sub-inv94.8%
unsub-neg94.8%
distribute-lft-out--94.8%
Simplified94.8%
Taylor expanded in t around inf 87.7%
associate-*r/87.8%
Simplified87.8%
Final simplification91.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.25e+48) (not (<= y 1.5e+38))) (+ x (/ y (* z -3.0))) (+ x (/ t (* (* z 3.0) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.25e+48) || !(y <= 1.5e+38)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = x + (t / ((z * 3.0) * 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+48)) .or. (.not. (y <= 1.5d+38))) then
tmp = x + (y / (z * (-3.0d0)))
else
tmp = x + (t / ((z * 3.0d0) * 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+48) || !(y <= 1.5e+38)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = x + (t / ((z * 3.0) * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.25e+48) or not (y <= 1.5e+38): tmp = x + (y / (z * -3.0)) else: tmp = x + (t / ((z * 3.0) * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.25e+48) || !(y <= 1.5e+38)) tmp = Float64(x + Float64(y / Float64(z * -3.0))); else tmp = Float64(x + Float64(t / Float64(Float64(z * 3.0) * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.25e+48) || ~((y <= 1.5e+38))) tmp = x + (y / (z * -3.0)); else tmp = x + (t / ((z * 3.0) * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.25e+48], N[Not[LessEqual[y, 1.5e+38]], $MachinePrecision]], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+48} \lor \neg \left(y \leq 1.5 \cdot 10^{+38}\right):\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{\left(z \cdot 3\right) \cdot y}\\
\end{array}
\end{array}
if y < -1.24999999999999993e48 or 1.5000000000000001e38 < y Initial program 97.0%
sub-neg97.0%
associate-+l+97.0%
remove-double-neg97.0%
distribute-frac-neg97.0%
sub-neg97.0%
distribute-frac-neg97.0%
neg-mul-197.0%
*-commutative97.0%
associate-/l*97.0%
*-commutative97.0%
neg-mul-197.0%
times-frac97.0%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 96.1%
*-commutative96.1%
metadata-eval96.1%
times-frac96.2%
*-rgt-identity96.2%
Simplified96.2%
if -1.24999999999999993e48 < y < 1.5000000000000001e38Initial program 91.5%
sub-neg91.5%
associate-+l+91.5%
remove-double-neg91.5%
distribute-frac-neg91.5%
sub-neg91.5%
distribute-frac-neg91.5%
neg-mul-191.5%
*-commutative91.5%
associate-/l*91.5%
*-commutative91.5%
neg-mul-191.5%
times-frac94.8%
distribute-lft-out--94.8%
*-commutative94.8%
associate-/r*94.7%
metadata-eval94.7%
Simplified94.7%
Taylor expanded in y around 0 87.0%
metadata-eval87.0%
times-frac87.1%
*-commutative87.1%
times-frac86.4%
associate-*l/87.0%
*-lft-identity87.0%
Simplified87.0%
Taylor expanded in t around 0 87.0%
*-commutative87.0%
metadata-eval87.0%
times-frac87.1%
*-rgt-identity87.1%
associate-*l*87.0%
Simplified87.0%
Final simplification90.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.7e+48) (not (<= y 1.6e+39))) (+ x (/ y (* z -3.0))) (+ x (* 0.3333333333333333 (/ t (* z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.7e+48) || !(y <= 1.6e+39)) {
tmp = x + (y / (z * -3.0));
} 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.7d+48)) .or. (.not. (y <= 1.6d+39))) then
tmp = x + (y / (z * (-3.0d0)))
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.7e+48) || !(y <= 1.6e+39)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = x + (0.3333333333333333 * (t / (z * y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.7e+48) or not (y <= 1.6e+39): tmp = x + (y / (z * -3.0)) else: tmp = x + (0.3333333333333333 * (t / (z * y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.7e+48) || !(y <= 1.6e+39)) tmp = Float64(x + Float64(y / Float64(z * -3.0))); 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.7e+48) || ~((y <= 1.6e+39))) tmp = x + (y / (z * -3.0)); else tmp = x + (0.3333333333333333 * (t / (z * y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.7e+48], N[Not[LessEqual[y, 1.6e+39]], $MachinePrecision]], N[(x + N[(y / N[(z * -3.0), $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.7 \cdot 10^{+48} \lor \neg \left(y \leq 1.6 \cdot 10^{+39}\right):\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{z \cdot y}\\
\end{array}
\end{array}
if y < -1.7000000000000002e48 or 1.59999999999999996e39 < y Initial program 97.0%
sub-neg97.0%
associate-+l+97.0%
remove-double-neg97.0%
distribute-frac-neg97.0%
sub-neg97.0%
distribute-frac-neg97.0%
neg-mul-197.0%
*-commutative97.0%
associate-/l*97.0%
*-commutative97.0%
neg-mul-197.0%
times-frac97.0%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 96.1%
*-commutative96.1%
metadata-eval96.1%
times-frac96.2%
*-rgt-identity96.2%
Simplified96.2%
if -1.7000000000000002e48 < y < 1.59999999999999996e39Initial program 91.5%
sub-neg91.5%
associate-+l+91.5%
remove-double-neg91.5%
distribute-frac-neg91.5%
sub-neg91.5%
distribute-frac-neg91.5%
neg-mul-191.5%
*-commutative91.5%
associate-/l*91.5%
*-commutative91.5%
neg-mul-191.5%
times-frac94.8%
distribute-lft-out--94.8%
*-commutative94.8%
associate-/r*94.7%
metadata-eval94.7%
Simplified94.7%
Taylor expanded in y around 0 87.0%
Final simplification90.8%
(FPCore (x y z t) :precision binary64 (if (<= x -1.05e+88) x (if (<= x 7e+58) (/ (/ y -3.0) z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.05e+88) {
tmp = x;
} else if (x <= 7e+58) {
tmp = (y / -3.0) / 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 (x <= (-1.05d+88)) then
tmp = x
else if (x <= 7d+58) then
tmp = (y / (-3.0d0)) / 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 (x <= -1.05e+88) {
tmp = x;
} else if (x <= 7e+58) {
tmp = (y / -3.0) / z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.05e+88: tmp = x elif x <= 7e+58: tmp = (y / -3.0) / z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.05e+88) tmp = x; elseif (x <= 7e+58) tmp = Float64(Float64(y / -3.0) / z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.05e+88) tmp = x; elseif (x <= 7e+58) tmp = (y / -3.0) / z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.05e+88], x, If[LessEqual[x, 7e+58], N[(N[(y / -3.0), $MachinePrecision] / z), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{+88}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+58}:\\
\;\;\;\;\frac{\frac{y}{-3}}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.05e88 or 6.9999999999999995e58 < x Initial program 98.8%
sub-neg98.8%
associate-+l+98.8%
distribute-frac-neg98.8%
neg-mul-198.8%
*-commutative98.8%
times-frac98.9%
fma-define98.9%
metadata-eval98.9%
associate-*l*98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 63.1%
if -1.05e88 < x < 6.9999999999999995e58Initial program 90.8%
Taylor expanded in t around 0 57.2%
Taylor expanded in x around 0 47.2%
metadata-eval47.2%
times-frac47.3%
*-un-lft-identity47.3%
associate-/r*47.3%
Applied egg-rr47.3%
(FPCore (x y z t) :precision binary64 (if (<= x -2.05e+89) x (if (<= x 2.9e+58) (/ y (* z -3.0)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.05e+89) {
tmp = x;
} else if (x <= 2.9e+58) {
tmp = y / (z * -3.0);
} 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 (x <= (-2.05d+89)) then
tmp = x
else if (x <= 2.9d+58) then
tmp = y / (z * (-3.0d0))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.05e+89) {
tmp = x;
} else if (x <= 2.9e+58) {
tmp = y / (z * -3.0);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.05e+89: tmp = x elif x <= 2.9e+58: tmp = y / (z * -3.0) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.05e+89) tmp = x; elseif (x <= 2.9e+58) tmp = Float64(y / Float64(z * -3.0)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.05e+89) tmp = x; elseif (x <= 2.9e+58) tmp = y / (z * -3.0); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.05e+89], x, If[LessEqual[x, 2.9e+58], N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{+89}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+58}:\\
\;\;\;\;\frac{y}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.04999999999999993e89 or 2.90000000000000002e58 < x Initial program 98.8%
sub-neg98.8%
associate-+l+98.8%
distribute-frac-neg98.8%
neg-mul-198.8%
*-commutative98.8%
times-frac98.9%
fma-define98.9%
metadata-eval98.9%
associate-*l*98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 63.1%
if -2.04999999999999993e89 < x < 2.90000000000000002e58Initial program 90.8%
Taylor expanded in t around 0 57.2%
Taylor expanded in x around 0 47.2%
metadata-eval47.2%
distribute-lft-neg-in47.2%
distribute-rgt-neg-in47.2%
metadata-eval47.2%
distribute-neg-frac47.2%
times-frac47.3%
neg-mul-147.3%
remove-double-neg47.3%
*-commutative47.3%
Simplified47.3%
(FPCore (x y z t) :precision binary64 (if (<= x -7.8e+87) x (if (<= x 4.7e+57) (/ -0.3333333333333333 (/ z y)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.8e+87) {
tmp = x;
} else if (x <= 4.7e+57) {
tmp = -0.3333333333333333 / (z / y);
} 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 (x <= (-7.8d+87)) then
tmp = x
else if (x <= 4.7d+57) then
tmp = (-0.3333333333333333d0) / (z / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.8e+87) {
tmp = x;
} else if (x <= 4.7e+57) {
tmp = -0.3333333333333333 / (z / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.8e+87: tmp = x elif x <= 4.7e+57: tmp = -0.3333333333333333 / (z / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.8e+87) tmp = x; elseif (x <= 4.7e+57) tmp = Float64(-0.3333333333333333 / Float64(z / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.8e+87) tmp = x; elseif (x <= 4.7e+57) tmp = -0.3333333333333333 / (z / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.8e+87], x, If[LessEqual[x, 4.7e+57], N[(-0.3333333333333333 / N[(z / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{+87}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.7 \cdot 10^{+57}:\\
\;\;\;\;\frac{-0.3333333333333333}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.80000000000000039e87 or 4.7000000000000003e57 < x Initial program 98.8%
sub-neg98.8%
associate-+l+98.8%
distribute-frac-neg98.8%
neg-mul-198.8%
*-commutative98.8%
times-frac98.9%
fma-define98.9%
metadata-eval98.9%
associate-*l*98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 63.1%
if -7.80000000000000039e87 < x < 4.7000000000000003e57Initial program 90.8%
Taylor expanded in t around 0 57.2%
Taylor expanded in x around 0 47.2%
clear-num47.2%
un-div-inv47.2%
Applied egg-rr47.2%
(FPCore (x y z t) :precision binary64 (if (<= x -5.9e+88) x (if (<= x 1.6e+58) (* -0.3333333333333333 (/ y z)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.9e+88) {
tmp = x;
} else if (x <= 1.6e+58) {
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 (x <= (-5.9d+88)) then
tmp = x
else if (x <= 1.6d+58) 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 (x <= -5.9e+88) {
tmp = x;
} else if (x <= 1.6e+58) {
tmp = -0.3333333333333333 * (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.9e+88: tmp = x elif x <= 1.6e+58: tmp = -0.3333333333333333 * (y / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.9e+88) tmp = x; elseif (x <= 1.6e+58) 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 (x <= -5.9e+88) tmp = x; elseif (x <= 1.6e+58) tmp = -0.3333333333333333 * (y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.9e+88], x, If[LessEqual[x, 1.6e+58], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.9 \cdot 10^{+88}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{+58}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.89999999999999967e88 or 1.60000000000000008e58 < x Initial program 98.8%
sub-neg98.8%
associate-+l+98.8%
distribute-frac-neg98.8%
neg-mul-198.8%
*-commutative98.8%
times-frac98.9%
fma-define98.9%
metadata-eval98.9%
associate-*l*98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 63.1%
if -5.89999999999999967e88 < x < 1.60000000000000008e58Initial program 90.8%
Taylor expanded in t around 0 57.2%
Taylor expanded in x around 0 47.2%
(FPCore (x y z t) :precision binary64 (+ x (/ (- y (/ t y)) (* z -3.0))))
double code(double x, double y, double z, double t) {
return x + ((y - (t / 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 = x + ((y - (t / y)) / (z * (-3.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - (t / y)) / (z * -3.0));
}
def code(x, y, z, t): return x + ((y - (t / y)) / (z * -3.0))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - Float64(t / y)) / Float64(z * -3.0))) end
function tmp = code(x, y, z, t) tmp = x + ((y - (t / y)) / (z * -3.0)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - \frac{t}{y}}{z \cdot -3}
\end{array}
Initial program 93.8%
sub-neg93.8%
associate-+l+93.8%
remove-double-neg93.8%
distribute-frac-neg93.8%
sub-neg93.8%
distribute-frac-neg93.8%
neg-mul-193.8%
*-commutative93.8%
associate-/l*93.8%
*-commutative93.8%
neg-mul-193.8%
times-frac95.7%
distribute-lft-out--96.9%
*-commutative96.9%
associate-/r*96.8%
metadata-eval96.8%
Simplified96.8%
div-inv96.8%
Applied egg-rr96.8%
*-commutative96.8%
clear-num96.8%
un-div-inv96.8%
div-inv96.8%
div-inv96.9%
metadata-eval96.9%
Applied egg-rr96.9%
(FPCore (x y z t) :precision binary64 (+ x (* (- y (/ t y)) (/ -0.3333333333333333 z))))
double code(double x, double y, double z, double t) {
return x + ((y - (t / y)) * (-0.3333333333333333 / z));
}
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 - (t / y)) * ((-0.3333333333333333d0) / z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - (t / y)) * (-0.3333333333333333 / z));
}
def code(x, y, z, t): return x + ((y - (t / y)) * (-0.3333333333333333 / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - Float64(t / y)) * Float64(-0.3333333333333333 / z))) end
function tmp = code(x, y, z, t) tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - \frac{t}{y}\right) \cdot \frac{-0.3333333333333333}{z}
\end{array}
Initial program 93.8%
sub-neg93.8%
associate-+l+93.8%
remove-double-neg93.8%
distribute-frac-neg93.8%
sub-neg93.8%
distribute-frac-neg93.8%
neg-mul-193.8%
*-commutative93.8%
associate-/l*93.8%
*-commutative93.8%
neg-mul-193.8%
times-frac95.7%
distribute-lft-out--96.9%
*-commutative96.9%
associate-/r*96.8%
metadata-eval96.8%
Simplified96.8%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (+ x (/ y (* z -3.0))))
double code(double x, double y, double z, double t) {
return 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 = x + (y / (z * (-3.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return x + (y / (z * -3.0));
}
def code(x, y, z, t): return x + (y / (z * -3.0))
function code(x, y, z, t) return Float64(x + Float64(y / Float64(z * -3.0))) end
function tmp = code(x, y, z, t) tmp = x + (y / (z * -3.0)); end
code[x_, y_, z_, t_] := N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{z \cdot -3}
\end{array}
Initial program 93.8%
sub-neg93.8%
associate-+l+93.8%
remove-double-neg93.8%
distribute-frac-neg93.8%
sub-neg93.8%
distribute-frac-neg93.8%
neg-mul-193.8%
*-commutative93.8%
associate-/l*93.8%
*-commutative93.8%
neg-mul-193.8%
times-frac95.7%
distribute-lft-out--96.9%
*-commutative96.9%
associate-/r*96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in y around inf 64.1%
*-commutative64.1%
metadata-eval64.1%
times-frac64.2%
*-rgt-identity64.2%
Simplified64.2%
(FPCore (x y z t) :precision binary64 (+ x (* y (/ -0.3333333333333333 z))))
double code(double x, double y, double z, double t) {
return x + (y * (-0.3333333333333333 / z));
}
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 * ((-0.3333333333333333d0) / z))
end function
public static double code(double x, double y, double z, double t) {
return x + (y * (-0.3333333333333333 / z));
}
def code(x, y, z, t): return x + (y * (-0.3333333333333333 / z))
function code(x, y, z, t) return Float64(x + Float64(y * Float64(-0.3333333333333333 / z))) end
function tmp = code(x, y, z, t) tmp = x + (y * (-0.3333333333333333 / z)); end
code[x_, y_, z_, t_] := N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{-0.3333333333333333}{z}
\end{array}
Initial program 93.8%
sub-neg93.8%
associate-+l+93.8%
remove-double-neg93.8%
distribute-frac-neg93.8%
sub-neg93.8%
distribute-frac-neg93.8%
neg-mul-193.8%
*-commutative93.8%
associate-/l*93.8%
*-commutative93.8%
neg-mul-193.8%
times-frac95.7%
distribute-lft-out--96.9%
*-commutative96.9%
associate-/r*96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in y around inf 64.1%
Final simplification64.1%
(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 93.8%
sub-neg93.8%
associate-+l+93.8%
distribute-frac-neg93.8%
neg-mul-193.8%
*-commutative93.8%
times-frac93.8%
fma-define93.8%
metadata-eval93.8%
associate-*l*93.8%
*-commutative93.8%
Simplified93.8%
Taylor expanded in x around inf 31.5%
(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 2024181
(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))))