
(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 (or (<= (* z 3.0) -1000000000000.0) (not (<= (* z 3.0) 1e-37))) (+ x (+ (/ t (* z (* y 3.0))) (/ (/ y -3.0) z))) (+ x (/ (- (/ t y) y) (* z 3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z * 3.0) <= -1000000000000.0) || !((z * 3.0) <= 1e-37)) {
tmp = x + ((t / (z * (y * 3.0))) + ((y / -3.0) / z));
} else {
tmp = x + (((t / 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) <= (-1000000000000.0d0)) .or. (.not. ((z * 3.0d0) <= 1d-37))) then
tmp = x + ((t / (z * (y * 3.0d0))) + ((y / (-3.0d0)) / z))
else
tmp = x + (((t / 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) <= -1000000000000.0) || !((z * 3.0) <= 1e-37)) {
tmp = x + ((t / (z * (y * 3.0))) + ((y / -3.0) / z));
} else {
tmp = x + (((t / y) - y) / (z * 3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z * 3.0) <= -1000000000000.0) or not ((z * 3.0) <= 1e-37): tmp = x + ((t / (z * (y * 3.0))) + ((y / -3.0) / z)) else: tmp = x + (((t / y) - y) / (z * 3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z * 3.0) <= -1000000000000.0) || !(Float64(z * 3.0) <= 1e-37)) tmp = Float64(x + Float64(Float64(t / Float64(z * Float64(y * 3.0))) + Float64(Float64(y / -3.0) / z))); else tmp = Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z * 3.0) <= -1000000000000.0) || ~(((z * 3.0) <= 1e-37))) tmp = x + ((t / (z * (y * 3.0))) + ((y / -3.0) / z)); else tmp = x + (((t / y) - y) / (z * 3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z * 3.0), $MachinePrecision], -1000000000000.0], N[Not[LessEqual[N[(z * 3.0), $MachinePrecision], 1e-37]], $MachinePrecision]], N[(x + N[(N[(t / N[(z * N[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y / -3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq -1000000000000 \lor \neg \left(z \cdot 3 \leq 10^{-37}\right):\\
\;\;\;\;x + \left(\frac{t}{z \cdot \left(y \cdot 3\right)} + \frac{\frac{y}{-3}}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{t}{y} - y}{z \cdot 3}\\
\end{array}
\end{array}
if (*.f64 z 3) < -1e12 or 1.00000000000000007e-37 < (*.f64 z 3) Initial 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%
fma-undefine99.8%
metadata-eval99.8%
times-frac99.9%
*-un-lft-identity99.9%
associate-/r*99.9%
Applied egg-rr99.9%
if -1e12 < (*.f64 z 3) < 1.00000000000000007e-37Initial program 89.9%
+-commutative89.9%
associate-+r-89.9%
+-commutative89.9%
associate--l+89.9%
sub-neg89.9%
remove-double-neg89.9%
distribute-frac-neg89.9%
distribute-neg-in89.9%
remove-double-neg89.9%
sub-neg89.9%
neg-mul-189.9%
times-frac99.0%
distribute-frac-neg99.0%
neg-mul-199.0%
*-commutative99.0%
associate-/l*99.0%
*-commutative99.0%
Simplified99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.8%
div-inv99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (<= (+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0)))) (- INFINITY)) (+ x (* (/ 0.3333333333333333 z) (- (/ t y) y))) (+ (+ x (/ t (* z (* y 3.0)))) (/ y (* z -3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x - (y / (z * 3.0))) + (t / (y * (z * 3.0)))) <= -((double) INFINITY)) {
tmp = x + ((0.3333333333333333 / z) * ((t / y) - y));
} else {
tmp = (x + (t / (z * (y * 3.0)))) + (y / (z * -3.0));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x - (y / (z * 3.0))) + (t / (y * (z * 3.0)))) <= -Double.POSITIVE_INFINITY) {
tmp = x + ((0.3333333333333333 / z) * ((t / y) - y));
} else {
tmp = (x + (t / (z * (y * 3.0)))) + (y / (z * -3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x - (y / (z * 3.0))) + (t / (y * (z * 3.0)))) <= -math.inf: tmp = x + ((0.3333333333333333 / z) * ((t / y) - y)) else: tmp = (x + (t / (z * (y * 3.0)))) + (y / (z * -3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(y * Float64(z * 3.0)))) <= Float64(-Inf)) tmp = Float64(x + Float64(Float64(0.3333333333333333 / z) * Float64(Float64(t / y) - y))); else tmp = Float64(Float64(x + Float64(t / Float64(z * Float64(y * 3.0)))) + Float64(y / Float64(z * -3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x - (y / (z * 3.0))) + (t / (y * (z * 3.0)))) <= -Inf) tmp = x + ((0.3333333333333333 / z) * ((t / y) - y)); else tmp = (x + (t / (z * (y * 3.0)))) + (y / (z * -3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-Infinity)], 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[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)} \leq -\infty:\\
\;\;\;\;x + \frac{0.3333333333333333}{z} \cdot \left(\frac{t}{y} - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + \frac{t}{z \cdot \left(y \cdot 3\right)}\right) + \frac{y}{z \cdot -3}\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < -inf.0Initial program 82.8%
+-commutative82.8%
associate-+r-82.8%
+-commutative82.8%
associate--l+82.8%
sub-neg82.8%
remove-double-neg82.8%
distribute-frac-neg82.8%
distribute-neg-in82.8%
remove-double-neg82.8%
sub-neg82.8%
neg-mul-182.8%
times-frac99.9%
distribute-frac-neg99.9%
neg-mul-199.9%
*-commutative99.9%
associate-/l*99.9%
*-commutative99.9%
Simplified99.9%
if -inf.0 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) Initial program 98.0%
+-commutative98.0%
associate-+r-98.0%
sub-neg98.0%
associate-*l*98.0%
*-commutative98.0%
distribute-frac-neg298.0%
distribute-rgt-neg-in98.0%
metadata-eval98.0%
Simplified98.0%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -3.4e+77)
(+ x (/ y (* z -3.0)))
(if (<= y 3.1e-7)
(+ x (* 0.3333333333333333 (/ t (* y z))))
(+ x (/ (/ y z) -3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.4e+77) {
tmp = x + (y / (z * -3.0));
} else if (y <= 3.1e-7) {
tmp = x + (0.3333333333333333 * (t / (y * z)));
} else {
tmp = x + ((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 <= (-3.4d+77)) then
tmp = x + (y / (z * (-3.0d0)))
else if (y <= 3.1d-7) then
tmp = x + (0.3333333333333333d0 * (t / (y * z)))
else
tmp = x + ((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 <= -3.4e+77) {
tmp = x + (y / (z * -3.0));
} else if (y <= 3.1e-7) {
tmp = x + (0.3333333333333333 * (t / (y * z)));
} else {
tmp = x + ((y / z) / -3.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.4e+77: tmp = x + (y / (z * -3.0)) elif y <= 3.1e-7: tmp = x + (0.3333333333333333 * (t / (y * z))) else: tmp = x + ((y / z) / -3.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.4e+77) tmp = Float64(x + Float64(y / Float64(z * -3.0))); elseif (y <= 3.1e-7) tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(y * z)))); else tmp = Float64(x + Float64(Float64(y / z) / -3.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.4e+77) tmp = x + (y / (z * -3.0)); elseif (y <= 3.1e-7) tmp = x + (0.3333333333333333 * (t / (y * z))); else tmp = x + ((y / z) / -3.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.4e+77], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e-7], N[(x + N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / z), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+77}:\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-7}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{y}{z}}{-3}\\
\end{array}
\end{array}
if y < -3.39999999999999997e77Initial program 99.9%
+-commutative99.9%
associate-+r-99.9%
+-commutative99.9%
associate--l+99.9%
sub-neg99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
neg-mul-199.9%
times-frac99.9%
distribute-frac-neg99.9%
neg-mul-199.9%
*-commutative99.9%
associate-/l*99.9%
*-commutative99.9%
Simplified99.7%
Taylor expanded in t around 0 99.7%
metadata-eval99.7%
times-frac99.9%
*-commutative99.9%
associate-/l*99.9%
neg-mul-199.9%
distribute-frac-neg299.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Applied egg-rr99.9%
if -3.39999999999999997e77 < y < 3.1e-7Initial 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-frac92.3%
distribute-frac-neg92.3%
neg-mul-192.3%
*-commutative92.3%
associate-/l*92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in t around inf 87.7%
if 3.1e-7 < y Initial program 98.4%
+-commutative98.4%
associate-+r-98.4%
+-commutative98.4%
associate--l+98.4%
sub-neg98.4%
remove-double-neg98.4%
distribute-frac-neg98.4%
distribute-neg-in98.4%
remove-double-neg98.4%
sub-neg98.4%
neg-mul-198.4%
times-frac98.4%
distribute-frac-neg98.4%
neg-mul-198.4%
*-commutative98.4%
associate-/l*98.3%
*-commutative98.3%
Simplified99.7%
Taylor expanded in t around 0 94.1%
metadata-eval94.1%
times-frac94.1%
neg-mul-194.1%
associate-/l/94.2%
frac-2neg94.2%
distribute-frac-neg294.2%
frac-2neg94.2%
metadata-eval94.2%
Applied egg-rr94.2%
Final simplification91.8%
(FPCore (x y z t)
:precision binary64
(if (<= y -3.4e+77)
(+ x (/ y (* z -3.0)))
(if (<= y 110.0)
(+ x (* (/ 0.3333333333333333 z) (/ t y)))
(+ x (/ (/ y z) -3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.4e+77) {
tmp = x + (y / (z * -3.0));
} else if (y <= 110.0) {
tmp = x + ((0.3333333333333333 / z) * (t / y));
} else {
tmp = x + ((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 <= (-3.4d+77)) then
tmp = x + (y / (z * (-3.0d0)))
else if (y <= 110.0d0) then
tmp = x + ((0.3333333333333333d0 / z) * (t / y))
else
tmp = x + ((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 <= -3.4e+77) {
tmp = x + (y / (z * -3.0));
} else if (y <= 110.0) {
tmp = x + ((0.3333333333333333 / z) * (t / y));
} else {
tmp = x + ((y / z) / -3.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.4e+77: tmp = x + (y / (z * -3.0)) elif y <= 110.0: tmp = x + ((0.3333333333333333 / z) * (t / y)) else: tmp = x + ((y / z) / -3.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.4e+77) tmp = Float64(x + Float64(y / Float64(z * -3.0))); elseif (y <= 110.0) tmp = Float64(x + Float64(Float64(0.3333333333333333 / z) * Float64(t / y))); else tmp = Float64(x + Float64(Float64(y / z) / -3.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.4e+77) tmp = x + (y / (z * -3.0)); elseif (y <= 110.0) tmp = x + ((0.3333333333333333 / z) * (t / y)); else tmp = x + ((y / z) / -3.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.4e+77], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 110.0], N[(x + N[(N[(0.3333333333333333 / z), $MachinePrecision] * N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / z), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+77}:\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{elif}\;y \leq 110:\\
\;\;\;\;x + \frac{0.3333333333333333}{z} \cdot \frac{t}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{y}{z}}{-3}\\
\end{array}
\end{array}
if y < -3.39999999999999997e77Initial program 99.9%
+-commutative99.9%
associate-+r-99.9%
+-commutative99.9%
associate--l+99.9%
sub-neg99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
neg-mul-199.9%
times-frac99.9%
distribute-frac-neg99.9%
neg-mul-199.9%
*-commutative99.9%
associate-/l*99.9%
*-commutative99.9%
Simplified99.7%
Taylor expanded in t around 0 99.7%
metadata-eval99.7%
times-frac99.9%
*-commutative99.9%
associate-/l*99.9%
neg-mul-199.9%
distribute-frac-neg299.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Applied egg-rr99.9%
if -3.39999999999999997e77 < y < 110Initial 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-frac92.3%
distribute-frac-neg92.3%
neg-mul-192.3%
*-commutative92.3%
associate-/l*92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in t around inf 88.3%
if 110 < y Initial program 98.4%
+-commutative98.4%
associate-+r-98.4%
+-commutative98.4%
associate--l+98.4%
sub-neg98.4%
remove-double-neg98.4%
distribute-frac-neg98.4%
distribute-neg-in98.4%
remove-double-neg98.4%
sub-neg98.4%
neg-mul-198.4%
times-frac98.4%
distribute-frac-neg98.4%
neg-mul-198.4%
*-commutative98.4%
associate-/l*98.3%
*-commutative98.3%
Simplified99.7%
Taylor expanded in t around 0 94.1%
metadata-eval94.1%
times-frac94.1%
neg-mul-194.1%
associate-/l/94.2%
frac-2neg94.2%
distribute-frac-neg294.2%
frac-2neg94.2%
metadata-eval94.2%
Applied egg-rr94.2%
Final simplification92.1%
(FPCore (x y z t)
:precision binary64
(if (<= y -3.4e+77)
(+ x (/ y (* z -3.0)))
(if (<= y 3e-8)
(+ x (* (/ t z) (/ 0.3333333333333333 y)))
(+ x (/ (/ y z) -3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.4e+77) {
tmp = x + (y / (z * -3.0));
} else if (y <= 3e-8) {
tmp = x + ((t / z) * (0.3333333333333333 / y));
} else {
tmp = x + ((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 <= (-3.4d+77)) then
tmp = x + (y / (z * (-3.0d0)))
else if (y <= 3d-8) then
tmp = x + ((t / z) * (0.3333333333333333d0 / y))
else
tmp = x + ((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 <= -3.4e+77) {
tmp = x + (y / (z * -3.0));
} else if (y <= 3e-8) {
tmp = x + ((t / z) * (0.3333333333333333 / y));
} else {
tmp = x + ((y / z) / -3.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.4e+77: tmp = x + (y / (z * -3.0)) elif y <= 3e-8: tmp = x + ((t / z) * (0.3333333333333333 / y)) else: tmp = x + ((y / z) / -3.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.4e+77) tmp = Float64(x + Float64(y / Float64(z * -3.0))); elseif (y <= 3e-8) tmp = Float64(x + Float64(Float64(t / z) * Float64(0.3333333333333333 / y))); else tmp = Float64(x + Float64(Float64(y / z) / -3.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.4e+77) tmp = x + (y / (z * -3.0)); elseif (y <= 3e-8) tmp = x + ((t / z) * (0.3333333333333333 / y)); else tmp = x + ((y / z) / -3.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.4e+77], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e-8], N[(x + N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / z), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+77}:\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-8}:\\
\;\;\;\;x + \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{y}{z}}{-3}\\
\end{array}
\end{array}
if y < -3.39999999999999997e77Initial program 99.9%
+-commutative99.9%
associate-+r-99.9%
+-commutative99.9%
associate--l+99.9%
sub-neg99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
neg-mul-199.9%
times-frac99.9%
distribute-frac-neg99.9%
neg-mul-199.9%
*-commutative99.9%
associate-/l*99.9%
*-commutative99.9%
Simplified99.7%
Taylor expanded in t around 0 99.7%
metadata-eval99.7%
times-frac99.9%
*-commutative99.9%
associate-/l*99.9%
neg-mul-199.9%
distribute-frac-neg299.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Applied egg-rr99.9%
if -3.39999999999999997e77 < y < 2.99999999999999973e-8Initial 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-frac92.3%
distribute-frac-neg92.3%
neg-mul-192.3%
*-commutative92.3%
associate-/l*92.3%
*-commutative92.3%
Simplified92.3%
*-commutative92.3%
clear-num92.3%
un-div-inv92.3%
div-inv92.3%
metadata-eval92.3%
Applied egg-rr92.3%
*-un-lft-identity92.3%
times-frac92.3%
Applied egg-rr92.3%
Taylor expanded in t around inf 87.7%
associate-*r/87.7%
*-commutative87.7%
*-commutative87.7%
times-frac93.8%
Simplified93.8%
if 2.99999999999999973e-8 < y Initial program 98.4%
+-commutative98.4%
associate-+r-98.4%
+-commutative98.4%
associate--l+98.4%
sub-neg98.4%
remove-double-neg98.4%
distribute-frac-neg98.4%
distribute-neg-in98.4%
remove-double-neg98.4%
sub-neg98.4%
neg-mul-198.4%
times-frac98.4%
distribute-frac-neg98.4%
neg-mul-198.4%
*-commutative98.4%
associate-/l*98.3%
*-commutative98.3%
Simplified99.7%
Taylor expanded in t around 0 94.1%
metadata-eval94.1%
times-frac94.1%
neg-mul-194.1%
associate-/l/94.2%
frac-2neg94.2%
distribute-frac-neg294.2%
frac-2neg94.2%
metadata-eval94.2%
Applied egg-rr94.2%
Final simplification95.1%
(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 95.1%
+-commutative95.1%
associate-+r-95.1%
+-commutative95.1%
associate--l+95.1%
sub-neg95.1%
remove-double-neg95.1%
distribute-frac-neg95.1%
distribute-neg-in95.1%
remove-double-neg95.1%
sub-neg95.1%
neg-mul-195.1%
times-frac95.4%
distribute-frac-neg95.4%
neg-mul-195.4%
*-commutative95.4%
associate-/l*95.4%
*-commutative95.4%
Simplified95.7%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (+ x (/ (- (/ t y) y) (* z 3.0))))
double code(double x, double y, double z, double t) {
return x + (((t / y) - 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 + (((t / y) - y) / (z * 3.0d0))
end function
public static double code(double x, double y, double z, double t) {
return x + (((t / y) - y) / (z * 3.0));
}
def code(x, y, z, t): return x + (((t / y) - y) / (z * 3.0))
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0))) end
function tmp = code(x, y, z, t) tmp = x + (((t / y) - y) / (z * 3.0)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\frac{t}{y} - y}{z \cdot 3}
\end{array}
Initial program 95.1%
+-commutative95.1%
associate-+r-95.1%
+-commutative95.1%
associate--l+95.1%
sub-neg95.1%
remove-double-neg95.1%
distribute-frac-neg95.1%
distribute-neg-in95.1%
remove-double-neg95.1%
sub-neg95.1%
neg-mul-195.1%
times-frac95.4%
distribute-frac-neg95.4%
neg-mul-195.4%
*-commutative95.4%
associate-/l*95.4%
*-commutative95.4%
Simplified95.7%
*-commutative95.7%
clear-num95.7%
un-div-inv95.7%
div-inv95.8%
metadata-eval95.8%
Applied egg-rr95.8%
Final simplification95.8%
(FPCore (x y z t) :precision binary64 (+ x (* (/ y z) -0.3333333333333333)))
double code(double x, double y, double z, double t) {
return x + ((y / z) * -0.3333333333333333);
}
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) * (-0.3333333333333333d0))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y / z) * -0.3333333333333333);
}
def code(x, y, z, t): return x + ((y / z) * -0.3333333333333333)
function code(x, y, z, t) return Float64(x + Float64(Float64(y / z) * -0.3333333333333333)) end
function tmp = code(x, y, z, t) tmp = x + ((y / z) * -0.3333333333333333); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / z), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{z} \cdot -0.3333333333333333
\end{array}
Initial program 95.1%
+-commutative95.1%
associate-+r-95.1%
+-commutative95.1%
associate--l+95.1%
sub-neg95.1%
remove-double-neg95.1%
distribute-frac-neg95.1%
distribute-neg-in95.1%
remove-double-neg95.1%
sub-neg95.1%
neg-mul-195.1%
times-frac95.4%
distribute-frac-neg95.4%
neg-mul-195.4%
*-commutative95.4%
associate-/l*95.4%
*-commutative95.4%
Simplified95.7%
Taylor expanded in t around 0 66.7%
Final simplification66.7%
(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 95.1%
+-commutative95.1%
associate-+r-95.1%
+-commutative95.1%
associate--l+95.1%
sub-neg95.1%
remove-double-neg95.1%
distribute-frac-neg95.1%
distribute-neg-in95.1%
remove-double-neg95.1%
sub-neg95.1%
neg-mul-195.1%
times-frac95.4%
distribute-frac-neg95.4%
neg-mul-195.4%
*-commutative95.4%
associate-/l*95.4%
*-commutative95.4%
Simplified95.7%
Taylor expanded in t around 0 66.7%
metadata-eval66.7%
times-frac66.7%
*-commutative66.7%
associate-/l*66.7%
neg-mul-166.7%
distribute-frac-neg266.7%
distribute-rgt-neg-in66.7%
metadata-eval66.7%
Applied egg-rr66.7%
Final simplification66.7%
(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(Float64(y / 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[(N[(y / z), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\frac{y}{z}}{-3}
\end{array}
Initial program 95.1%
+-commutative95.1%
associate-+r-95.1%
+-commutative95.1%
associate--l+95.1%
sub-neg95.1%
remove-double-neg95.1%
distribute-frac-neg95.1%
distribute-neg-in95.1%
remove-double-neg95.1%
sub-neg95.1%
neg-mul-195.1%
times-frac95.4%
distribute-frac-neg95.4%
neg-mul-195.4%
*-commutative95.4%
associate-/l*95.4%
*-commutative95.4%
Simplified95.7%
Taylor expanded in t around 0 66.7%
metadata-eval66.7%
times-frac66.7%
neg-mul-166.7%
associate-/l/66.7%
frac-2neg66.7%
distribute-frac-neg266.7%
frac-2neg66.7%
metadata-eval66.7%
Applied egg-rr66.7%
Final simplification66.7%
(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 95.1%
+-commutative95.1%
associate-+r-95.1%
sub-neg95.1%
associate-*l*95.1%
*-commutative95.1%
distribute-frac-neg295.1%
distribute-rgt-neg-in95.1%
metadata-eval95.1%
Simplified95.1%
Taylor expanded in z around inf 36.7%
Final simplification36.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 2024050
(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))))