
(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 10 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 (/ 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 94.6%
associate-+l-94.6%
sub-neg94.6%
sub-neg94.6%
distribute-neg-in94.6%
unsub-neg94.6%
neg-mul-194.6%
associate-*r/94.6%
associate-*l/94.6%
distribute-neg-frac94.6%
neg-mul-194.6%
times-frac96.4%
distribute-lft-out--96.8%
*-commutative96.8%
associate-/r*96.8%
metadata-eval96.8%
Simplified96.8%
clear-num96.8%
inv-pow96.8%
Applied egg-rr96.8%
unpow-196.8%
Simplified96.8%
associate-*l/96.8%
*-un-lft-identity96.8%
div-inv96.8%
metadata-eval96.8%
Applied egg-rr96.8%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.6e+15) (not (<= y 1.2e+27))) (+ x (/ (/ y -3.0) z)) (+ x (* t (/ 0.3333333333333333 (* y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.6e+15) || !(y <= 1.2e+27)) {
tmp = x + ((y / -3.0) / z);
} else {
tmp = x + (t * (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 <= (-2.6d+15)) .or. (.not. (y <= 1.2d+27))) then
tmp = x + ((y / (-3.0d0)) / z)
else
tmp = x + (t * (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 <= -2.6e+15) || !(y <= 1.2e+27)) {
tmp = x + ((y / -3.0) / z);
} else {
tmp = x + (t * (0.3333333333333333 / (y * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.6e+15) or not (y <= 1.2e+27): tmp = x + ((y / -3.0) / z) else: tmp = x + (t * (0.3333333333333333 / (y * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.6e+15) || !(y <= 1.2e+27)) tmp = Float64(x + Float64(Float64(y / -3.0) / z)); else tmp = Float64(x + Float64(t * Float64(0.3333333333333333 / Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.6e+15) || ~((y <= 1.2e+27))) tmp = x + ((y / -3.0) / z); else tmp = x + (t * (0.3333333333333333 / (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.6e+15], N[Not[LessEqual[y, 1.2e+27]], $MachinePrecision]], N[(x + N[(N[(y / -3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(0.3333333333333333 / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+15} \lor \neg \left(y \leq 1.2 \cdot 10^{+27}\right):\\
\;\;\;\;x + \frac{\frac{y}{-3}}{z}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{0.3333333333333333}{y \cdot z}\\
\end{array}
\end{array}
if y < -2.6e15 or 1.19999999999999999e27 < y Initial program 98.3%
associate-+l-98.3%
sub-neg98.3%
sub-neg98.3%
distribute-neg-in98.3%
unsub-neg98.3%
neg-mul-198.3%
associate-*r/98.3%
associate-*l/98.2%
distribute-neg-frac98.2%
neg-mul-198.2%
times-frac99.0%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 98.2%
+-commutative98.2%
metadata-eval98.2%
cancel-sign-sub-inv98.2%
associate-/r*98.9%
associate-*r/98.9%
associate-*r/98.9%
div-sub99.7%
distribute-lft-out--99.7%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in t around 0 91.3%
metadata-eval91.3%
times-frac91.5%
*-lft-identity91.5%
associate-/r*91.5%
Simplified91.5%
if -2.6e15 < y < 1.19999999999999999e27Initial program 90.8%
associate-+l-90.8%
sub-neg90.8%
sub-neg90.8%
distribute-neg-in90.8%
unsub-neg90.8%
neg-mul-190.8%
associate-*r/90.8%
associate-*l/90.8%
distribute-neg-frac90.8%
neg-mul-190.8%
times-frac93.8%
distribute-lft-out--93.8%
*-commutative93.8%
associate-/r*93.7%
metadata-eval93.7%
Simplified93.7%
Taylor expanded in y around 0 85.3%
metadata-eval85.3%
times-frac85.3%
associate-*r*85.2%
*-commutative85.2%
associate-*l/85.2%
*-commutative85.2%
*-commutative85.2%
associate-*r*85.3%
associate-/r*85.3%
metadata-eval85.3%
Simplified85.3%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4e+18) (not (<= y 6e+27))) (+ x (/ (/ y -3.0) z)) (+ x (/ t (* (* y z) 3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4e+18) || !(y <= 6e+27)) {
tmp = x + ((y / -3.0) / z);
} else {
tmp = x + (t / ((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+18)) .or. (.not. (y <= 6d+27))) then
tmp = x + ((y / (-3.0d0)) / z)
else
tmp = x + (t / ((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+18) || !(y <= 6e+27)) {
tmp = x + ((y / -3.0) / z);
} else {
tmp = x + (t / ((y * z) * 3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4e+18) or not (y <= 6e+27): tmp = x + ((y / -3.0) / z) else: tmp = x + (t / ((y * z) * 3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4e+18) || !(y <= 6e+27)) tmp = Float64(x + Float64(Float64(y / -3.0) / z)); else tmp = Float64(x + Float64(t / Float64(Float64(y * z) * 3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4e+18) || ~((y <= 6e+27))) tmp = x + ((y / -3.0) / z); else tmp = x + (t / ((y * z) * 3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4e+18], N[Not[LessEqual[y, 6e+27]], $MachinePrecision]], N[(x + N[(N[(y / -3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(t / N[(N[(y * z), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+18} \lor \neg \left(y \leq 6 \cdot 10^{+27}\right):\\
\;\;\;\;x + \frac{\frac{y}{-3}}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{\left(y \cdot z\right) \cdot 3}\\
\end{array}
\end{array}
if y < -4e18 or 5.99999999999999953e27 < y Initial program 98.3%
associate-+l-98.3%
sub-neg98.3%
sub-neg98.3%
distribute-neg-in98.3%
unsub-neg98.3%
neg-mul-198.3%
associate-*r/98.3%
associate-*l/98.2%
distribute-neg-frac98.2%
neg-mul-198.2%
times-frac99.0%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 98.2%
+-commutative98.2%
metadata-eval98.2%
cancel-sign-sub-inv98.2%
associate-/r*98.9%
associate-*r/98.9%
associate-*r/98.9%
div-sub99.7%
distribute-lft-out--99.7%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in t around 0 91.3%
metadata-eval91.3%
times-frac91.5%
*-lft-identity91.5%
associate-/r*91.5%
Simplified91.5%
if -4e18 < y < 5.99999999999999953e27Initial program 90.8%
associate-+l-90.8%
sub-neg90.8%
sub-neg90.8%
distribute-neg-in90.8%
unsub-neg90.8%
neg-mul-190.8%
associate-*r/90.8%
associate-*l/90.8%
distribute-neg-frac90.8%
neg-mul-190.8%
times-frac93.8%
distribute-lft-out--93.8%
*-commutative93.8%
associate-/r*93.7%
metadata-eval93.7%
Simplified93.7%
Taylor expanded in y around 0 85.3%
metadata-eval85.3%
times-frac85.3%
associate-*r*85.2%
*-commutative85.2%
associate-*l/85.2%
*-commutative85.2%
*-commutative85.2%
associate-*r*85.3%
associate-/r*85.3%
metadata-eval85.3%
Simplified85.3%
clear-num85.3%
un-div-inv85.3%
div-inv85.3%
metadata-eval85.3%
Applied egg-rr85.3%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.75e+18) (not (<= y 2e+26))) (+ x (/ (/ y -3.0) z)) (+ x (/ (* (/ t y) 0.3333333333333333) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.75e+18) || !(y <= 2e+26)) {
tmp = x + ((y / -3.0) / z);
} else {
tmp = x + (((t / y) * 0.3333333333333333) / 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.75d+18)) .or. (.not. (y <= 2d+26))) then
tmp = x + ((y / (-3.0d0)) / z)
else
tmp = x + (((t / y) * 0.3333333333333333d0) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.75e+18) || !(y <= 2e+26)) {
tmp = x + ((y / -3.0) / z);
} else {
tmp = x + (((t / y) * 0.3333333333333333) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.75e+18) or not (y <= 2e+26): tmp = x + ((y / -3.0) / z) else: tmp = x + (((t / y) * 0.3333333333333333) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.75e+18) || !(y <= 2e+26)) tmp = Float64(x + Float64(Float64(y / -3.0) / z)); else tmp = Float64(x + Float64(Float64(Float64(t / y) * 0.3333333333333333) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.75e+18) || ~((y <= 2e+26))) tmp = x + ((y / -3.0) / z); else tmp = x + (((t / y) * 0.3333333333333333) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.75e+18], N[Not[LessEqual[y, 2e+26]], $MachinePrecision]], N[(x + N[(N[(y / -3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t / y), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.75 \cdot 10^{+18} \lor \neg \left(y \leq 2 \cdot 10^{+26}\right):\\
\;\;\;\;x + \frac{\frac{y}{-3}}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{t}{y} \cdot 0.3333333333333333}{z}\\
\end{array}
\end{array}
if y < -3.75e18 or 2.0000000000000001e26 < y Initial program 98.3%
associate-+l-98.3%
sub-neg98.3%
sub-neg98.3%
distribute-neg-in98.3%
unsub-neg98.3%
neg-mul-198.3%
associate-*r/98.3%
associate-*l/98.2%
distribute-neg-frac98.2%
neg-mul-198.2%
times-frac99.0%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 98.2%
+-commutative98.2%
metadata-eval98.2%
cancel-sign-sub-inv98.2%
associate-/r*98.9%
associate-*r/98.9%
associate-*r/98.9%
div-sub99.7%
distribute-lft-out--99.7%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in t around 0 91.3%
metadata-eval91.3%
times-frac91.5%
*-lft-identity91.5%
associate-/r*91.5%
Simplified91.5%
if -3.75e18 < y < 2.0000000000000001e26Initial program 90.8%
associate-+l-90.8%
sub-neg90.8%
sub-neg90.8%
distribute-neg-in90.8%
unsub-neg90.8%
neg-mul-190.8%
associate-*r/90.8%
associate-*l/90.8%
distribute-neg-frac90.8%
neg-mul-190.8%
times-frac93.8%
distribute-lft-out--93.8%
*-commutative93.8%
associate-/r*93.7%
metadata-eval93.7%
Simplified93.7%
associate-*l/93.7%
Applied egg-rr93.7%
Taylor expanded in y around 0 88.2%
*-commutative88.2%
Simplified88.2%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.2e+15) (not (<= y 2.15e+30))) (+ x (/ (/ y -3.0) z)) (+ x (/ (/ 0.3333333333333333 z) (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.2e+15) || !(y <= 2.15e+30)) {
tmp = x + ((y / -3.0) / z);
} else {
tmp = x + ((0.3333333333333333 / z) / (y / t));
}
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+15)) .or. (.not. (y <= 2.15d+30))) then
tmp = x + ((y / (-3.0d0)) / z)
else
tmp = x + ((0.3333333333333333d0 / z) / (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.2e+15) || !(y <= 2.15e+30)) {
tmp = x + ((y / -3.0) / z);
} else {
tmp = x + ((0.3333333333333333 / z) / (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.2e+15) or not (y <= 2.15e+30): tmp = x + ((y / -3.0) / z) else: tmp = x + ((0.3333333333333333 / z) / (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.2e+15) || !(y <= 2.15e+30)) tmp = Float64(x + Float64(Float64(y / -3.0) / z)); else tmp = Float64(x + Float64(Float64(0.3333333333333333 / z) / Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.2e+15) || ~((y <= 2.15e+30))) tmp = x + ((y / -3.0) / z); else tmp = x + ((0.3333333333333333 / z) / (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.2e+15], N[Not[LessEqual[y, 2.15e+30]], $MachinePrecision]], N[(x + N[(N[(y / -3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(0.3333333333333333 / z), $MachinePrecision] / N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+15} \lor \neg \left(y \leq 2.15 \cdot 10^{+30}\right):\\
\;\;\;\;x + \frac{\frac{y}{-3}}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{0.3333333333333333}{z}}{\frac{y}{t}}\\
\end{array}
\end{array}
if y < -6.2e15 or 2.15e30 < y Initial program 98.3%
associate-+l-98.3%
sub-neg98.3%
sub-neg98.3%
distribute-neg-in98.3%
unsub-neg98.3%
neg-mul-198.3%
associate-*r/98.3%
associate-*l/98.2%
distribute-neg-frac98.2%
neg-mul-198.2%
times-frac99.0%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 98.2%
+-commutative98.2%
metadata-eval98.2%
cancel-sign-sub-inv98.2%
associate-/r*98.9%
associate-*r/98.9%
associate-*r/98.9%
div-sub99.7%
distribute-lft-out--99.7%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in t around 0 91.3%
metadata-eval91.3%
times-frac91.5%
*-lft-identity91.5%
associate-/r*91.5%
Simplified91.5%
if -6.2e15 < y < 2.15e30Initial program 90.8%
associate-+l-90.8%
sub-neg90.8%
sub-neg90.8%
distribute-neg-in90.8%
unsub-neg90.8%
neg-mul-190.8%
associate-*r/90.8%
associate-*l/90.8%
distribute-neg-frac90.8%
neg-mul-190.8%
times-frac93.8%
distribute-lft-out--93.8%
*-commutative93.8%
associate-/r*93.7%
metadata-eval93.7%
Simplified93.7%
Taylor expanded in y around 0 85.3%
metadata-eval85.3%
times-frac85.3%
associate-*r*85.2%
*-commutative85.2%
associate-*l/85.2%
*-commutative85.2%
*-commutative85.2%
associate-*r*85.3%
associate-/r*85.3%
metadata-eval85.3%
Simplified85.3%
associate-*r/85.2%
times-frac88.2%
add-sqr-sqrt42.2%
sqrt-unprod46.5%
frac-times46.2%
metadata-eval46.2%
metadata-eval46.2%
frac-times46.5%
sqrt-unprod11.6%
add-sqr-sqrt25.1%
*-commutative25.1%
clear-num25.1%
un-div-inv25.1%
add-sqr-sqrt11.6%
sqrt-unprod47.1%
frac-times46.8%
metadata-eval46.8%
metadata-eval46.8%
frac-times47.1%
sqrt-unprod42.8%
add-sqr-sqrt88.7%
Applied egg-rr88.7%
Final simplification90.1%
(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 94.6%
associate-+l-94.6%
sub-neg94.6%
sub-neg94.6%
distribute-neg-in94.6%
unsub-neg94.6%
neg-mul-194.6%
associate-*r/94.6%
associate-*l/94.6%
distribute-neg-frac94.6%
neg-mul-194.6%
times-frac96.4%
distribute-lft-out--96.8%
*-commutative96.8%
associate-/r*96.8%
metadata-eval96.8%
Simplified96.8%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (+ x (/ 0.3333333333333333 (/ z (- (/ t y) y)))))
double code(double x, double y, double z, double t) {
return x + (0.3333333333333333 / (z / ((t / y) - y)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (0.3333333333333333d0 / (z / ((t / y) - y)))
end function
public static double code(double x, double y, double z, double t) {
return x + (0.3333333333333333 / (z / ((t / y) - y)));
}
def code(x, y, z, t): return x + (0.3333333333333333 / (z / ((t / y) - y)))
function code(x, y, z, t) return Float64(x + Float64(0.3333333333333333 / Float64(z / Float64(Float64(t / y) - y)))) end
function tmp = code(x, y, z, t) tmp = x + (0.3333333333333333 / (z / ((t / y) - y))); end
code[x_, y_, z_, t_] := N[(x + N[(0.3333333333333333 / N[(z / N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{0.3333333333333333}{\frac{z}{\frac{t}{y} - y}}
\end{array}
Initial program 94.6%
associate-+l-94.6%
sub-neg94.6%
sub-neg94.6%
distribute-neg-in94.6%
unsub-neg94.6%
neg-mul-194.6%
associate-*r/94.6%
associate-*l/94.6%
distribute-neg-frac94.6%
neg-mul-194.6%
times-frac96.4%
distribute-lft-out--96.8%
*-commutative96.8%
associate-/r*96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in y around 0 94.5%
+-commutative94.5%
metadata-eval94.5%
cancel-sign-sub-inv94.5%
associate-/r*96.3%
associate-*r/96.3%
associate-*r/96.4%
div-sub96.8%
distribute-lft-out--96.8%
associate-/l*96.8%
Simplified96.8%
Final simplification96.8%
(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(Float64(y - Float64(t / y)) * -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[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - \frac{t}{y}\right) \cdot -0.3333333333333333}{z}
\end{array}
Initial program 94.6%
associate-+l-94.6%
sub-neg94.6%
sub-neg94.6%
distribute-neg-in94.6%
unsub-neg94.6%
neg-mul-194.6%
associate-*r/94.6%
associate-*l/94.6%
distribute-neg-frac94.6%
neg-mul-194.6%
times-frac96.4%
distribute-lft-out--96.8%
*-commutative96.8%
associate-/r*96.8%
metadata-eval96.8%
Simplified96.8%
associate-*l/96.8%
Applied egg-rr96.8%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (+ x (/ (/ y -3.0) z)))
double code(double x, double y, double z, double t) {
return x + ((y / -3.0) / 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 / (-3.0d0)) / z)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y / -3.0) / z);
}
def code(x, y, z, t): return x + ((y / -3.0) / z)
function code(x, y, z, t) return Float64(x + Float64(Float64(y / -3.0) / z)) end
function tmp = code(x, y, z, t) tmp = x + ((y / -3.0) / z); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / -3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\frac{y}{-3}}{z}
\end{array}
Initial program 94.6%
associate-+l-94.6%
sub-neg94.6%
sub-neg94.6%
distribute-neg-in94.6%
unsub-neg94.6%
neg-mul-194.6%
associate-*r/94.6%
associate-*l/94.6%
distribute-neg-frac94.6%
neg-mul-194.6%
times-frac96.4%
distribute-lft-out--96.8%
*-commutative96.8%
associate-/r*96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in y around 0 94.5%
+-commutative94.5%
metadata-eval94.5%
cancel-sign-sub-inv94.5%
associate-/r*96.3%
associate-*r/96.3%
associate-*r/96.4%
div-sub96.8%
distribute-lft-out--96.8%
associate-/l*96.8%
Simplified96.8%
Taylor expanded in t around 0 62.3%
metadata-eval62.3%
times-frac62.4%
*-lft-identity62.4%
associate-/r*62.5%
Simplified62.5%
Final simplification62.5%
(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 94.6%
associate-+l-94.6%
sub-neg94.6%
sub-neg94.6%
distribute-neg-in94.6%
unsub-neg94.6%
neg-mul-194.6%
associate-*r/94.6%
associate-*l/94.6%
distribute-neg-frac94.6%
neg-mul-194.6%
times-frac96.4%
distribute-lft-out--96.8%
*-commutative96.8%
associate-/r*96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in x around inf 28.2%
Final simplification28.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 2023240
(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))))