
(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 (+ (- 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 97.2%
Final simplification97.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -4e+58)
(+ x (* y (/ -0.3333333333333333 z)))
(if (<= y 3e+72)
(+ 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 <= -4e+58) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 3e+72) {
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 <= (-4d+58)) then
tmp = x + (y * ((-0.3333333333333333d0) / z))
else if (y <= 3d+72) 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 <= -4e+58) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 3e+72) {
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 <= -4e+58: tmp = x + (y * (-0.3333333333333333 / z)) elif y <= 3e+72: 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 <= -4e+58) tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); elseif (y <= 3e+72) tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(y * z)))); else tmp = Float64(x + Float64(y / Float64(z * -3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4e+58) tmp = x + (y * (-0.3333333333333333 / z)); elseif (y <= 3e+72) 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, -4e+58], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+72], N[(x + N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+58}:\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+72}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\end{array}
\end{array}
if y < -3.99999999999999978e58Initial program 99.7%
Simplified99.8%
Taylor expanded in y around inf 96.0%
clear-num96.0%
un-div-inv96.0%
Applied egg-rr96.0%
associate-/r/96.1%
Applied egg-rr96.1%
if -3.99999999999999978e58 < y < 3.00000000000000003e72Initial program 95.6%
Simplified93.2%
Taylor expanded in y around 0 87.7%
if 3.00000000000000003e72 < y Initial program 99.9%
Simplified99.9%
Taylor expanded in y around inf 98.8%
clear-num98.7%
un-div-inv98.8%
Applied egg-rr98.8%
associate-/r/98.8%
Applied egg-rr98.8%
*-commutative98.8%
clear-num98.8%
div-inv98.8%
div-inv98.8%
metadata-eval98.8%
Applied egg-rr98.8%
Final simplification91.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -4.1e+58)
(+ x (* y (/ -0.3333333333333333 z)))
(if (<= y 3.1e+72)
(+ x (* t (/ 0.3333333333333333 (* y z))))
(+ x (/ y (* z -3.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.1e+58) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 3.1e+72) {
tmp = x + (t * (0.3333333333333333 / (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 <= (-4.1d+58)) then
tmp = x + (y * ((-0.3333333333333333d0) / z))
else if (y <= 3.1d+72) then
tmp = x + (t * (0.3333333333333333d0 / (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 <= -4.1e+58) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 3.1e+72) {
tmp = x + (t * (0.3333333333333333 / (y * z)));
} else {
tmp = x + (y / (z * -3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.1e+58: tmp = x + (y * (-0.3333333333333333 / z)) elif y <= 3.1e+72: tmp = x + (t * (0.3333333333333333 / (y * z))) else: tmp = x + (y / (z * -3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.1e+58) tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); elseif (y <= 3.1e+72) tmp = Float64(x + Float64(t * Float64(0.3333333333333333 / Float64(y * z)))); else tmp = Float64(x + Float64(y / Float64(z * -3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.1e+58) tmp = x + (y * (-0.3333333333333333 / z)); elseif (y <= 3.1e+72) tmp = x + (t * (0.3333333333333333 / (y * z))); else tmp = x + (y / (z * -3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.1e+58], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+72], N[(x + N[(t * N[(0.3333333333333333 / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{+58}:\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+72}:\\
\;\;\;\;x + t \cdot \frac{0.3333333333333333}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\end{array}
\end{array}
if y < -4.1e58Initial program 99.7%
Simplified99.8%
Taylor expanded in y around inf 96.0%
clear-num96.0%
un-div-inv96.0%
Applied egg-rr96.0%
associate-/r/96.1%
Applied egg-rr96.1%
if -4.1e58 < y < 3.09999999999999988e72Initial program 95.6%
Simplified93.2%
Taylor expanded in y around 0 87.7%
associate-*r/87.7%
*-commutative87.7%
associate-*l/87.7%
associate-/r*87.7%
*-commutative87.7%
associate-/l/87.7%
Simplified87.7%
if 3.09999999999999988e72 < y Initial program 99.9%
Simplified99.9%
Taylor expanded in y around inf 98.8%
clear-num98.7%
un-div-inv98.8%
Applied egg-rr98.8%
associate-/r/98.8%
Applied egg-rr98.8%
*-commutative98.8%
clear-num98.8%
div-inv98.8%
div-inv98.8%
metadata-eval98.8%
Applied egg-rr98.8%
Final simplification91.4%
(FPCore (x y z t) :precision binary64 (if (<= y -5.7e+63) (+ x (* y (/ -0.3333333333333333 z))) (if (<= y 3e+72) (+ x (/ t (* y (* z 3.0)))) (+ x (/ y (* z -3.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.7e+63) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 3e+72) {
tmp = x + (t / (y * (z * 3.0)));
} 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 <= (-5.7d+63)) then
tmp = x + (y * ((-0.3333333333333333d0) / z))
else if (y <= 3d+72) then
tmp = x + (t / (y * (z * 3.0d0)))
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 <= -5.7e+63) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 3e+72) {
tmp = x + (t / (y * (z * 3.0)));
} else {
tmp = x + (y / (z * -3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.7e+63: tmp = x + (y * (-0.3333333333333333 / z)) elif y <= 3e+72: tmp = x + (t / (y * (z * 3.0))) else: tmp = x + (y / (z * -3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.7e+63) tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); elseif (y <= 3e+72) tmp = Float64(x + Float64(t / Float64(y * Float64(z * 3.0)))); else tmp = Float64(x + Float64(y / Float64(z * -3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5.7e+63) tmp = x + (y * (-0.3333333333333333 / z)); elseif (y <= 3e+72) tmp = x + (t / (y * (z * 3.0))); else tmp = x + (y / (z * -3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.7e+63], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+72], N[(x + N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.7 \cdot 10^{+63}:\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+72}:\\
\;\;\;\;x + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\end{array}
\end{array}
if y < -5.7000000000000002e63Initial program 99.7%
Simplified99.8%
Taylor expanded in y around inf 96.0%
clear-num96.0%
un-div-inv96.0%
Applied egg-rr96.0%
associate-/r/96.1%
Applied egg-rr96.1%
if -5.7000000000000002e63 < y < 3.00000000000000003e72Initial program 95.6%
Simplified93.2%
Taylor expanded in y around 0 87.7%
associate-*r/87.7%
*-commutative87.7%
associate-*l/87.7%
associate-/r*87.7%
*-commutative87.7%
associate-/l/87.7%
Simplified87.7%
associate-*r/87.7%
associate-/l*87.8%
div-inv87.8%
metadata-eval87.8%
associate-*r*87.8%
Applied egg-rr87.8%
if 3.00000000000000003e72 < y Initial program 99.9%
Simplified99.9%
Taylor expanded in y around inf 98.8%
clear-num98.7%
un-div-inv98.8%
Applied egg-rr98.8%
associate-/r/98.8%
Applied egg-rr98.8%
*-commutative98.8%
clear-num98.8%
div-inv98.8%
div-inv98.8%
metadata-eval98.8%
Applied egg-rr98.8%
Final simplification91.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.38e+14)
(+ x (* y (/ -0.3333333333333333 z)))
(if (<= y 1.25e+37)
(+ 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 <= -1.38e+14) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 1.25e+37) {
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 <= (-1.38d+14)) then
tmp = x + (y * ((-0.3333333333333333d0) / z))
else if (y <= 1.25d+37) 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 <= -1.38e+14) {
tmp = x + (y * (-0.3333333333333333 / z));
} else if (y <= 1.25e+37) {
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 <= -1.38e+14: tmp = x + (y * (-0.3333333333333333 / z)) elif y <= 1.25e+37: 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 <= -1.38e+14) tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); elseif (y <= 1.25e+37) tmp = Float64(x + Float64(Float64(Float64(t * 0.3333333333333333) / z) / y)); else tmp = Float64(x + Float64(y / Float64(z * -3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.38e+14) tmp = x + (y * (-0.3333333333333333 / z)); elseif (y <= 1.25e+37) 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, -1.38e+14], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+37], N[(x + N[(N[(N[(t * 0.3333333333333333), $MachinePrecision] / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.38 \cdot 10^{+14}:\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+37}:\\
\;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\end{array}
\end{array}
if y < -1.38e14Initial program 99.8%
Simplified99.8%
Taylor expanded in y around inf 93.3%
clear-num93.3%
un-div-inv93.3%
Applied egg-rr93.3%
associate-/r/93.4%
Applied egg-rr93.4%
if -1.38e14 < y < 1.24999999999999997e37Initial program 95.1%
Simplified92.5%
Taylor expanded in y around 0 88.9%
associate-*r/89.0%
*-commutative89.0%
associate-*l/89.0%
associate-/r*89.0%
*-commutative89.0%
associate-/l/89.0%
Simplified89.0%
associate-*r/89.0%
*-commutative89.0%
associate-/r*91.0%
Applied egg-rr91.0%
if 1.24999999999999997e37 < y Initial program 99.9%
Simplified99.8%
Taylor expanded in y around inf 93.8%
clear-num93.7%
un-div-inv93.8%
Applied egg-rr93.8%
associate-/r/93.8%
Applied egg-rr93.8%
*-commutative93.8%
clear-num93.8%
div-inv93.8%
div-inv93.9%
metadata-eval93.9%
Applied egg-rr93.9%
Final simplification92.2%
(FPCore (x y z t) :precision binary64 (+ x (* (- y (/ t y)) (/ -0.3333333333333333 z))))
double code(double x, double y, double z, double t) {
return x + ((y - (t / 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 - (t / y)) * ((-0.3333333333333333d0) / z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - (t / y)) * (-0.3333333333333333 / z));
}
def code(x, y, z, t): return x + ((y - (t / y)) * (-0.3333333333333333 / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - Float64(t / y)) * Float64(-0.3333333333333333 / z))) end
function tmp = code(x, y, z, t) tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - \frac{t}{y}\right) \cdot \frac{-0.3333333333333333}{z}
\end{array}
Initial program 97.2%
Simplified95.8%
Final simplification95.8%
(FPCore (x y z t) :precision binary64 (+ x (/ (- y (/ t y)) (* z -3.0))))
double code(double x, double y, double z, double t) {
return x + ((y - (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 - (t / y)) / (z * (-3.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - (t / y)) / (z * -3.0));
}
def code(x, y, z, t): return x + ((y - (t / y)) / (z * -3.0))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - Float64(t / y)) / Float64(z * -3.0))) end
function tmp = code(x, y, z, t) tmp = x + ((y - (t / y)) / (z * -3.0)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - \frac{t}{y}}{z \cdot -3}
\end{array}
Initial program 97.2%
Simplified95.8%
*-commutative95.8%
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 (* -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 97.2%
Simplified95.8%
Taylor expanded in y around inf 63.8%
Final simplification63.8%
(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 97.2%
Simplified95.8%
Taylor expanded in y around inf 63.8%
clear-num63.8%
un-div-inv63.8%
Applied egg-rr63.8%
associate-/r/63.8%
Applied egg-rr63.8%
Final simplification63.8%
(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 2023302
(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))))