
(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 9 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) -5e+14) (not (<= (* z 3.0) 1e-62))) (+ (+ x (/ t (* z (* y 3.0)))) (/ y (* z -3.0))) (+ x (/ (- (/ t y) y) (* z 3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z * 3.0) <= -5e+14) || !((z * 3.0) <= 1e-62)) {
tmp = (x + (t / (z * (y * 3.0)))) + (y / (z * -3.0));
} 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) <= (-5d+14)) .or. (.not. ((z * 3.0d0) <= 1d-62))) then
tmp = (x + (t / (z * (y * 3.0d0)))) + (y / (z * (-3.0d0)))
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) <= -5e+14) || !((z * 3.0) <= 1e-62)) {
tmp = (x + (t / (z * (y * 3.0)))) + (y / (z * -3.0));
} else {
tmp = x + (((t / y) - y) / (z * 3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z * 3.0) <= -5e+14) or not ((z * 3.0) <= 1e-62): tmp = (x + (t / (z * (y * 3.0)))) + (y / (z * -3.0)) 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) <= -5e+14) || !(Float64(z * 3.0) <= 1e-62)) tmp = Float64(Float64(x + Float64(t / Float64(z * Float64(y * 3.0)))) + Float64(y / Float64(z * -3.0))); 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) <= -5e+14) || ~(((z * 3.0) <= 1e-62))) tmp = (x + (t / (z * (y * 3.0)))) + (y / (z * -3.0)); 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], -5e+14], N[Not[LessEqual[N[(z * 3.0), $MachinePrecision], 1e-62]], $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], 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 -5 \cdot 10^{+14} \lor \neg \left(z \cdot 3 \leq 10^{-62}\right):\\
\;\;\;\;\left(x + \frac{t}{z \cdot \left(y \cdot 3\right)}\right) + \frac{y}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{t}{y} - y}{z \cdot 3}\\
\end{array}
\end{array}
if (*.f64 z #s(literal 3 binary64)) < -5e14 or 1e-62 < (*.f64 z #s(literal 3 binary64)) Initial program 99.8%
+-commutative99.8%
associate-+r-99.8%
sub-neg99.8%
associate-*l*99.8%
*-commutative99.8%
distribute-frac-neg299.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
if -5e14 < (*.f64 z #s(literal 3 binary64)) < 1e-62Initial program 89.4%
+-commutative89.4%
associate-+r-89.4%
+-commutative89.4%
associate--l+89.4%
sub-neg89.4%
remove-double-neg89.4%
distribute-frac-neg89.4%
distribute-neg-in89.4%
remove-double-neg89.4%
sub-neg89.4%
neg-mul-189.4%
times-frac99.0%
distribute-frac-neg99.0%
neg-mul-199.0%
*-commutative99.0%
associate-/l*98.0%
*-commutative98.0%
Simplified99.9%
*-commutative99.9%
clear-num99.9%
div-inv99.9%
metadata-eval99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))))
(if (<= t_1 (- INFINITY))
(+ x (/ (* 0.3333333333333333 (- (/ t y) y)) z))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + ((0.3333333333333333 * ((t / y) - y)) / z);
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = x + ((0.3333333333333333 * ((t / y) - y)) / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0))) tmp = 0 if t_1 <= -math.inf: tmp = x + ((0.3333333333333333 * ((t / y) - y)) / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(y * Float64(z * 3.0)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(x + Float64(Float64(0.3333333333333333 * Float64(Float64(t / y) - y)) / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0))); tmp = 0.0; if (t_1 <= -Inf) tmp = x + ((0.3333333333333333 * ((t / y) - y)) / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[(N[(0.3333333333333333 * N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x + \frac{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) < -inf.0Initial program 76.8%
+-commutative76.8%
associate-+r-76.8%
+-commutative76.8%
associate--l+76.8%
sub-neg76.8%
remove-double-neg76.8%
distribute-frac-neg76.8%
distribute-neg-in76.8%
remove-double-neg76.8%
sub-neg76.8%
neg-mul-176.8%
times-frac99.9%
distribute-frac-neg99.9%
neg-mul-199.9%
*-commutative99.9%
associate-/l*97.5%
*-commutative97.5%
Simplified99.9%
associate-*l/100.0%
Applied egg-rr100.0%
if -inf.0 < (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) Initial program 98.9%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1e-44) (not (<= y 1.4e-87))) (+ x (/ (- (/ t y) y) (* z 3.0))) (+ x (/ (/ (* t 0.3333333333333333) z) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1e-44) || !(y <= 1.4e-87)) {
tmp = x + (((t / y) - y) / (z * 3.0));
} else {
tmp = x + (((t * 0.3333333333333333) / 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 <= (-1d-44)) .or. (.not. (y <= 1.4d-87))) then
tmp = x + (((t / y) - y) / (z * 3.0d0))
else
tmp = x + (((t * 0.3333333333333333d0) / z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1e-44) || !(y <= 1.4e-87)) {
tmp = x + (((t / y) - y) / (z * 3.0));
} else {
tmp = x + (((t * 0.3333333333333333) / z) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1e-44) or not (y <= 1.4e-87): tmp = x + (((t / y) - y) / (z * 3.0)) else: tmp = x + (((t * 0.3333333333333333) / z) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1e-44) || !(y <= 1.4e-87)) tmp = Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0))); else tmp = Float64(x + Float64(Float64(Float64(t * 0.3333333333333333) / z) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1e-44) || ~((y <= 1.4e-87))) tmp = x + (((t / y) - y) / (z * 3.0)); else tmp = x + (((t * 0.3333333333333333) / z) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1e-44], N[Not[LessEqual[y, 1.4e-87]], $MachinePrecision]], N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t * 0.3333333333333333), $MachinePrecision] / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-44} \lor \neg \left(y \leq 1.4 \cdot 10^{-87}\right):\\
\;\;\;\;x + \frac{\frac{t}{y} - y}{z \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\
\end{array}
\end{array}
if y < -9.99999999999999953e-45 or 1.4e-87 < y Initial program 98.1%
+-commutative98.1%
associate-+r-98.1%
+-commutative98.1%
associate--l+98.1%
sub-neg98.1%
remove-double-neg98.1%
distribute-frac-neg98.1%
distribute-neg-in98.1%
remove-double-neg98.1%
sub-neg98.1%
neg-mul-198.1%
times-frac99.3%
distribute-frac-neg99.3%
neg-mul-199.3%
*-commutative99.3%
associate-/l*98.7%
*-commutative98.7%
Simplified99.8%
*-commutative99.8%
clear-num99.8%
div-inv99.9%
metadata-eval99.9%
un-div-inv99.9%
Applied egg-rr99.9%
if -9.99999999999999953e-45 < y < 1.4e-87Initial program 90.4%
+-commutative90.4%
associate-+r-90.4%
+-commutative90.4%
associate--l+90.4%
sub-neg90.4%
remove-double-neg90.4%
distribute-frac-neg90.4%
distribute-neg-in90.4%
remove-double-neg90.4%
sub-neg90.4%
neg-mul-190.4%
times-frac84.2%
distribute-frac-neg84.2%
neg-mul-184.2%
*-commutative84.2%
associate-/l*84.2%
*-commutative84.2%
Simplified84.2%
Taylor expanded in t around inf 88.5%
*-commutative88.5%
associate-*l/88.4%
associate-*r/88.4%
metadata-eval88.4%
associate-*r/88.4%
*-commutative88.4%
associate-/r*88.4%
associate-*r/88.3%
associate-*r/88.4%
metadata-eval88.4%
Simplified88.4%
associate-*r/96.7%
associate-*r/96.6%
Applied egg-rr96.6%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.02e-44) (not (<= y 5e-86))) (+ x (* (- (/ t y) y) (/ 0.3333333333333333 z))) (+ x (/ (/ (* t 0.3333333333333333) z) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.02e-44) || !(y <= 5e-86)) {
tmp = x + (((t / y) - y) * (0.3333333333333333 / z));
} else {
tmp = x + (((t * 0.3333333333333333) / 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.02d-44)) .or. (.not. (y <= 5d-86))) then
tmp = x + (((t / y) - y) * (0.3333333333333333d0 / z))
else
tmp = x + (((t * 0.3333333333333333d0) / 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.02e-44) || !(y <= 5e-86)) {
tmp = x + (((t / y) - y) * (0.3333333333333333 / z));
} else {
tmp = x + (((t * 0.3333333333333333) / z) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.02e-44) or not (y <= 5e-86): tmp = x + (((t / y) - y) * (0.3333333333333333 / z)) else: tmp = x + (((t * 0.3333333333333333) / z) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.02e-44) || !(y <= 5e-86)) tmp = Float64(x + Float64(Float64(Float64(t / y) - y) * Float64(0.3333333333333333 / z))); else tmp = Float64(x + Float64(Float64(Float64(t * 0.3333333333333333) / z) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.02e-44) || ~((y <= 5e-86))) tmp = x + (((t / y) - y) * (0.3333333333333333 / z)); else tmp = x + (((t * 0.3333333333333333) / z) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.02e-44], N[Not[LessEqual[y, 5e-86]], $MachinePrecision]], N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t * 0.3333333333333333), $MachinePrecision] / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{-44} \lor \neg \left(y \leq 5 \cdot 10^{-86}\right):\\
\;\;\;\;x + \left(\frac{t}{y} - y\right) \cdot \frac{0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\
\end{array}
\end{array}
if y < -1.0199999999999999e-44 or 4.9999999999999999e-86 < y Initial program 98.1%
+-commutative98.1%
associate-+r-98.1%
+-commutative98.1%
associate--l+98.1%
sub-neg98.1%
remove-double-neg98.1%
distribute-frac-neg98.1%
distribute-neg-in98.1%
remove-double-neg98.1%
sub-neg98.1%
neg-mul-198.1%
times-frac99.3%
distribute-frac-neg99.3%
neg-mul-199.3%
*-commutative99.3%
associate-/l*98.7%
*-commutative98.7%
Simplified99.8%
if -1.0199999999999999e-44 < y < 4.9999999999999999e-86Initial program 90.4%
+-commutative90.4%
associate-+r-90.4%
+-commutative90.4%
associate--l+90.4%
sub-neg90.4%
remove-double-neg90.4%
distribute-frac-neg90.4%
distribute-neg-in90.4%
remove-double-neg90.4%
sub-neg90.4%
neg-mul-190.4%
times-frac84.2%
distribute-frac-neg84.2%
neg-mul-184.2%
*-commutative84.2%
associate-/l*84.2%
*-commutative84.2%
Simplified84.2%
Taylor expanded in t around inf 88.5%
*-commutative88.5%
associate-*l/88.4%
associate-*r/88.4%
metadata-eval88.4%
associate-*r/88.4%
*-commutative88.4%
associate-/r*88.4%
associate-*r/88.3%
associate-*r/88.4%
metadata-eval88.4%
Simplified88.4%
associate-*r/96.7%
associate-*r/96.6%
Applied egg-rr96.6%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.26e+60) (not (<= y 7e+39))) (- x (/ y (* z 3.0))) (+ x (/ (/ (* t 0.3333333333333333) z) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.26e+60) || !(y <= 7e+39)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + (((t * 0.3333333333333333) / 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.26d+60)) .or. (.not. (y <= 7d+39))) then
tmp = x - (y / (z * 3.0d0))
else
tmp = x + (((t * 0.3333333333333333d0) / 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.26e+60) || !(y <= 7e+39)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + (((t * 0.3333333333333333) / z) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.26e+60) or not (y <= 7e+39): tmp = x - (y / (z * 3.0)) else: tmp = x + (((t * 0.3333333333333333) / z) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.26e+60) || !(y <= 7e+39)) tmp = Float64(x - Float64(y / Float64(z * 3.0))); else tmp = Float64(x + Float64(Float64(Float64(t * 0.3333333333333333) / z) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.26e+60) || ~((y <= 7e+39))) tmp = x - (y / (z * 3.0)); else tmp = x + (((t * 0.3333333333333333) / z) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.26e+60], N[Not[LessEqual[y, 7e+39]], $MachinePrecision]], N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t * 0.3333333333333333), $MachinePrecision] / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.26 \cdot 10^{+60} \lor \neg \left(y \leq 7 \cdot 10^{+39}\right):\\
\;\;\;\;x - \frac{y}{z \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\
\end{array}
\end{array}
if y < -1.26e60 or 7.0000000000000003e39 < y Initial program 99.0%
+-commutative99.0%
associate-+r-99.0%
sub-neg99.0%
associate-*l*99.0%
*-commutative99.0%
distribute-frac-neg299.0%
distribute-rgt-neg-in99.0%
metadata-eval99.0%
Simplified99.0%
Taylor expanded in t around 0 96.6%
metadata-eval96.6%
cancel-sign-sub-inv96.6%
Simplified96.6%
metadata-eval96.6%
times-frac96.7%
*-un-lft-identity96.7%
*-commutative96.7%
Applied egg-rr96.7%
if -1.26e60 < y < 7.0000000000000003e39Initial program 92.6%
+-commutative92.6%
associate-+r-92.6%
+-commutative92.6%
associate--l+92.6%
sub-neg92.6%
remove-double-neg92.6%
distribute-frac-neg92.6%
distribute-neg-in92.6%
remove-double-neg92.6%
sub-neg92.6%
neg-mul-192.6%
times-frac90.0%
distribute-frac-neg90.0%
neg-mul-190.0%
*-commutative90.0%
associate-/l*89.3%
*-commutative89.3%
Simplified89.9%
Taylor expanded in t around inf 85.4%
*-commutative85.4%
associate-*l/85.3%
associate-*r/84.7%
metadata-eval84.7%
associate-*r/84.7%
*-commutative84.7%
associate-/r*84.6%
associate-*r/84.6%
associate-*r/84.6%
metadata-eval84.6%
Simplified84.6%
associate-*r/90.8%
associate-*r/90.8%
Applied egg-rr90.8%
Final simplification93.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.3e+59) (not (<= y 8e+25))) (- x (/ y (* z 3.0))) (+ x (* 0.3333333333333333 (/ t (* y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.3e+59) || !(y <= 8e+25)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + (0.3333333333333333 * (t / (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.3d+59)) .or. (.not. (y <= 8d+25))) then
tmp = x - (y / (z * 3.0d0))
else
tmp = x + (0.3333333333333333d0 * (t / (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.3e+59) || !(y <= 8e+25)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + (0.3333333333333333 * (t / (y * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.3e+59) or not (y <= 8e+25): tmp = x - (y / (z * 3.0)) else: tmp = x + (0.3333333333333333 * (t / (y * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.3e+59) || !(y <= 8e+25)) tmp = Float64(x - Float64(y / Float64(z * 3.0))); else tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.3e+59) || ~((y <= 8e+25))) tmp = x - (y / (z * 3.0)); else tmp = x + (0.3333333333333333 * (t / (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.3e+59], N[Not[LessEqual[y, 8e+25]], $MachinePrecision]], N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+59} \lor \neg \left(y \leq 8 \cdot 10^{+25}\right):\\
\;\;\;\;x - \frac{y}{z \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\
\end{array}
\end{array}
if y < -1.3e59 or 8.00000000000000072e25 < y Initial program 99.0%
+-commutative99.0%
associate-+r-99.0%
sub-neg99.0%
associate-*l*99.0%
*-commutative99.0%
distribute-frac-neg299.0%
distribute-rgt-neg-in99.0%
metadata-eval99.0%
Simplified99.0%
Taylor expanded in t around 0 95.9%
metadata-eval95.9%
cancel-sign-sub-inv95.9%
Simplified95.9%
metadata-eval95.9%
times-frac96.0%
*-un-lft-identity96.0%
*-commutative96.0%
Applied egg-rr96.0%
if -1.3e59 < y < 8.00000000000000072e25Initial program 92.4%
+-commutative92.4%
associate-+r-92.4%
+-commutative92.4%
associate--l+92.4%
sub-neg92.4%
remove-double-neg92.4%
distribute-frac-neg92.4%
distribute-neg-in92.4%
remove-double-neg92.4%
sub-neg92.4%
neg-mul-192.4%
times-frac89.7%
distribute-frac-neg89.7%
neg-mul-189.7%
*-commutative89.7%
associate-/l*89.0%
*-commutative89.0%
Simplified89.7%
Taylor expanded in t around inf 85.6%
Final simplification90.3%
(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.4%
+-commutative95.4%
associate-+r-95.4%
sub-neg95.4%
associate-*l*95.4%
*-commutative95.4%
distribute-frac-neg295.4%
distribute-rgt-neg-in95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in t around 0 68.9%
metadata-eval68.9%
cancel-sign-sub-inv68.9%
Simplified68.9%
metadata-eval68.9%
times-frac68.9%
*-un-lft-identity68.9%
*-commutative68.9%
Applied egg-rr68.9%
(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 95.4%
+-commutative95.4%
associate-+r-95.4%
+-commutative95.4%
associate--l+95.4%
sub-neg95.4%
remove-double-neg95.4%
distribute-frac-neg95.4%
distribute-neg-in95.4%
remove-double-neg95.4%
sub-neg95.4%
neg-mul-195.4%
times-frac93.9%
distribute-frac-neg93.9%
neg-mul-193.9%
*-commutative93.9%
associate-/l*93.5%
*-commutative93.5%
Simplified94.3%
Taylor expanded in t around 0 68.9%
associate-*r/68.9%
*-commutative68.9%
associate-*r/68.9%
Simplified68.9%
(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.4%
+-commutative95.4%
associate-+r-95.4%
sub-neg95.4%
associate-*l*95.4%
*-commutative95.4%
distribute-frac-neg295.4%
distribute-rgt-neg-in95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in z around inf 35.2%
(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 2024091
(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))))