
(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 (<= (* z 3.0) 1e-120) (+ x (* (/ 0.3333333333333333 z) (- (/ t y) y))) (+ (+ 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-120) {
tmp = x + ((0.3333333333333333 / z) * ((t / y) - y));
} 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-120) then
tmp = x + ((0.3333333333333333d0 / z) * ((t / y) - y))
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-120) {
tmp = x + ((0.3333333333333333 / z) * ((t / y) - y));
} 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-120: tmp = x + ((0.3333333333333333 / z) * ((t / y) - y)) 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-120) tmp = Float64(x + Float64(Float64(0.3333333333333333 / z) * Float64(Float64(t / y) - y))); 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-120) tmp = x + ((0.3333333333333333 / z) * ((t / y) - y)); 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-120], N[(x + N[(N[(0.3333333333333333 / z), $MachinePrecision] * N[(N[(t / y), $MachinePrecision] - y), $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^{-120}:\\
\;\;\;\;x + \frac{0.3333333333333333}{z} \cdot \left(\frac{t}{y} - y\right)\\
\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)) < 9.99999999999999979e-121Initial program 91.7%
+-commutative91.7%
associate-+r-91.7%
+-commutative91.7%
associate--l+91.7%
sub-neg91.7%
remove-double-neg91.7%
distribute-frac-neg91.7%
distribute-neg-in91.7%
remove-double-neg91.7%
sub-neg91.7%
neg-mul-191.7%
times-frac97.5%
distribute-frac-neg97.5%
neg-mul-197.5%
*-commutative97.5%
associate-/l*97.5%
*-commutative97.5%
Simplified98.1%
if 9.99999999999999979e-121 < (*.f64 z #s(literal 3 binary64)) Initial program 99.7%
+-commutative99.7%
associate-+r-99.7%
sub-neg99.7%
associate-*l*99.8%
*-commutative99.8%
distribute-frac-neg299.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.9e+68) (not (<= y 2.45e-8))) (- x (/ (/ y 3.0) z)) (+ x (* 0.3333333333333333 (/ t (* z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.9e+68) || !(y <= 2.45e-8)) {
tmp = x - ((y / 3.0) / 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+68)) .or. (.not. (y <= 2.45d-8))) then
tmp = x - ((y / 3.0d0) / 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+68) || !(y <= 2.45e-8)) {
tmp = x - ((y / 3.0) / z);
} else {
tmp = x + (0.3333333333333333 * (t / (z * y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.9e+68) or not (y <= 2.45e-8): tmp = x - ((y / 3.0) / z) else: tmp = x + (0.3333333333333333 * (t / (z * y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.9e+68) || !(y <= 2.45e-8)) tmp = Float64(x - Float64(Float64(y / 3.0) / 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+68) || ~((y <= 2.45e-8))) tmp = x - ((y / 3.0) / 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+68], N[Not[LessEqual[y, 2.45e-8]], $MachinePrecision]], N[(x - N[(N[(y / 3.0), $MachinePrecision] / z), $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^{+68} \lor \neg \left(y \leq 2.45 \cdot 10^{-8}\right):\\
\;\;\;\;x - \frac{\frac{y}{3}}{z}\\
\mathbf{else}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{z \cdot y}\\
\end{array}
\end{array}
if y < -4.89999999999999978e68 or 2.4500000000000001e-8 < y Initial program 98.8%
+-commutative98.8%
associate-+r-98.8%
+-commutative98.8%
associate--l+98.8%
sub-neg98.8%
remove-double-neg98.8%
distribute-frac-neg98.8%
distribute-neg-in98.8%
remove-double-neg98.8%
sub-neg98.8%
neg-mul-198.8%
times-frac98.8%
distribute-frac-neg98.8%
neg-mul-198.8%
*-commutative98.8%
associate-/l*98.8%
*-commutative98.8%
Simplified99.8%
Taylor expanded in t around 0 96.7%
metadata-eval96.7%
cancel-sign-sub-inv96.7%
associate-*r/96.8%
Simplified96.8%
Taylor expanded in y around 0 96.7%
*-commutative96.7%
associate-*l/96.8%
associate-*r/96.8%
Simplified96.8%
metadata-eval96.8%
associate-/r*96.8%
*-commutative96.8%
div-inv96.8%
*-commutative96.8%
associate-/r*96.9%
Applied egg-rr96.9%
if -4.89999999999999978e68 < y < 2.4500000000000001e-8Initial program 91.3%
+-commutative91.3%
associate-+r-91.3%
+-commutative91.3%
associate--l+91.3%
sub-neg91.3%
remove-double-neg91.3%
distribute-frac-neg91.3%
distribute-neg-in91.3%
remove-double-neg91.3%
sub-neg91.3%
neg-mul-191.3%
times-frac93.9%
distribute-frac-neg93.9%
neg-mul-193.9%
*-commutative93.9%
associate-/l*93.9%
*-commutative93.9%
Simplified93.9%
Taylor expanded in t around inf 87.2%
Final simplification91.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.6e+91) (not (<= y 2.1e+20))) (- x (/ (/ y 3.0) z)) (+ x (* 0.3333333333333333 (/ (/ t z) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.6e+91) || !(y <= 2.1e+20)) {
tmp = x - ((y / 3.0) / 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 <= (-6.6d+91)) .or. (.not. (y <= 2.1d+20))) then
tmp = x - ((y / 3.0d0) / 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 <= -6.6e+91) || !(y <= 2.1e+20)) {
tmp = x - ((y / 3.0) / z);
} else {
tmp = x + (0.3333333333333333 * ((t / z) / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.6e+91) or not (y <= 2.1e+20): tmp = x - ((y / 3.0) / z) else: tmp = x + (0.3333333333333333 * ((t / z) / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.6e+91) || !(y <= 2.1e+20)) tmp = Float64(x - Float64(Float64(y / 3.0) / z)); else tmp = Float64(x + Float64(0.3333333333333333 * Float64(Float64(t / z) / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.6e+91) || ~((y <= 2.1e+20))) tmp = x - ((y / 3.0) / z); else tmp = x + (0.3333333333333333 * ((t / z) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.6e+91], N[Not[LessEqual[y, 2.1e+20]], $MachinePrecision]], N[(x - N[(N[(y / 3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(0.3333333333333333 * N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.6 \cdot 10^{+91} \lor \neg \left(y \leq 2.1 \cdot 10^{+20}\right):\\
\;\;\;\;x - \frac{\frac{y}{3}}{z}\\
\mathbf{else}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\
\end{array}
\end{array}
if y < -6.60000000000000034e91 or 2.1e20 < y Initial program 98.8%
+-commutative98.8%
associate-+r-98.8%
+-commutative98.8%
associate--l+98.8%
sub-neg98.8%
remove-double-neg98.8%
distribute-frac-neg98.8%
distribute-neg-in98.8%
remove-double-neg98.8%
sub-neg98.8%
neg-mul-198.8%
times-frac98.8%
distribute-frac-neg98.8%
neg-mul-198.8%
*-commutative98.8%
associate-/l*98.7%
*-commutative98.7%
Simplified99.7%
Taylor expanded in t around 0 98.3%
metadata-eval98.3%
cancel-sign-sub-inv98.3%
associate-*r/98.4%
Simplified98.4%
Taylor expanded in y around 0 98.3%
*-commutative98.3%
associate-*l/98.4%
associate-*r/98.4%
Simplified98.4%
metadata-eval98.4%
associate-/r*98.4%
*-commutative98.4%
div-inv98.4%
*-commutative98.4%
associate-/r*98.5%
Applied egg-rr98.5%
if -6.60000000000000034e91 < y < 2.1e20Initial program 91.7%
+-commutative91.7%
associate-+r-91.7%
+-commutative91.7%
associate--l+91.7%
sub-neg91.7%
remove-double-neg91.7%
distribute-frac-neg91.7%
distribute-neg-in91.7%
remove-double-neg91.7%
sub-neg91.7%
neg-mul-191.7%
times-frac94.2%
distribute-frac-neg94.2%
neg-mul-194.2%
*-commutative94.2%
associate-/l*94.3%
*-commutative94.3%
Simplified94.2%
Taylor expanded in t around inf 86.0%
*-commutative86.0%
metadata-eval86.0%
times-frac86.0%
*-commutative86.0%
associate-*r*86.0%
times-frac93.7%
*-commutative93.7%
associate-*l/93.8%
*-commutative93.8%
times-frac93.7%
metadata-eval93.7%
Simplified93.7%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.6e+91) (not (<= y 2.15e+20))) (- x (/ (/ y 3.0) z)) (+ x (/ (/ t z) (* 3.0 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.6e+91) || !(y <= 2.15e+20)) {
tmp = x - ((y / 3.0) / z);
} 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 <= (-6.6d+91)) .or. (.not. (y <= 2.15d+20))) then
tmp = x - ((y / 3.0d0) / z)
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 <= -6.6e+91) || !(y <= 2.15e+20)) {
tmp = x - ((y / 3.0) / z);
} else {
tmp = x + ((t / z) / (3.0 * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.6e+91) or not (y <= 2.15e+20): tmp = x - ((y / 3.0) / z) else: tmp = x + ((t / z) / (3.0 * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.6e+91) || !(y <= 2.15e+20)) tmp = Float64(x - Float64(Float64(y / 3.0) / z)); else tmp = Float64(x + Float64(Float64(t / z) / Float64(3.0 * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.6e+91) || ~((y <= 2.15e+20))) tmp = x - ((y / 3.0) / z); else tmp = x + ((t / z) / (3.0 * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.6e+91], N[Not[LessEqual[y, 2.15e+20]], $MachinePrecision]], N[(x - N[(N[(y / 3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t / z), $MachinePrecision] / N[(3.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.6 \cdot 10^{+91} \lor \neg \left(y \leq 2.15 \cdot 10^{+20}\right):\\
\;\;\;\;x - \frac{\frac{y}{3}}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{t}{z}}{3 \cdot y}\\
\end{array}
\end{array}
if y < -6.60000000000000034e91 or 2.15e20 < y Initial program 98.8%
+-commutative98.8%
associate-+r-98.8%
+-commutative98.8%
associate--l+98.8%
sub-neg98.8%
remove-double-neg98.8%
distribute-frac-neg98.8%
distribute-neg-in98.8%
remove-double-neg98.8%
sub-neg98.8%
neg-mul-198.8%
times-frac98.8%
distribute-frac-neg98.8%
neg-mul-198.8%
*-commutative98.8%
associate-/l*98.7%
*-commutative98.7%
Simplified99.7%
Taylor expanded in t around 0 98.3%
metadata-eval98.3%
cancel-sign-sub-inv98.3%
associate-*r/98.4%
Simplified98.4%
Taylor expanded in y around 0 98.3%
*-commutative98.3%
associate-*l/98.4%
associate-*r/98.4%
Simplified98.4%
metadata-eval98.4%
associate-/r*98.4%
*-commutative98.4%
div-inv98.4%
*-commutative98.4%
associate-/r*98.5%
Applied egg-rr98.5%
if -6.60000000000000034e91 < y < 2.15e20Initial program 91.7%
+-commutative91.7%
associate-+r-91.7%
+-commutative91.7%
associate--l+91.7%
sub-neg91.7%
remove-double-neg91.7%
distribute-frac-neg91.7%
distribute-neg-in91.7%
remove-double-neg91.7%
sub-neg91.7%
neg-mul-191.7%
times-frac94.2%
distribute-frac-neg94.2%
neg-mul-194.2%
*-commutative94.2%
associate-/l*94.3%
*-commutative94.3%
Simplified94.2%
Taylor expanded in t around inf 86.0%
*-commutative86.0%
metadata-eval86.0%
times-frac86.0%
*-commutative86.0%
associate-*r*86.0%
times-frac93.7%
*-commutative93.7%
associate-*l/93.8%
*-commutative93.8%
times-frac93.7%
metadata-eval93.7%
Simplified93.7%
metadata-eval93.7%
associate-/l/86.0%
associate-/r*88.5%
times-frac88.5%
*-commutative88.5%
frac-times88.5%
associate-/l/88.5%
associate-*l/93.8%
div-inv93.8%
*-commutative93.8%
Applied egg-rr93.8%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8.4e+68) (not (<= y 1.12e+23))) (* y (/ -0.3333333333333333 z)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8.4e+68) || !(y <= 1.12e+23)) {
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 <= (-8.4d+68)) .or. (.not. (y <= 1.12d+23))) 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 <= -8.4e+68) || !(y <= 1.12e+23)) {
tmp = y * (-0.3333333333333333 / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -8.4e+68) or not (y <= 1.12e+23): tmp = y * (-0.3333333333333333 / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -8.4e+68) || !(y <= 1.12e+23)) 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 <= -8.4e+68) || ~((y <= 1.12e+23))) tmp = y * (-0.3333333333333333 / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8.4e+68], N[Not[LessEqual[y, 1.12e+23]], $MachinePrecision]], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.4 \cdot 10^{+68} \lor \neg \left(y \leq 1.12 \cdot 10^{+23}\right):\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -8.40000000000000003e68 or 1.12e23 < y Initial program 98.8%
+-commutative98.8%
associate-+r-98.8%
+-commutative98.8%
associate--l+98.8%
sub-neg98.8%
remove-double-neg98.8%
distribute-frac-neg98.8%
distribute-neg-in98.8%
remove-double-neg98.8%
sub-neg98.8%
neg-mul-198.8%
times-frac98.8%
distribute-frac-neg98.8%
neg-mul-198.8%
*-commutative98.8%
associate-/l*98.7%
*-commutative98.7%
Simplified99.7%
Taylor expanded in t around 0 98.3%
metadata-eval98.3%
cancel-sign-sub-inv98.3%
associate-*r/98.4%
Simplified98.4%
Taylor expanded in y around 0 98.3%
*-commutative98.3%
associate-*l/98.4%
associate-*r/98.4%
Simplified98.4%
Taylor expanded in x around 0 81.4%
associate-*r/81.4%
*-commutative81.4%
associate-*r/81.5%
Simplified81.5%
if -8.40000000000000003e68 < y < 1.12e23Initial program 91.7%
+-commutative91.7%
associate-+r-91.7%
+-commutative91.7%
associate--l+91.7%
sub-neg91.7%
remove-double-neg91.7%
distribute-frac-neg91.7%
distribute-neg-in91.7%
remove-double-neg91.7%
sub-neg91.7%
neg-mul-191.7%
times-frac94.2%
distribute-frac-neg94.2%
neg-mul-194.2%
*-commutative94.2%
associate-/l*94.3%
*-commutative94.3%
Simplified94.2%
Taylor expanded in x around inf 32.4%
Final simplification52.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.3e+68) (not (<= y 1.46e+29))) (/ (/ y z) -3.0) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.3e+68) || !(y <= 1.46e+29)) {
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 ((y <= (-6.3d+68)) .or. (.not. (y <= 1.46d+29))) 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 ((y <= -6.3e+68) || !(y <= 1.46e+29)) {
tmp = (y / z) / -3.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.3e+68) or not (y <= 1.46e+29): tmp = (y / z) / -3.0 else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.3e+68) || !(y <= 1.46e+29)) tmp = Float64(Float64(y / z) / -3.0); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.3e+68) || ~((y <= 1.46e+29))) tmp = (y / z) / -3.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.3e+68], N[Not[LessEqual[y, 1.46e+29]], $MachinePrecision]], N[(N[(y / z), $MachinePrecision] / -3.0), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.3 \cdot 10^{+68} \lor \neg \left(y \leq 1.46 \cdot 10^{+29}\right):\\
\;\;\;\;\frac{\frac{y}{z}}{-3}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -6.30000000000000027e68 or 1.46e29 < y Initial program 98.8%
+-commutative98.8%
associate-+r-98.8%
+-commutative98.8%
associate--l+98.8%
sub-neg98.8%
remove-double-neg98.8%
distribute-frac-neg98.8%
distribute-neg-in98.8%
remove-double-neg98.8%
sub-neg98.8%
neg-mul-198.8%
times-frac98.8%
distribute-frac-neg98.8%
neg-mul-198.8%
*-commutative98.8%
associate-/l*98.7%
*-commutative98.7%
Simplified99.7%
Taylor expanded in t around 0 98.3%
metadata-eval98.3%
cancel-sign-sub-inv98.3%
associate-*r/98.4%
Simplified98.4%
Taylor expanded in y around 0 98.3%
*-commutative98.3%
associate-*l/98.4%
associate-*r/98.4%
Simplified98.4%
Taylor expanded in x around 0 81.4%
associate-*r/81.4%
*-commutative81.4%
associate-*r/81.5%
Simplified81.5%
metadata-eval81.5%
associate-/r*81.4%
*-commutative81.4%
div-inv81.5%
associate-/r*81.5%
Applied egg-rr81.5%
if -6.30000000000000027e68 < y < 1.46e29Initial program 91.7%
+-commutative91.7%
associate-+r-91.7%
+-commutative91.7%
associate--l+91.7%
sub-neg91.7%
remove-double-neg91.7%
distribute-frac-neg91.7%
distribute-neg-in91.7%
remove-double-neg91.7%
sub-neg91.7%
neg-mul-191.7%
times-frac94.2%
distribute-frac-neg94.2%
neg-mul-194.2%
*-commutative94.2%
associate-/l*94.3%
*-commutative94.3%
Simplified94.2%
Taylor expanded in x around inf 32.4%
Final simplification52.4%
(FPCore (x y z t) :precision binary64 (if (<= y -1.38e+69) (* y (/ -0.3333333333333333 z)) (if (<= y 9.2e+27) x (/ y (* z -3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.38e+69) {
tmp = y * (-0.3333333333333333 / z);
} else if (y <= 9.2e+27) {
tmp = x;
} else {
tmp = 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 (y <= (-1.38d+69)) then
tmp = y * ((-0.3333333333333333d0) / z)
else if (y <= 9.2d+27) then
tmp = x
else
tmp = 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 (y <= -1.38e+69) {
tmp = y * (-0.3333333333333333 / z);
} else if (y <= 9.2e+27) {
tmp = x;
} else {
tmp = y / (z * -3.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.38e+69: tmp = y * (-0.3333333333333333 / z) elif y <= 9.2e+27: tmp = x else: tmp = y / (z * -3.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.38e+69) tmp = Float64(y * Float64(-0.3333333333333333 / z)); elseif (y <= 9.2e+27) tmp = x; else tmp = Float64(y / Float64(z * -3.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.38e+69) tmp = y * (-0.3333333333333333 / z); elseif (y <= 9.2e+27) tmp = x; else tmp = y / (z * -3.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.38e+69], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.2e+27], x, N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.38 \cdot 10^{+69}:\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{+27}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot -3}\\
\end{array}
\end{array}
if y < -1.37999999999999999e69Initial program 99.8%
+-commutative99.8%
associate-+r-99.8%
+-commutative99.8%
associate--l+99.8%
sub-neg99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
sub-neg99.8%
neg-mul-199.8%
times-frac99.8%
distribute-frac-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-/l*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 99.7%
metadata-eval99.7%
cancel-sign-sub-inv99.7%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 99.7%
*-commutative99.7%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in x around 0 81.7%
associate-*r/81.7%
*-commutative81.7%
associate-*r/81.8%
Simplified81.8%
if -1.37999999999999999e69 < y < 9.2000000000000002e27Initial program 91.7%
+-commutative91.7%
associate-+r-91.7%
+-commutative91.7%
associate--l+91.7%
sub-neg91.7%
remove-double-neg91.7%
distribute-frac-neg91.7%
distribute-neg-in91.7%
remove-double-neg91.7%
sub-neg91.7%
neg-mul-191.7%
times-frac94.2%
distribute-frac-neg94.2%
neg-mul-194.2%
*-commutative94.2%
associate-/l*94.3%
*-commutative94.3%
Simplified94.2%
Taylor expanded in x around inf 32.4%
if 9.2000000000000002e27 < y Initial program 98.0%
+-commutative98.0%
associate-+r-98.0%
+-commutative98.0%
associate--l+98.0%
sub-neg98.0%
remove-double-neg98.0%
distribute-frac-neg98.0%
distribute-neg-in98.0%
remove-double-neg98.0%
sub-neg98.0%
neg-mul-198.0%
times-frac98.0%
distribute-frac-neg98.0%
neg-mul-198.0%
*-commutative98.0%
associate-/l*98.0%
*-commutative98.0%
Simplified99.7%
Taylor expanded in t around 0 97.3%
metadata-eval97.3%
cancel-sign-sub-inv97.3%
associate-*r/97.4%
Simplified97.4%
Taylor expanded in y around 0 97.3%
*-commutative97.3%
associate-*l/97.4%
associate-*r/97.5%
Simplified97.5%
Taylor expanded in x around 0 81.1%
associate-*r/81.3%
*-commutative81.3%
associate-*r/81.3%
Simplified81.3%
metadata-eval81.3%
associate-/r*81.3%
*-commutative81.3%
div-inv81.3%
Applied egg-rr81.3%
Final simplification52.3%
(FPCore (x y z t) :precision binary64 (+ x (* (/ 0.3333333333333333 z) (- (/ t y) y))))
double code(double x, double y, double z, double t) {
return x + ((0.3333333333333333 / z) * ((t / y) - 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 + ((0.3333333333333333d0 / z) * ((t / y) - y))
end function
public static double code(double x, double y, double z, double t) {
return x + ((0.3333333333333333 / z) * ((t / y) - y));
}
def code(x, y, z, t): return x + ((0.3333333333333333 / z) * ((t / y) - y))
function code(x, y, z, t) return Float64(x + Float64(Float64(0.3333333333333333 / z) * Float64(Float64(t / y) - y))) end
function tmp = code(x, y, z, t) tmp = x + ((0.3333333333333333 / z) * ((t / y) - y)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(0.3333333333333333 / z), $MachinePrecision] * N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{0.3333333333333333}{z} \cdot \left(\frac{t}{y} - y\right)
\end{array}
Initial program 94.6%
+-commutative94.6%
associate-+r-94.6%
+-commutative94.6%
associate--l+94.6%
sub-neg94.6%
remove-double-neg94.6%
distribute-frac-neg94.6%
distribute-neg-in94.6%
remove-double-neg94.6%
sub-neg94.6%
neg-mul-194.6%
times-frac96.1%
distribute-frac-neg96.1%
neg-mul-196.1%
*-commutative96.1%
associate-/l*96.1%
*-commutative96.1%
Simplified96.5%
Final simplification96.5%
(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 94.6%
+-commutative94.6%
associate-+r-94.6%
+-commutative94.6%
associate--l+94.6%
sub-neg94.6%
remove-double-neg94.6%
distribute-frac-neg94.6%
distribute-neg-in94.6%
remove-double-neg94.6%
sub-neg94.6%
neg-mul-194.6%
times-frac96.1%
distribute-frac-neg96.1%
neg-mul-196.1%
*-commutative96.1%
associate-/l*96.1%
*-commutative96.1%
Simplified96.5%
Taylor expanded in t around 0 62.0%
metadata-eval62.0%
distribute-lft-neg-in62.0%
*-commutative62.0%
associate-*l/62.0%
associate-*r/62.0%
distribute-rgt-neg-out62.0%
distribute-neg-frac62.0%
metadata-eval62.0%
Simplified62.0%
Final simplification62.0%
(FPCore (x y z t) :precision binary64 (- x (/ (/ y 3.0) z)))
double code(double x, double y, double z, double t) {
return x - ((y / 3.0) / 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 / 3.0d0) / z)
end function
public static double code(double x, double y, double z, double t) {
return x - ((y / 3.0) / z);
}
def code(x, y, z, t): return x - ((y / 3.0) / z)
function code(x, y, z, t) return Float64(x - Float64(Float64(y / 3.0) / z)) end
function tmp = code(x, y, z, t) tmp = x - ((y / 3.0) / z); end
code[x_, y_, z_, t_] := N[(x - N[(N[(y / 3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{\frac{y}{3}}{z}
\end{array}
Initial program 94.6%
+-commutative94.6%
associate-+r-94.6%
+-commutative94.6%
associate--l+94.6%
sub-neg94.6%
remove-double-neg94.6%
distribute-frac-neg94.6%
distribute-neg-in94.6%
remove-double-neg94.6%
sub-neg94.6%
neg-mul-194.6%
times-frac96.1%
distribute-frac-neg96.1%
neg-mul-196.1%
*-commutative96.1%
associate-/l*96.1%
*-commutative96.1%
Simplified96.5%
Taylor expanded in t around 0 62.0%
metadata-eval62.0%
cancel-sign-sub-inv62.0%
associate-*r/62.0%
Simplified62.0%
Taylor expanded in y around 0 62.0%
*-commutative62.0%
associate-*l/62.0%
associate-*r/62.0%
Simplified62.0%
metadata-eval62.0%
associate-/r*62.0%
*-commutative62.0%
div-inv62.0%
*-commutative62.0%
associate-/r*62.1%
Applied egg-rr62.1%
Final simplification62.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 94.6%
+-commutative94.6%
associate-+r-94.6%
+-commutative94.6%
associate--l+94.6%
sub-neg94.6%
remove-double-neg94.6%
distribute-frac-neg94.6%
distribute-neg-in94.6%
remove-double-neg94.6%
sub-neg94.6%
neg-mul-194.6%
times-frac96.1%
distribute-frac-neg96.1%
neg-mul-196.1%
*-commutative96.1%
associate-/l*96.1%
*-commutative96.1%
Simplified96.5%
Taylor expanded in x around inf 27.1%
Final simplification27.1%
(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 2024071
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:alt
(+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))