
(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 (let* ((t_1 (+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0)))))) (if (<= t_1 2e+273) t_1 (- x (/ (- (/ t y) y) (* z -3.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
double tmp;
if (t_1 <= 2e+273) {
tmp = t_1;
} else {
tmp = x - (((t / y) - y) / (z * -3.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x - (y / (z * 3.0d0))) + (t / (y * (z * 3.0d0)))
if (t_1 <= 2d+273) then
tmp = t_1
else
tmp = x - (((t / y) - y) / (z * (-3.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
double tmp;
if (t_1 <= 2e+273) {
tmp = t_1;
} else {
tmp = x - (((t / y) - y) / (z * -3.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0))) tmp = 0 if t_1 <= 2e+273: tmp = t_1 else: tmp = x - (((t / y) - y) / (z * -3.0)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(y * Float64(z * 3.0)))) tmp = 0.0 if (t_1 <= 2e+273) tmp = t_1; else tmp = Float64(x - Float64(Float64(Float64(t / y) - y) / Float64(z * -3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0))); tmp = 0.0; if (t_1 <= 2e+273) tmp = t_1; else tmp = x - (((t / y) - y) / (z * -3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+273], t$95$1, N[(x - N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+273}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\frac{t}{y} - y}{z \cdot -3}\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < 1.99999999999999989e273Initial program 98.8%
if 1.99999999999999989e273 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) Initial program 89.4%
sub-neg89.4%
distribute-frac-neg89.4%
associate-+l+89.4%
remove-double-neg89.4%
distribute-frac-neg89.4%
unsub-neg89.4%
neg-mul-189.4%
associate-*l/89.4%
neg-mul-189.4%
times-frac99.9%
distribute-lft-out--99.9%
*-commutative99.9%
associate-/r*99.9%
metadata-eval99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.9%
un-div-inv100.0%
div-inv99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.8) (not (<= y 5.2e+64))) (- x (/ y (* z 3.0))) (+ x (* 0.3333333333333333 (/ t (* y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.8) || !(y <= 5.2e+64)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + (0.3333333333333333 * (t / (y * z)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-6.8d0)) .or. (.not. (y <= 5.2d+64))) then
tmp = x - (y / (z * 3.0d0))
else
tmp = x + (0.3333333333333333d0 * (t / (y * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.8) || !(y <= 5.2e+64)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + (0.3333333333333333 * (t / (y * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.8) or not (y <= 5.2e+64): tmp = x - (y / (z * 3.0)) else: tmp = x + (0.3333333333333333 * (t / (y * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.8) || !(y <= 5.2e+64)) tmp = Float64(x - Float64(y / Float64(z * 3.0))); else tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.8) || ~((y <= 5.2e+64))) tmp = x - (y / (z * 3.0)); else tmp = x + (0.3333333333333333 * (t / (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.8], N[Not[LessEqual[y, 5.2e+64]], $MachinePrecision]], N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \lor \neg \left(y \leq 5.2 \cdot 10^{+64}\right):\\
\;\;\;\;x - \frac{y}{z \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\
\end{array}
\end{array}
if y < -6.79999999999999982 or 5.19999999999999994e64 < y Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
unsub-neg99.9%
neg-mul-199.9%
associate-*l/99.8%
neg-mul-199.8%
times-frac99.8%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 97.5%
metadata-eval97.5%
cancel-sign-sub-inv97.5%
metadata-eval97.5%
distribute-lft-neg-in97.5%
associate-*r/97.5%
associate-*l/97.5%
*-commutative97.5%
distribute-rgt-neg-in97.5%
distribute-neg-frac97.5%
metadata-eval97.5%
Simplified97.5%
clear-num97.5%
un-div-inv97.6%
div-inv97.8%
metadata-eval97.8%
Applied egg-rr97.8%
if -6.79999999999999982 < y < 5.19999999999999994e64Initial program 94.6%
sub-neg94.6%
distribute-frac-neg94.6%
associate-+l+94.6%
remove-double-neg94.6%
distribute-frac-neg94.6%
unsub-neg94.6%
neg-mul-194.6%
associate-*l/94.6%
neg-mul-194.6%
times-frac95.7%
distribute-lft-out--95.7%
*-commutative95.7%
associate-/r*95.6%
metadata-eval95.6%
Simplified95.6%
Taylor expanded in y around 0 86.6%
Final simplification90.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.5) (not (<= y 5.6e+64))) (- x (/ y (* z 3.0))) (+ x (* (/ 0.3333333333333333 z) (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.5) || !(y <= 5.6e+64)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + ((0.3333333333333333 / z) * (t / y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-3.5d0)) .or. (.not. (y <= 5.6d+64))) then
tmp = x - (y / (z * 3.0d0))
else
tmp = x + ((0.3333333333333333d0 / z) * (t / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.5) || !(y <= 5.6e+64)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + ((0.3333333333333333 / z) * (t / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.5) or not (y <= 5.6e+64): tmp = x - (y / (z * 3.0)) else: tmp = x + ((0.3333333333333333 / z) * (t / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.5) || !(y <= 5.6e+64)) tmp = Float64(x - Float64(y / Float64(z * 3.0))); else tmp = Float64(x + Float64(Float64(0.3333333333333333 / z) * Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.5) || ~((y <= 5.6e+64))) tmp = x - (y / (z * 3.0)); else tmp = x + ((0.3333333333333333 / z) * (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.5], N[Not[LessEqual[y, 5.6e+64]], $MachinePrecision]], N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(0.3333333333333333 / z), $MachinePrecision] * N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \lor \neg \left(y \leq 5.6 \cdot 10^{+64}\right):\\
\;\;\;\;x - \frac{y}{z \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{0.3333333333333333}{z} \cdot \frac{t}{y}\\
\end{array}
\end{array}
if y < -3.5 or 5.60000000000000047e64 < y Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
unsub-neg99.9%
neg-mul-199.9%
associate-*l/99.8%
neg-mul-199.8%
times-frac99.8%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 97.5%
metadata-eval97.5%
cancel-sign-sub-inv97.5%
metadata-eval97.5%
distribute-lft-neg-in97.5%
associate-*r/97.5%
associate-*l/97.5%
*-commutative97.5%
distribute-rgt-neg-in97.5%
distribute-neg-frac97.5%
metadata-eval97.5%
Simplified97.5%
clear-num97.5%
un-div-inv97.6%
div-inv97.8%
metadata-eval97.8%
Applied egg-rr97.8%
if -3.5 < y < 5.60000000000000047e64Initial program 94.6%
sub-neg94.6%
distribute-frac-neg94.6%
associate-+l+94.6%
remove-double-neg94.6%
distribute-frac-neg94.6%
unsub-neg94.6%
neg-mul-194.6%
associate-*l/94.6%
neg-mul-194.6%
times-frac95.7%
distribute-lft-out--95.7%
*-commutative95.7%
associate-/r*95.6%
metadata-eval95.6%
Simplified95.6%
Taylor expanded in y around 0 86.6%
associate-*r/86.6%
*-commutative86.6%
times-frac87.4%
Simplified87.4%
Final simplification91.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -13.5) (not (<= y 5.2e+64))) (- x (/ y (* z 3.0))) (+ x (/ 0.3333333333333333 (/ z (/ t y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -13.5) || !(y <= 5.2e+64)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + (0.3333333333333333 / (z / (t / y)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-13.5d0)) .or. (.not. (y <= 5.2d+64))) then
tmp = x - (y / (z * 3.0d0))
else
tmp = x + (0.3333333333333333d0 / (z / (t / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -13.5) || !(y <= 5.2e+64)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + (0.3333333333333333 / (z / (t / y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -13.5) or not (y <= 5.2e+64): tmp = x - (y / (z * 3.0)) else: tmp = x + (0.3333333333333333 / (z / (t / y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -13.5) || !(y <= 5.2e+64)) tmp = Float64(x - Float64(y / Float64(z * 3.0))); else tmp = Float64(x + Float64(0.3333333333333333 / Float64(z / Float64(t / y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -13.5) || ~((y <= 5.2e+64))) tmp = x - (y / (z * 3.0)); else tmp = x + (0.3333333333333333 / (z / (t / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -13.5], N[Not[LessEqual[y, 5.2e+64]], $MachinePrecision]], N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(0.3333333333333333 / N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -13.5 \lor \neg \left(y \leq 5.2 \cdot 10^{+64}\right):\\
\;\;\;\;x - \frac{y}{z \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{0.3333333333333333}{\frac{z}{\frac{t}{y}}}\\
\end{array}
\end{array}
if y < -13.5 or 5.19999999999999994e64 < y Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
associate-+l+99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
unsub-neg99.9%
neg-mul-199.9%
associate-*l/99.8%
neg-mul-199.8%
times-frac99.8%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 97.5%
metadata-eval97.5%
cancel-sign-sub-inv97.5%
metadata-eval97.5%
distribute-lft-neg-in97.5%
associate-*r/97.5%
associate-*l/97.5%
*-commutative97.5%
distribute-rgt-neg-in97.5%
distribute-neg-frac97.5%
metadata-eval97.5%
Simplified97.5%
clear-num97.5%
un-div-inv97.6%
div-inv97.8%
metadata-eval97.8%
Applied egg-rr97.8%
if -13.5 < y < 5.19999999999999994e64Initial program 94.6%
sub-neg94.6%
distribute-frac-neg94.6%
associate-+l+94.6%
remove-double-neg94.6%
distribute-frac-neg94.6%
unsub-neg94.6%
neg-mul-194.6%
associate-*l/94.6%
neg-mul-194.6%
times-frac95.7%
distribute-lft-out--95.7%
*-commutative95.7%
associate-/r*95.6%
metadata-eval95.6%
Simplified95.6%
Taylor expanded in y around 0 86.6%
associate-*r/86.6%
*-commutative86.6%
times-frac87.4%
Simplified87.4%
associate-*l/87.5%
associate-/l*87.5%
Applied egg-rr87.5%
Final simplification91.2%
(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(Float64(-0.3333333333333333 / 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[(N[(-0.3333333333333333 / z), $MachinePrecision] * N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{-0.3333333333333333}{z} \cdot \left(\frac{t}{y} - y\right)
\end{array}
Initial program 96.5%
sub-neg96.5%
distribute-frac-neg96.5%
associate-+l+96.5%
remove-double-neg96.5%
distribute-frac-neg96.5%
unsub-neg96.5%
neg-mul-196.5%
associate-*l/96.5%
neg-mul-196.5%
times-frac97.2%
distribute-lft-out--97.2%
*-commutative97.2%
associate-/r*97.1%
metadata-eval97.1%
Simplified97.1%
Final simplification97.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(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 96.5%
sub-neg96.5%
distribute-frac-neg96.5%
associate-+l+96.5%
remove-double-neg96.5%
distribute-frac-neg96.5%
unsub-neg96.5%
neg-mul-196.5%
associate-*l/96.5%
neg-mul-196.5%
times-frac97.2%
distribute-lft-out--97.2%
*-commutative97.2%
associate-/r*97.1%
metadata-eval97.1%
Simplified97.1%
associate-*l/97.1%
Applied egg-rr97.1%
Final simplification97.1%
(FPCore (x y z t) :precision binary64 (- x (/ (- (/ t y) y) (* z -3.0))))
double code(double x, double y, double z, double t) {
return x - (((t / y) - 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 - (((t / y) - y) / (z * (-3.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return x - (((t / y) - y) / (z * -3.0));
}
def code(x, y, z, t): return x - (((t / y) - y) / (z * -3.0))
function code(x, y, z, t) return Float64(x - Float64(Float64(Float64(t / y) - y) / Float64(z * -3.0))) end
function tmp = code(x, y, z, t) tmp = x - (((t / y) - y) / (z * -3.0)); end
code[x_, y_, z_, t_] := N[(x - N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{\frac{t}{y} - y}{z \cdot -3}
\end{array}
Initial program 96.5%
sub-neg96.5%
distribute-frac-neg96.5%
associate-+l+96.5%
remove-double-neg96.5%
distribute-frac-neg96.5%
unsub-neg96.5%
neg-mul-196.5%
associate-*l/96.5%
neg-mul-196.5%
times-frac97.2%
distribute-lft-out--97.2%
*-commutative97.2%
associate-/r*97.1%
metadata-eval97.1%
Simplified97.1%
*-commutative97.1%
clear-num97.1%
un-div-inv97.2%
div-inv97.3%
metadata-eval97.3%
Applied egg-rr97.3%
Final simplification97.3%
(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 96.5%
Taylor expanded in t around 0 60.8%
Final simplification60.8%
(FPCore (x y z t) :precision binary64 (- x (/ y (* z 3.0))))
double code(double x, double y, double z, double t) {
return x - (y / (z * 3.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - (y / (z * 3.0d0))
end function
public static double code(double x, double y, double z, double t) {
return x - (y / (z * 3.0));
}
def code(x, y, z, t): return x - (y / (z * 3.0))
function code(x, y, z, t) return Float64(x - Float64(y / Float64(z * 3.0))) end
function tmp = code(x, y, z, t) tmp = x - (y / (z * 3.0)); end
code[x_, y_, z_, t_] := N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{z \cdot 3}
\end{array}
Initial program 96.5%
sub-neg96.5%
distribute-frac-neg96.5%
associate-+l+96.5%
remove-double-neg96.5%
distribute-frac-neg96.5%
unsub-neg96.5%
neg-mul-196.5%
associate-*l/96.5%
neg-mul-196.5%
times-frac97.2%
distribute-lft-out--97.2%
*-commutative97.2%
associate-/r*97.1%
metadata-eval97.1%
Simplified97.1%
Taylor expanded in y around inf 60.8%
metadata-eval60.8%
cancel-sign-sub-inv60.8%
metadata-eval60.8%
distribute-lft-neg-in60.8%
associate-*r/60.8%
associate-*l/60.8%
*-commutative60.8%
distribute-rgt-neg-in60.8%
distribute-neg-frac60.8%
metadata-eval60.8%
Simplified60.8%
clear-num60.8%
un-div-inv60.9%
div-inv60.9%
metadata-eval60.9%
Applied egg-rr60.9%
Final simplification60.9%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 96.5%
sub-neg96.5%
distribute-frac-neg96.5%
associate-+l+96.5%
remove-double-neg96.5%
distribute-frac-neg96.5%
unsub-neg96.5%
neg-mul-196.5%
associate-*l/96.5%
neg-mul-196.5%
times-frac97.2%
distribute-lft-out--97.2%
*-commutative97.2%
associate-/r*97.1%
metadata-eval97.1%
Simplified97.1%
Taylor expanded in x around inf 30.2%
Final simplification30.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 2024034
(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))))