
(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) 5e-23) (+ x (* (/ 1.0 z) (/ (- (/ t y) y) 3.0))) (+ (+ x (/ t (* z (* 3.0 y)))) (/ 1.0 (* z (/ -3.0 y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * 3.0) <= 5e-23) {
tmp = x + ((1.0 / z) * (((t / y) - y) / 3.0));
} else {
tmp = (x + (t / (z * (3.0 * y)))) + (1.0 / (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 ((z * 3.0d0) <= 5d-23) then
tmp = x + ((1.0d0 / z) * (((t / y) - y) / 3.0d0))
else
tmp = (x + (t / (z * (3.0d0 * y)))) + (1.0d0 / (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 ((z * 3.0) <= 5e-23) {
tmp = x + ((1.0 / z) * (((t / y) - y) / 3.0));
} else {
tmp = (x + (t / (z * (3.0 * y)))) + (1.0 / (z * (-3.0 / y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * 3.0) <= 5e-23: tmp = x + ((1.0 / z) * (((t / y) - y) / 3.0)) else: tmp = (x + (t / (z * (3.0 * y)))) + (1.0 / (z * (-3.0 / y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * 3.0) <= 5e-23) tmp = Float64(x + Float64(Float64(1.0 / z) * Float64(Float64(Float64(t / y) - y) / 3.0))); else tmp = Float64(Float64(x + Float64(t / Float64(z * Float64(3.0 * y)))) + Float64(1.0 / Float64(z * Float64(-3.0 / y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * 3.0) <= 5e-23) tmp = x + ((1.0 / z) * (((t / y) - y) / 3.0)); else tmp = (x + (t / (z * (3.0 * y)))) + (1.0 / (z * (-3.0 / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], 5e-23], N[(x + N[(N[(1.0 / z), $MachinePrecision] * N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(t / N[(z * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(z * N[(-3.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq 5 \cdot 10^{-23}:\\
\;\;\;\;x + \frac{1}{z} \cdot \frac{\frac{t}{y} - y}{3}\\
\mathbf{else}:\\
\;\;\;\;\left(x + \frac{t}{z \cdot \left(3 \cdot y\right)}\right) + \frac{1}{z \cdot \frac{-3}{y}}\\
\end{array}
\end{array}
if (*.f64 z #s(literal 3 binary64)) < 5.0000000000000002e-23Initial program 94.0%
sub-neg94.0%
associate-+l+94.0%
+-commutative94.0%
remove-double-neg94.0%
distribute-frac-neg94.0%
distribute-neg-in94.0%
remove-double-neg94.0%
sub-neg94.0%
neg-mul-194.0%
times-frac98.1%
distribute-frac-neg98.1%
neg-mul-198.1%
*-commutative98.1%
associate-/l*98.1%
*-commutative98.1%
Simplified98.7%
Taylor expanded in z around 0 98.6%
associate-*r/98.7%
Simplified98.7%
associate-/l*98.6%
metadata-eval98.6%
times-frac98.7%
*-commutative98.7%
times-frac98.7%
Applied egg-rr98.7%
if 5.0000000000000002e-23 < (*.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.6%
inv-pow99.6%
associate-/l*99.8%
Applied egg-rr99.8%
unpow-199.8%
Simplified99.8%
Final simplification99.0%
(FPCore (x y z t)
:precision binary64
(if (<= y -7.5e+63)
(+ x (/ (* y -0.3333333333333333) z))
(if (<= y -22000000000.0)
(+ x (* 0.3333333333333333 (/ t (* z y))))
(if (<= y -1650.0)
(+ x (* -0.3333333333333333 (/ y z)))
(if (<= y 8.2e+31)
(+ x (/ 0.3333333333333333 (* y (/ z t))))
(+ x (/ (/ y z) -3.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.5e+63) {
tmp = x + ((y * -0.3333333333333333) / z);
} else if (y <= -22000000000.0) {
tmp = x + (0.3333333333333333 * (t / (z * y)));
} else if (y <= -1650.0) {
tmp = x + (-0.3333333333333333 * (y / z));
} else if (y <= 8.2e+31) {
tmp = x + (0.3333333333333333 / (y * (z / t)));
} 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 <= (-7.5d+63)) then
tmp = x + ((y * (-0.3333333333333333d0)) / z)
else if (y <= (-22000000000.0d0)) then
tmp = x + (0.3333333333333333d0 * (t / (z * y)))
else if (y <= (-1650.0d0)) then
tmp = x + ((-0.3333333333333333d0) * (y / z))
else if (y <= 8.2d+31) then
tmp = x + (0.3333333333333333d0 / (y * (z / t)))
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 <= -7.5e+63) {
tmp = x + ((y * -0.3333333333333333) / z);
} else if (y <= -22000000000.0) {
tmp = x + (0.3333333333333333 * (t / (z * y)));
} else if (y <= -1650.0) {
tmp = x + (-0.3333333333333333 * (y / z));
} else if (y <= 8.2e+31) {
tmp = x + (0.3333333333333333 / (y * (z / t)));
} else {
tmp = x + ((y / z) / -3.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7.5e+63: tmp = x + ((y * -0.3333333333333333) / z) elif y <= -22000000000.0: tmp = x + (0.3333333333333333 * (t / (z * y))) elif y <= -1650.0: tmp = x + (-0.3333333333333333 * (y / z)) elif y <= 8.2e+31: tmp = x + (0.3333333333333333 / (y * (z / t))) else: tmp = x + ((y / z) / -3.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7.5e+63) tmp = Float64(x + Float64(Float64(y * -0.3333333333333333) / z)); elseif (y <= -22000000000.0) tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(z * y)))); elseif (y <= -1650.0) tmp = Float64(x + Float64(-0.3333333333333333 * Float64(y / z))); elseif (y <= 8.2e+31) tmp = Float64(x + Float64(0.3333333333333333 / Float64(y * Float64(z / t)))); 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 <= -7.5e+63) tmp = x + ((y * -0.3333333333333333) / z); elseif (y <= -22000000000.0) tmp = x + (0.3333333333333333 * (t / (z * y))); elseif (y <= -1650.0) tmp = x + (-0.3333333333333333 * (y / z)); elseif (y <= 8.2e+31) tmp = x + (0.3333333333333333 / (y * (z / t))); else tmp = x + ((y / z) / -3.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.5e+63], N[(x + N[(N[(y * -0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -22000000000.0], N[(x + N[(0.3333333333333333 * N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1650.0], N[(x + N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e+31], N[(x + N[(0.3333333333333333 / N[(y * N[(z / t), $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 -7.5 \cdot 10^{+63}:\\
\;\;\;\;x + \frac{y \cdot -0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq -22000000000:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{z \cdot y}\\
\mathbf{elif}\;y \leq -1650:\\
\;\;\;\;x + -0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+31}:\\
\;\;\;\;x + \frac{0.3333333333333333}{y \cdot \frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{y}{z}}{-3}\\
\end{array}
\end{array}
if y < -7.5000000000000005e63Initial program 98.1%
sub-neg98.1%
associate-+l+98.1%
+-commutative98.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-frac98.1%
distribute-frac-neg98.1%
neg-mul-198.1%
*-commutative98.1%
associate-/l*98.0%
*-commutative98.0%
Simplified99.8%
Taylor expanded in z around 0 99.6%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around 0 94.6%
if -7.5000000000000005e63 < y < -2.2e10Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
+-commutative99.6%
remove-double-neg99.6%
distribute-frac-neg99.6%
distribute-neg-in99.6%
remove-double-neg99.6%
sub-neg99.6%
neg-mul-199.6%
times-frac99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around inf 88.3%
if -2.2e10 < y < -1650Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
+-commutative99.6%
remove-double-neg99.6%
distribute-frac-neg99.6%
distribute-neg-in99.6%
remove-double-neg99.6%
sub-neg99.6%
neg-mul-199.6%
times-frac99.6%
distribute-frac-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-/l*99.6%
*-commutative99.6%
Simplified100.0%
Taylor expanded in t around 0 100.0%
if -1650 < y < 8.2000000000000003e31Initial program 92.6%
sub-neg92.6%
associate-+l+92.6%
+-commutative92.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-frac92.3%
distribute-frac-neg92.3%
neg-mul-192.3%
*-commutative92.3%
associate-/l*92.3%
*-commutative92.3%
Simplified92.4%
Taylor expanded in t around inf 85.9%
clear-num85.8%
un-div-inv85.9%
associate-/l*91.0%
Applied egg-rr91.0%
if 8.2000000000000003e31 < y Initial program 98.2%
sub-neg98.2%
associate-+l+98.2%
+-commutative98.2%
remove-double-neg98.2%
distribute-frac-neg98.2%
distribute-neg-in98.2%
remove-double-neg98.2%
sub-neg98.2%
neg-mul-198.2%
times-frac99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.6%
*-commutative99.6%
Simplified99.7%
Taylor expanded in t around 0 93.6%
metadata-eval93.6%
times-frac93.6%
neg-mul-193.6%
*-commutative93.6%
associate-/r*93.8%
frac-2neg93.8%
distribute-frac-neg293.8%
frac-2neg93.8%
metadata-eval93.8%
Applied egg-rr93.8%
Final simplification92.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -3e+62)
(+ x (/ (* y -0.3333333333333333) z))
(if (<= y -40000000000000.0)
(+ x (* 0.3333333333333333 (/ t (* z y))))
(if (<= y -3900.0)
(+ x (* -0.3333333333333333 (/ y z)))
(if (<= y 5.7e+30)
(+ x (/ (/ (* t 0.3333333333333333) z) y))
(+ x (/ (/ y z) -3.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3e+62) {
tmp = x + ((y * -0.3333333333333333) / z);
} else if (y <= -40000000000000.0) {
tmp = x + (0.3333333333333333 * (t / (z * y)));
} else if (y <= -3900.0) {
tmp = x + (-0.3333333333333333 * (y / z));
} else if (y <= 5.7e+30) {
tmp = x + (((t * 0.3333333333333333) / z) / 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 <= (-3d+62)) then
tmp = x + ((y * (-0.3333333333333333d0)) / z)
else if (y <= (-40000000000000.0d0)) then
tmp = x + (0.3333333333333333d0 * (t / (z * y)))
else if (y <= (-3900.0d0)) then
tmp = x + ((-0.3333333333333333d0) * (y / z))
else if (y <= 5.7d+30) then
tmp = x + (((t * 0.3333333333333333d0) / z) / 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 <= -3e+62) {
tmp = x + ((y * -0.3333333333333333) / z);
} else if (y <= -40000000000000.0) {
tmp = x + (0.3333333333333333 * (t / (z * y)));
} else if (y <= -3900.0) {
tmp = x + (-0.3333333333333333 * (y / z));
} else if (y <= 5.7e+30) {
tmp = x + (((t * 0.3333333333333333) / z) / y);
} else {
tmp = x + ((y / z) / -3.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3e+62: tmp = x + ((y * -0.3333333333333333) / z) elif y <= -40000000000000.0: tmp = x + (0.3333333333333333 * (t / (z * y))) elif y <= -3900.0: tmp = x + (-0.3333333333333333 * (y / z)) elif y <= 5.7e+30: tmp = x + (((t * 0.3333333333333333) / z) / y) else: tmp = x + ((y / z) / -3.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3e+62) tmp = Float64(x + Float64(Float64(y * -0.3333333333333333) / z)); elseif (y <= -40000000000000.0) tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(z * y)))); elseif (y <= -3900.0) tmp = Float64(x + Float64(-0.3333333333333333 * Float64(y / z))); elseif (y <= 5.7e+30) tmp = Float64(x + Float64(Float64(Float64(t * 0.3333333333333333) / z) / 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 <= -3e+62) tmp = x + ((y * -0.3333333333333333) / z); elseif (y <= -40000000000000.0) tmp = x + (0.3333333333333333 * (t / (z * y))); elseif (y <= -3900.0) tmp = x + (-0.3333333333333333 * (y / z)); elseif (y <= 5.7e+30) tmp = x + (((t * 0.3333333333333333) / z) / y); else tmp = x + ((y / z) / -3.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3e+62], N[(x + N[(N[(y * -0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -40000000000000.0], N[(x + N[(0.3333333333333333 * N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3900.0], N[(x + N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.7e+30], N[(x + N[(N[(N[(t * 0.3333333333333333), $MachinePrecision] / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / z), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+62}:\\
\;\;\;\;x + \frac{y \cdot -0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq -40000000000000:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{z \cdot y}\\
\mathbf{elif}\;y \leq -3900:\\
\;\;\;\;x + -0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{+30}:\\
\;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{y}{z}}{-3}\\
\end{array}
\end{array}
if y < -3e62Initial program 98.1%
sub-neg98.1%
associate-+l+98.1%
+-commutative98.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-frac98.1%
distribute-frac-neg98.1%
neg-mul-198.1%
*-commutative98.1%
associate-/l*98.0%
*-commutative98.0%
Simplified99.8%
Taylor expanded in z around 0 99.6%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around 0 94.6%
if -3e62 < y < -4e13Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
+-commutative99.6%
remove-double-neg99.6%
distribute-frac-neg99.6%
distribute-neg-in99.6%
remove-double-neg99.6%
sub-neg99.6%
neg-mul-199.6%
times-frac99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around inf 88.3%
if -4e13 < y < -3900Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
+-commutative99.6%
remove-double-neg99.6%
distribute-frac-neg99.6%
distribute-neg-in99.6%
remove-double-neg99.6%
sub-neg99.6%
neg-mul-199.6%
times-frac99.6%
distribute-frac-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-/l*99.6%
*-commutative99.6%
Simplified100.0%
Taylor expanded in t around 0 100.0%
if -3900 < y < 5.7000000000000002e30Initial program 92.6%
sub-neg92.6%
associate-+l+92.6%
+-commutative92.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-frac92.3%
distribute-frac-neg92.3%
neg-mul-192.3%
*-commutative92.3%
associate-/l*92.3%
*-commutative92.3%
Simplified92.4%
Taylor expanded in t around inf 85.9%
associate-*r/85.9%
*-commutative85.9%
associate-/r*91.1%
Applied egg-rr91.1%
if 5.7000000000000002e30 < y Initial program 98.2%
sub-neg98.2%
associate-+l+98.2%
+-commutative98.2%
remove-double-neg98.2%
distribute-frac-neg98.2%
distribute-neg-in98.2%
remove-double-neg98.2%
sub-neg98.2%
neg-mul-198.2%
times-frac99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.6%
*-commutative99.6%
Simplified99.7%
Taylor expanded in t around 0 93.6%
metadata-eval93.6%
times-frac93.6%
neg-mul-193.6%
*-commutative93.6%
associate-/r*93.8%
frac-2neg93.8%
distribute-frac-neg293.8%
frac-2neg93.8%
metadata-eval93.8%
Applied egg-rr93.8%
Final simplification92.5%
(FPCore (x y z t) :precision binary64 (if (<= (* z 3.0) 5e-23) (+ x (* (/ 1.0 z) (/ (- (/ t y) y) 3.0))) (+ x (+ (/ t (* z (* 3.0 y))) (/ (/ y -3.0) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * 3.0) <= 5e-23) {
tmp = x + ((1.0 / z) * (((t / y) - y) / 3.0));
} else {
tmp = x + ((t / (z * (3.0 * y))) + ((y / -3.0) / 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 ((z * 3.0d0) <= 5d-23) then
tmp = x + ((1.0d0 / z) * (((t / y) - y) / 3.0d0))
else
tmp = x + ((t / (z * (3.0d0 * y))) + ((y / (-3.0d0)) / z))
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-23) {
tmp = x + ((1.0 / z) * (((t / y) - y) / 3.0));
} else {
tmp = x + ((t / (z * (3.0 * y))) + ((y / -3.0) / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * 3.0) <= 5e-23: tmp = x + ((1.0 / z) * (((t / y) - y) / 3.0)) else: tmp = x + ((t / (z * (3.0 * y))) + ((y / -3.0) / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * 3.0) <= 5e-23) tmp = Float64(x + Float64(Float64(1.0 / z) * Float64(Float64(Float64(t / y) - y) / 3.0))); else tmp = Float64(x + Float64(Float64(t / Float64(z * Float64(3.0 * y))) + Float64(Float64(y / -3.0) / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * 3.0) <= 5e-23) tmp = x + ((1.0 / z) * (((t / y) - y) / 3.0)); else tmp = x + ((t / (z * (3.0 * y))) + ((y / -3.0) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], 5e-23], N[(x + N[(N[(1.0 / z), $MachinePrecision] * N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t / N[(z * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y / -3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq 5 \cdot 10^{-23}:\\
\;\;\;\;x + \frac{1}{z} \cdot \frac{\frac{t}{y} - y}{3}\\
\mathbf{else}:\\
\;\;\;\;x + \left(\frac{t}{z \cdot \left(3 \cdot y\right)} + \frac{\frac{y}{-3}}{z}\right)\\
\end{array}
\end{array}
if (*.f64 z #s(literal 3 binary64)) < 5.0000000000000002e-23Initial program 94.0%
sub-neg94.0%
associate-+l+94.0%
+-commutative94.0%
remove-double-neg94.0%
distribute-frac-neg94.0%
distribute-neg-in94.0%
remove-double-neg94.0%
sub-neg94.0%
neg-mul-194.0%
times-frac98.1%
distribute-frac-neg98.1%
neg-mul-198.1%
*-commutative98.1%
associate-/l*98.1%
*-commutative98.1%
Simplified98.7%
Taylor expanded in z around 0 98.6%
associate-*r/98.7%
Simplified98.7%
associate-/l*98.6%
metadata-eval98.6%
times-frac98.7%
*-commutative98.7%
times-frac98.7%
Applied egg-rr98.7%
if 5.0000000000000002e-23 < (*.f64 z #s(literal 3 binary64)) Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
*-commutative99.7%
times-frac99.6%
fma-define99.6%
metadata-eval99.6%
associate-*l*99.7%
*-commutative99.7%
Simplified99.7%
fma-undefine99.7%
metadata-eval99.7%
times-frac99.7%
*-un-lft-identity99.7%
associate-/r*99.8%
Applied egg-rr99.8%
Final simplification99.0%
(FPCore (x y z t)
:precision binary64
(if (<= y -6.2e+57)
(+ x (/ (* y -0.3333333333333333) z))
(if (<= y 5.3e+32)
(+ x (* 0.3333333333333333 (/ t (* z y))))
(+ x (/ (/ y z) -3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.2e+57) {
tmp = x + ((y * -0.3333333333333333) / z);
} else if (y <= 5.3e+32) {
tmp = x + (0.3333333333333333 * (t / (z * 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 <= (-6.2d+57)) then
tmp = x + ((y * (-0.3333333333333333d0)) / z)
else if (y <= 5.3d+32) then
tmp = x + (0.3333333333333333d0 * (t / (z * 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 <= -6.2e+57) {
tmp = x + ((y * -0.3333333333333333) / z);
} else if (y <= 5.3e+32) {
tmp = x + (0.3333333333333333 * (t / (z * y)));
} else {
tmp = x + ((y / z) / -3.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -6.2e+57: tmp = x + ((y * -0.3333333333333333) / z) elif y <= 5.3e+32: tmp = x + (0.3333333333333333 * (t / (z * y))) else: tmp = x + ((y / z) / -3.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -6.2e+57) tmp = Float64(x + Float64(Float64(y * -0.3333333333333333) / z)); elseif (y <= 5.3e+32) tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(z * 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 <= -6.2e+57) tmp = x + ((y * -0.3333333333333333) / z); elseif (y <= 5.3e+32) tmp = x + (0.3333333333333333 * (t / (z * y))); else tmp = x + ((y / z) / -3.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.2e+57], N[(x + N[(N[(y * -0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.3e+32], N[(x + N[(0.3333333333333333 * N[(t / N[(z * y), $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 -6.2 \cdot 10^{+57}:\\
\;\;\;\;x + \frac{y \cdot -0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 5.3 \cdot 10^{+32}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{y}{z}}{-3}\\
\end{array}
\end{array}
if y < -6.20000000000000026e57Initial program 98.1%
sub-neg98.1%
associate-+l+98.1%
+-commutative98.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-frac98.1%
distribute-frac-neg98.1%
neg-mul-198.1%
*-commutative98.1%
associate-/l*98.0%
*-commutative98.0%
Simplified99.8%
Taylor expanded in z around 0 99.6%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in t around 0 94.6%
if -6.20000000000000026e57 < y < 5.2999999999999999e32Initial program 93.7%
sub-neg93.7%
associate-+l+93.7%
+-commutative93.7%
remove-double-neg93.7%
distribute-frac-neg93.7%
distribute-neg-in93.7%
remove-double-neg93.7%
sub-neg93.7%
neg-mul-193.7%
times-frac93.5%
distribute-frac-neg93.5%
neg-mul-193.5%
*-commutative93.5%
associate-/l*93.5%
*-commutative93.5%
Simplified93.6%
Taylor expanded in t around inf 84.2%
if 5.2999999999999999e32 < y Initial program 98.2%
sub-neg98.2%
associate-+l+98.2%
+-commutative98.2%
remove-double-neg98.2%
distribute-frac-neg98.2%
distribute-neg-in98.2%
remove-double-neg98.2%
sub-neg98.2%
neg-mul-198.2%
times-frac99.7%
distribute-frac-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-/l*99.6%
*-commutative99.6%
Simplified99.7%
Taylor expanded in t around 0 93.6%
metadata-eval93.6%
times-frac93.6%
neg-mul-193.6%
*-commutative93.6%
associate-/r*93.8%
frac-2neg93.8%
distribute-frac-neg293.8%
frac-2neg93.8%
metadata-eval93.8%
Applied egg-rr93.8%
Final simplification88.8%
(FPCore (x y z t) :precision binary64 (+ x (* 0.3333333333333333 (/ (- (/ t y) y) z))))
double code(double x, double y, double z, double t) {
return x + (0.3333333333333333 * (((t / y) - y) / 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 + (0.3333333333333333d0 * (((t / y) - y) / z))
end function
public static double code(double x, double y, double z, double t) {
return x + (0.3333333333333333 * (((t / y) - y) / z));
}
def code(x, y, z, t): return x + (0.3333333333333333 * (((t / y) - y) / z))
function code(x, y, z, t) return Float64(x + Float64(0.3333333333333333 * Float64(Float64(Float64(t / y) - y) / z))) end
function tmp = code(x, y, z, t) tmp = x + (0.3333333333333333 * (((t / y) - y) / z)); end
code[x_, y_, z_, t_] := N[(x + N[(0.3333333333333333 * N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 0.3333333333333333 \cdot \frac{\frac{t}{y} - y}{z}
\end{array}
Initial program 95.8%
sub-neg95.8%
associate-+l+95.8%
+-commutative95.8%
remove-double-neg95.8%
distribute-frac-neg95.8%
distribute-neg-in95.8%
remove-double-neg95.8%
sub-neg95.8%
neg-mul-195.8%
times-frac96.0%
distribute-frac-neg96.0%
neg-mul-196.0%
*-commutative96.0%
associate-/l*96.0%
*-commutative96.0%
Simplified96.5%
Taylor expanded in z around 0 96.4%
Final simplification96.4%
(FPCore (x y z t) :precision binary64 (+ x (* (- (/ t y) y) (/ 0.3333333333333333 z))))
double code(double x, double y, double z, double t) {
return x + (((t / y) - 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 + (((t / y) - y) * (0.3333333333333333d0 / z))
end function
public static double code(double x, double y, double z, double t) {
return x + (((t / y) - y) * (0.3333333333333333 / z));
}
def code(x, y, z, t): return x + (((t / y) - y) * (0.3333333333333333 / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(t / y) - y) * Float64(0.3333333333333333 / z))) end
function tmp = code(x, y, z, t) tmp = x + (((t / y) - y) * (0.3333333333333333 / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\frac{t}{y} - y\right) \cdot \frac{0.3333333333333333}{z}
\end{array}
Initial program 95.8%
sub-neg95.8%
associate-+l+95.8%
+-commutative95.8%
remove-double-neg95.8%
distribute-frac-neg95.8%
distribute-neg-in95.8%
remove-double-neg95.8%
sub-neg95.8%
neg-mul-195.8%
times-frac96.0%
distribute-frac-neg96.0%
neg-mul-196.0%
*-commutative96.0%
associate-/l*96.0%
*-commutative96.0%
Simplified96.5%
Final simplification96.5%
(FPCore (x y z t) :precision binary64 (+ x (* -0.3333333333333333 (/ y z))))
double code(double x, double y, double z, double t) {
return x + (-0.3333333333333333 * (y / 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 + ((-0.3333333333333333d0) * (y / z))
end function
public static double code(double x, double y, double z, double t) {
return x + (-0.3333333333333333 * (y / z));
}
def code(x, y, z, t): return x + (-0.3333333333333333 * (y / z))
function code(x, y, z, t) return Float64(x + Float64(-0.3333333333333333 * Float64(y / z))) end
function tmp = code(x, y, z, t) tmp = x + (-0.3333333333333333 * (y / z)); end
code[x_, y_, z_, t_] := N[(x + N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + -0.3333333333333333 \cdot \frac{y}{z}
\end{array}
Initial program 95.8%
sub-neg95.8%
associate-+l+95.8%
+-commutative95.8%
remove-double-neg95.8%
distribute-frac-neg95.8%
distribute-neg-in95.8%
remove-double-neg95.8%
sub-neg95.8%
neg-mul-195.8%
times-frac96.0%
distribute-frac-neg96.0%
neg-mul-196.0%
*-commutative96.0%
associate-/l*96.0%
*-commutative96.0%
Simplified96.5%
Taylor expanded in t around 0 68.3%
Final simplification68.3%
(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(Float64(y * -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[(N[(y * -0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot -0.3333333333333333}{z}
\end{array}
Initial program 95.8%
sub-neg95.8%
associate-+l+95.8%
+-commutative95.8%
remove-double-neg95.8%
distribute-frac-neg95.8%
distribute-neg-in95.8%
remove-double-neg95.8%
sub-neg95.8%
neg-mul-195.8%
times-frac96.0%
distribute-frac-neg96.0%
neg-mul-196.0%
*-commutative96.0%
associate-/l*96.0%
*-commutative96.0%
Simplified96.5%
Taylor expanded in z around 0 96.4%
associate-*r/96.4%
Simplified96.4%
Taylor expanded in t around 0 68.3%
Final simplification68.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(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.8%
sub-neg95.8%
associate-+l+95.8%
+-commutative95.8%
remove-double-neg95.8%
distribute-frac-neg95.8%
distribute-neg-in95.8%
remove-double-neg95.8%
sub-neg95.8%
neg-mul-195.8%
times-frac96.0%
distribute-frac-neg96.0%
neg-mul-196.0%
*-commutative96.0%
associate-/l*96.0%
*-commutative96.0%
Simplified96.5%
Taylor expanded in t around 0 68.3%
metadata-eval68.3%
times-frac68.3%
neg-mul-168.3%
*-commutative68.3%
associate-/r*68.3%
frac-2neg68.3%
distribute-frac-neg268.3%
frac-2neg68.3%
metadata-eval68.3%
Applied egg-rr68.3%
Final simplification68.3%
(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.8%
+-commutative95.8%
associate-+r-95.8%
sub-neg95.8%
associate-*l*95.8%
*-commutative95.8%
distribute-frac-neg295.8%
distribute-rgt-neg-in95.8%
metadata-eval95.8%
Simplified95.8%
Taylor expanded in z around inf 30.4%
Final simplification30.4%
(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 2024060
(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))))