
(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 12 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 (+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0)))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x - (y / (z * 3.0d0))) + (t / (y * (z * 3.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(y * Float64(z * 3.0)))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0))); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}
\end{array}
Initial program 98.3%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(if (<= y -215000000.0)
(+ x (* y (/ -0.3333333333333333 z)))
(if (<= y 2e+17)
(+ x (* 0.3333333333333333 (/ t (* y z))))
(- x (* 0.3333333333333333 (/ y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -215000000.0) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 2e+17) {
tmp = x + (0.3333333333333333 * (t / (y * z)));
} else {
tmp = x - (0.3333333333333333 * (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-215000000.0d0)) then
tmp = x + (y * ((-0.3333333333333333d0) / z))
else if (y <= 2d+17) then
tmp = x + (0.3333333333333333d0 * (t / (y * z)))
else
tmp = x - (0.3333333333333333d0 * (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -215000000.0) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 2e+17) {
tmp = x + (0.3333333333333333 * (t / (y * z)));
} else {
tmp = x - (0.3333333333333333 * (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -215000000.0: tmp = x + (y * (-0.3333333333333333 / z)) elif y <= 2e+17: tmp = x + (0.3333333333333333 * (t / (y * z))) else: tmp = x - (0.3333333333333333 * (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -215000000.0) tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); elseif (y <= 2e+17) tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(y * z)))); else tmp = Float64(x - Float64(0.3333333333333333 * Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -215000000.0) tmp = x + (y * (-0.3333333333333333 / z)); elseif (y <= 2e+17) tmp = x + (0.3333333333333333 * (t / (y * z))); else tmp = x - (0.3333333333333333 * (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -215000000.0], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+17], N[(x + N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -215000000:\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+17}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < -2.15e8Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
distribute-frac-neg99.6%
neg-mul-199.6%
*-commutative99.6%
times-frac99.5%
fma-define99.5%
metadata-eval99.5%
associate-*l*99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in z around 0 99.7%
Taylor expanded in y around inf 95.6%
associate-*r/95.6%
associate-*l/95.7%
*-commutative95.7%
Simplified95.7%
if -2.15e8 < y < 2e17Initial program 98.0%
sub-neg98.0%
associate-+l+98.0%
+-commutative98.0%
remove-double-neg98.0%
distribute-frac-neg98.0%
distribute-neg-in98.0%
remove-double-neg98.0%
sub-neg98.0%
neg-mul-198.0%
times-frac92.8%
distribute-frac-neg92.8%
neg-mul-192.8%
*-commutative92.8%
associate-/l*92.8%
*-commutative92.8%
Simplified92.8%
Taylor expanded in t around inf 92.0%
if 2e17 < y Initial program 98.1%
Taylor expanded in t around 0 92.9%
Final simplification92.9%
(FPCore (x y z t)
:precision binary64
(if (<= y -280000000.0)
(+ x (* y (/ -0.3333333333333333 z)))
(if (<= y 5.5e+19)
(+ x (/ 0.3333333333333333 (/ (* y z) t)))
(- x (* 0.3333333333333333 (/ y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -280000000.0) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 5.5e+19) {
tmp = x + (0.3333333333333333 / ((y * z) / t));
} else {
tmp = x - (0.3333333333333333 * (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-280000000.0d0)) then
tmp = x + (y * ((-0.3333333333333333d0) / z))
else if (y <= 5.5d+19) then
tmp = x + (0.3333333333333333d0 / ((y * z) / t))
else
tmp = x - (0.3333333333333333d0 * (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -280000000.0) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 5.5e+19) {
tmp = x + (0.3333333333333333 / ((y * z) / t));
} else {
tmp = x - (0.3333333333333333 * (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -280000000.0: tmp = x + (y * (-0.3333333333333333 / z)) elif y <= 5.5e+19: tmp = x + (0.3333333333333333 / ((y * z) / t)) else: tmp = x - (0.3333333333333333 * (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -280000000.0) tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); elseif (y <= 5.5e+19) tmp = Float64(x + Float64(0.3333333333333333 / Float64(Float64(y * z) / t))); else tmp = Float64(x - Float64(0.3333333333333333 * Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -280000000.0) tmp = x + (y * (-0.3333333333333333 / z)); elseif (y <= 5.5e+19) tmp = x + (0.3333333333333333 / ((y * z) / t)); else tmp = x - (0.3333333333333333 * (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -280000000.0], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e+19], N[(x + N[(0.3333333333333333 / N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -280000000:\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+19}:\\
\;\;\;\;x + \frac{0.3333333333333333}{\frac{y \cdot z}{t}}\\
\mathbf{else}:\\
\;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < -2.8e8Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
distribute-frac-neg99.6%
neg-mul-199.6%
*-commutative99.6%
times-frac99.5%
fma-define99.5%
metadata-eval99.5%
associate-*l*99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in z around 0 99.7%
Taylor expanded in y around inf 95.6%
associate-*r/95.6%
associate-*l/95.7%
*-commutative95.7%
Simplified95.7%
if -2.8e8 < y < 5.5e19Initial program 98.0%
sub-neg98.0%
associate-+l+98.0%
+-commutative98.0%
remove-double-neg98.0%
distribute-frac-neg98.0%
distribute-neg-in98.0%
remove-double-neg98.0%
sub-neg98.0%
neg-mul-198.0%
times-frac92.8%
distribute-frac-neg92.8%
neg-mul-192.8%
*-commutative92.8%
associate-/l*92.8%
*-commutative92.8%
Simplified92.8%
Taylor expanded in t around inf 92.0%
clear-num92.0%
un-div-inv92.0%
Applied egg-rr92.0%
if 5.5e19 < y Initial program 98.1%
Taylor expanded in t around 0 92.9%
Final simplification92.9%
(FPCore (x y z t)
:precision binary64
(if (<= y -290000000.0)
(+ x (* y (/ -0.3333333333333333 z)))
(if (<= y 6.6e+17)
(+ x (/ t (* 3.0 (* y z))))
(- x (* 0.3333333333333333 (/ y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -290000000.0) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 6.6e+17) {
tmp = x + (t / (3.0 * (y * z)));
} else {
tmp = x - (0.3333333333333333 * (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-290000000.0d0)) then
tmp = x + (y * ((-0.3333333333333333d0) / z))
else if (y <= 6.6d+17) then
tmp = x + (t / (3.0d0 * (y * z)))
else
tmp = x - (0.3333333333333333d0 * (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -290000000.0) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 6.6e+17) {
tmp = x + (t / (3.0 * (y * z)));
} else {
tmp = x - (0.3333333333333333 * (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -290000000.0: tmp = x + (y * (-0.3333333333333333 / z)) elif y <= 6.6e+17: tmp = x + (t / (3.0 * (y * z))) else: tmp = x - (0.3333333333333333 * (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -290000000.0) tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); elseif (y <= 6.6e+17) tmp = Float64(x + Float64(t / Float64(3.0 * Float64(y * z)))); else tmp = Float64(x - Float64(0.3333333333333333 * Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -290000000.0) tmp = x + (y * (-0.3333333333333333 / z)); elseif (y <= 6.6e+17) tmp = x + (t / (3.0 * (y * z))); else tmp = x - (0.3333333333333333 * (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -290000000.0], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.6e+17], N[(x + N[(t / N[(3.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -290000000:\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+17}:\\
\;\;\;\;x + \frac{t}{3 \cdot \left(y \cdot z\right)}\\
\mathbf{else}:\\
\;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < -2.9e8Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
distribute-frac-neg99.6%
neg-mul-199.6%
*-commutative99.6%
times-frac99.5%
fma-define99.5%
metadata-eval99.5%
associate-*l*99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in z around 0 99.7%
Taylor expanded in y around inf 95.6%
associate-*r/95.6%
associate-*l/95.7%
*-commutative95.7%
Simplified95.7%
if -2.9e8 < y < 6.6e17Initial program 98.0%
sub-neg98.0%
associate-+l+98.0%
+-commutative98.0%
remove-double-neg98.0%
distribute-frac-neg98.0%
distribute-neg-in98.0%
remove-double-neg98.0%
sub-neg98.0%
neg-mul-198.0%
times-frac92.8%
distribute-frac-neg92.8%
neg-mul-192.8%
*-commutative92.8%
associate-/l*92.8%
*-commutative92.8%
Simplified92.8%
Taylor expanded in t around inf 92.0%
metadata-eval92.0%
times-frac92.0%
*-un-lft-identity92.0%
Applied egg-rr92.0%
if 6.6e17 < y Initial program 98.1%
Taylor expanded in t around 0 92.9%
Final simplification92.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.8e+90) (not (<= y 8.4e+40))) (* -0.3333333333333333 (/ y z)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.8e+90) || !(y <= 8.4e+40)) {
tmp = -0.3333333333333333 * (y / z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-9.8d+90)) .or. (.not. (y <= 8.4d+40))) then
tmp = (-0.3333333333333333d0) * (y / z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.8e+90) || !(y <= 8.4e+40)) {
tmp = -0.3333333333333333 * (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9.8e+90) or not (y <= 8.4e+40): tmp = -0.3333333333333333 * (y / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9.8e+90) || !(y <= 8.4e+40)) tmp = Float64(-0.3333333333333333 * Float64(y / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -9.8e+90) || ~((y <= 8.4e+40))) tmp = -0.3333333333333333 * (y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9.8e+90], N[Not[LessEqual[y, 8.4e+40]], $MachinePrecision]], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{+90} \lor \neg \left(y \leq 8.4 \cdot 10^{+40}\right):\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.8000000000000006e90 or 8.4000000000000004e40 < y Initial program 98.6%
+-commutative98.6%
associate-+r-98.6%
sub-neg98.6%
associate-*l*98.6%
*-commutative98.6%
distribute-frac-neg298.6%
distribute-rgt-neg-in98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in z around 0 98.6%
Taylor expanded in y around inf 76.8%
if -9.8000000000000006e90 < y < 8.4000000000000004e40Initial 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-frac93.7%
distribute-frac-neg93.7%
neg-mul-193.7%
*-commutative93.7%
associate-/l*93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in x around inf 35.7%
Final simplification49.3%
(FPCore (x y z t) :precision binary64 (if (<= y -3.15e+92) (* y (/ -0.3333333333333333 z)) (if (<= y 9e+51) x (* -0.3333333333333333 (/ y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.15e+92) {
tmp = y * (-0.3333333333333333 / z);
} else if (y <= 9e+51) {
tmp = x;
} else {
tmp = -0.3333333333333333 * (y / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-3.15d+92)) then
tmp = y * ((-0.3333333333333333d0) / z)
else if (y <= 9d+51) then
tmp = x
else
tmp = (-0.3333333333333333d0) * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.15e+92) {
tmp = y * (-0.3333333333333333 / z);
} else if (y <= 9e+51) {
tmp = x;
} else {
tmp = -0.3333333333333333 * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.15e+92: tmp = y * (-0.3333333333333333 / z) elif y <= 9e+51: tmp = x else: tmp = -0.3333333333333333 * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.15e+92) tmp = Float64(y * Float64(-0.3333333333333333 / z)); elseif (y <= 9e+51) tmp = x; else tmp = Float64(-0.3333333333333333 * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.15e+92) tmp = y * (-0.3333333333333333 / z); elseif (y <= 9e+51) tmp = x; else tmp = -0.3333333333333333 * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.15e+92], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+51], x, N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.15 \cdot 10^{+92}:\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+51}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < -3.1499999999999999e92Initial 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%
Taylor expanded in z around 0 99.7%
Taylor expanded in y around inf 87.6%
associate-*r/87.6%
Applied egg-rr87.6%
Taylor expanded in y around 0 87.6%
*-commutative87.6%
associate-*l/87.6%
associate-*r/87.7%
Simplified87.7%
if -3.1499999999999999e92 < y < 8.9999999999999999e51Initial 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-frac93.7%
distribute-frac-neg93.7%
neg-mul-193.7%
*-commutative93.7%
associate-/l*93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in x around inf 35.7%
if 8.9999999999999999e51 < y Initial program 97.9%
+-commutative97.9%
associate-+r-97.9%
sub-neg97.9%
associate-*l*97.9%
*-commutative97.9%
distribute-frac-neg297.9%
distribute-rgt-neg-in97.9%
metadata-eval97.9%
Simplified97.9%
Taylor expanded in z around 0 97.9%
Taylor expanded in y around inf 70.6%
Final simplification49.3%
(FPCore (x y z t) :precision binary64 (+ (/ y (* z -3.0)) (+ x (/ t (* 3.0 (* y z))))))
double code(double x, double y, double z, double t) {
return (y / (z * -3.0)) + (x + (t / (3.0 * (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 = (y / (z * (-3.0d0))) + (x + (t / (3.0d0 * (y * z))))
end function
public static double code(double x, double y, double z, double t) {
return (y / (z * -3.0)) + (x + (t / (3.0 * (y * z))));
}
def code(x, y, z, t): return (y / (z * -3.0)) + (x + (t / (3.0 * (y * z))))
function code(x, y, z, t) return Float64(Float64(y / Float64(z * -3.0)) + Float64(x + Float64(t / Float64(3.0 * Float64(y * z))))) end
function tmp = code(x, y, z, t) tmp = (y / (z * -3.0)) + (x + (t / (3.0 * (y * z)))); end
code[x_, y_, z_, t_] := N[(N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision] + N[(x + N[(t / N[(3.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{z \cdot -3} + \left(x + \frac{t}{3 \cdot \left(y \cdot z\right)}\right)
\end{array}
Initial program 98.3%
+-commutative98.3%
associate-+r-98.3%
sub-neg98.3%
associate-*l*98.3%
*-commutative98.3%
distribute-frac-neg298.3%
distribute-rgt-neg-in98.3%
metadata-eval98.3%
Simplified98.3%
Taylor expanded in z around 0 98.3%
Final simplification98.3%
(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 98.3%
sub-neg98.3%
associate-+l+98.3%
+-commutative98.3%
remove-double-neg98.3%
distribute-frac-neg98.3%
distribute-neg-in98.3%
remove-double-neg98.3%
sub-neg98.3%
neg-mul-198.3%
times-frac95.3%
distribute-frac-neg95.3%
neg-mul-195.3%
*-commutative95.3%
associate-/l*95.3%
*-commutative95.3%
Simplified95.7%
Final simplification95.7%
(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(Float64(0.3333333333333333 * 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[(N[(0.3333333333333333 * N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{0.3333333333333333 \cdot \left(\frac{t}{y} - y\right)}{z}
\end{array}
Initial program 98.3%
sub-neg98.3%
associate-+l+98.3%
+-commutative98.3%
remove-double-neg98.3%
distribute-frac-neg98.3%
distribute-neg-in98.3%
remove-double-neg98.3%
sub-neg98.3%
neg-mul-198.3%
times-frac95.3%
distribute-frac-neg95.3%
neg-mul-195.3%
*-commutative95.3%
associate-/l*95.3%
*-commutative95.3%
Simplified95.7%
associate-*l/95.7%
Applied egg-rr95.7%
Final simplification95.7%
(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 98.3%
sub-neg98.3%
associate-+l+98.3%
distribute-frac-neg98.3%
neg-mul-198.3%
*-commutative98.3%
times-frac98.3%
fma-define98.3%
metadata-eval98.3%
associate-*l*98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in z around 0 95.7%
Taylor expanded in y around inf 60.4%
associate-*r/60.4%
associate-*l/60.4%
*-commutative60.4%
Simplified60.4%
Final simplification60.4%
(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 98.3%
Taylor expanded in t around 0 60.4%
Final simplification60.4%
(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 98.3%
sub-neg98.3%
associate-+l+98.3%
+-commutative98.3%
remove-double-neg98.3%
distribute-frac-neg98.3%
distribute-neg-in98.3%
remove-double-neg98.3%
sub-neg98.3%
neg-mul-198.3%
times-frac95.3%
distribute-frac-neg95.3%
neg-mul-195.3%
*-commutative95.3%
associate-/l*95.3%
*-commutative95.3%
Simplified95.7%
Taylor expanded in x around inf 29.9%
Final simplification29.9%
(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 2024042
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:herbie-target
(+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))