
(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
(let* ((t_1 (- x (/ y (* z 3.0)))))
(if (<= t 2e-66)
(+ t_1 (/ (/ t (* z 3.0)) y))
(+ t_1 (/ t (* y (* z 3.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y / (z * 3.0));
double tmp;
if (t <= 2e-66) {
tmp = t_1 + ((t / (z * 3.0)) / y);
} else {
tmp = t_1 + (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) :: t_1
real(8) :: tmp
t_1 = x - (y / (z * 3.0d0))
if (t <= 2d-66) then
tmp = t_1 + ((t / (z * 3.0d0)) / y)
else
tmp = t_1 + (t / (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));
double tmp;
if (t <= 2e-66) {
tmp = t_1 + ((t / (z * 3.0)) / y);
} else {
tmp = t_1 + (t / (y * (z * 3.0)));
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (y / (z * 3.0)) tmp = 0 if t <= 2e-66: tmp = t_1 + ((t / (z * 3.0)) / y) else: tmp = t_1 + (t / (y * (z * 3.0))) return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(y / Float64(z * 3.0))) tmp = 0.0 if (t <= 2e-66) tmp = Float64(t_1 + Float64(Float64(t / Float64(z * 3.0)) / y)); else tmp = Float64(t_1 + Float64(t / Float64(y * Float64(z * 3.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (y / (z * 3.0)); tmp = 0.0; if (t <= 2e-66) tmp = t_1 + ((t / (z * 3.0)) / y); else tmp = t_1 + (t / (y * (z * 3.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 2e-66], N[(t$95$1 + N[(N[(t / N[(z * 3.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;t \leq 2 \cdot 10^{-66}:\\
\;\;\;\;t_1 + \frac{\frac{t}{z \cdot 3}}{y}\\
\mathbf{else}:\\
\;\;\;\;t_1 + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\end{array}
\end{array}
if t < 2e-66Initial program 96.1%
associate-/r*99.3%
Simplified99.3%
if 2e-66 < t Initial program 99.8%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.5e-38) (not (<= y 3.9e-146))) (+ x (* (- y (/ t y)) (/ -0.3333333333333333 z))) (+ x (/ (* 0.3333333333333333 (/ t z)) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.5e-38) || !(y <= 3.9e-146)) {
tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z));
} else {
tmp = x + ((0.3333333333333333 * (t / z)) / 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 <= (-7.5d-38)) .or. (.not. (y <= 3.9d-146))) then
tmp = x + ((y - (t / y)) * ((-0.3333333333333333d0) / z))
else
tmp = x + ((0.3333333333333333d0 * (t / z)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.5e-38) || !(y <= 3.9e-146)) {
tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z));
} else {
tmp = x + ((0.3333333333333333 * (t / z)) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.5e-38) or not (y <= 3.9e-146): tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)) else: tmp = x + ((0.3333333333333333 * (t / z)) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.5e-38) || !(y <= 3.9e-146)) tmp = Float64(x + Float64(Float64(y - Float64(t / y)) * Float64(-0.3333333333333333 / z))); else tmp = Float64(x + Float64(Float64(0.3333333333333333 * Float64(t / z)) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.5e-38) || ~((y <= 3.9e-146))) tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)); else tmp = x + ((0.3333333333333333 * (t / z)) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.5e-38], N[Not[LessEqual[y, 3.9e-146]], $MachinePrecision]], N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(0.3333333333333333 * N[(t / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{-38} \lor \neg \left(y \leq 3.9 \cdot 10^{-146}\right):\\
\;\;\;\;x + \left(y - \frac{t}{y}\right) \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{0.3333333333333333 \cdot \frac{t}{z}}{y}\\
\end{array}
\end{array}
if y < -7.5e-38 or 3.90000000000000002e-146 < y Initial program 98.8%
associate-+l-98.8%
sub-neg98.8%
sub-neg98.8%
distribute-neg-in98.8%
unsub-neg98.8%
neg-mul-198.8%
associate-*r/98.8%
associate-*l/98.7%
distribute-neg-frac98.7%
neg-mul-198.7%
times-frac98.7%
distribute-lft-out--98.7%
*-commutative98.7%
associate-/r*98.7%
metadata-eval98.7%
Simplified98.7%
if -7.5e-38 < y < 3.90000000000000002e-146Initial program 94.3%
associate-+l-94.3%
sub-neg94.3%
sub-neg94.3%
distribute-neg-in94.3%
unsub-neg94.3%
neg-mul-194.3%
associate-*r/94.3%
associate-*l/94.3%
distribute-neg-frac94.3%
neg-mul-194.3%
times-frac86.9%
distribute-lft-out--86.9%
*-commutative86.9%
associate-/r*86.9%
metadata-eval86.9%
Simplified86.9%
Taylor expanded in y around 0 94.2%
*-commutative94.2%
associate-*l/94.3%
times-frac86.9%
Simplified86.9%
associate-*l/99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 99.9%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- y (/ t y))))
(if (<= y -7.5e-38)
(+ x (/ t_1 (* z -3.0)))
(if (<= y 9.5e-149)
(+ x (/ (* 0.3333333333333333 (/ t z)) y))
(+ x (* t_1 (/ -0.3333333333333333 z)))))))
double code(double x, double y, double z, double t) {
double t_1 = y - (t / y);
double tmp;
if (y <= -7.5e-38) {
tmp = x + (t_1 / (z * -3.0));
} else if (y <= 9.5e-149) {
tmp = x + ((0.3333333333333333 * (t / z)) / y);
} else {
tmp = x + (t_1 * (-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) :: t_1
real(8) :: tmp
t_1 = y - (t / y)
if (y <= (-7.5d-38)) then
tmp = x + (t_1 / (z * (-3.0d0)))
else if (y <= 9.5d-149) then
tmp = x + ((0.3333333333333333d0 * (t / z)) / y)
else
tmp = x + (t_1 * ((-0.3333333333333333d0) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y - (t / y);
double tmp;
if (y <= -7.5e-38) {
tmp = x + (t_1 / (z * -3.0));
} else if (y <= 9.5e-149) {
tmp = x + ((0.3333333333333333 * (t / z)) / y);
} else {
tmp = x + (t_1 * (-0.3333333333333333 / z));
}
return tmp;
}
def code(x, y, z, t): t_1 = y - (t / y) tmp = 0 if y <= -7.5e-38: tmp = x + (t_1 / (z * -3.0)) elif y <= 9.5e-149: tmp = x + ((0.3333333333333333 * (t / z)) / y) else: tmp = x + (t_1 * (-0.3333333333333333 / z)) return tmp
function code(x, y, z, t) t_1 = Float64(y - Float64(t / y)) tmp = 0.0 if (y <= -7.5e-38) tmp = Float64(x + Float64(t_1 / Float64(z * -3.0))); elseif (y <= 9.5e-149) tmp = Float64(x + Float64(Float64(0.3333333333333333 * Float64(t / z)) / y)); else tmp = Float64(x + Float64(t_1 * Float64(-0.3333333333333333 / z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y - (t / y); tmp = 0.0; if (y <= -7.5e-38) tmp = x + (t_1 / (z * -3.0)); elseif (y <= 9.5e-149) tmp = x + ((0.3333333333333333 * (t / z)) / y); else tmp = x + (t_1 * (-0.3333333333333333 / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.5e-38], N[(x + N[(t$95$1 / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e-149], N[(x + N[(N[(0.3333333333333333 * N[(t / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - \frac{t}{y}\\
\mathbf{if}\;y \leq -7.5 \cdot 10^{-38}:\\
\;\;\;\;x + \frac{t_1}{z \cdot -3}\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-149}:\\
\;\;\;\;x + \frac{0.3333333333333333 \cdot \frac{t}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x + t_1 \cdot \frac{-0.3333333333333333}{z}\\
\end{array}
\end{array}
if y < -7.5e-38Initial program 98.8%
associate-+l-98.8%
sub-neg98.8%
sub-neg98.8%
distribute-neg-in98.8%
unsub-neg98.8%
neg-mul-198.8%
associate-*r/98.8%
associate-*l/98.8%
distribute-neg-frac98.8%
neg-mul-198.8%
times-frac99.8%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
clear-num99.7%
inv-pow99.7%
Applied egg-rr99.7%
unpow-199.7%
Simplified99.7%
associate-*l/99.6%
*-un-lft-identity99.6%
div-inv99.9%
metadata-eval99.9%
Applied egg-rr99.9%
if -7.5e-38 < y < 9.50000000000000034e-149Initial program 94.3%
associate-+l-94.3%
sub-neg94.3%
sub-neg94.3%
distribute-neg-in94.3%
unsub-neg94.3%
neg-mul-194.3%
associate-*r/94.3%
associate-*l/94.3%
distribute-neg-frac94.3%
neg-mul-194.3%
times-frac86.9%
distribute-lft-out--86.9%
*-commutative86.9%
associate-/r*86.9%
metadata-eval86.9%
Simplified86.9%
Taylor expanded in y around 0 94.2%
*-commutative94.2%
associate-*l/94.3%
times-frac86.9%
Simplified86.9%
associate-*l/99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 99.9%
if 9.50000000000000034e-149 < y Initial program 98.8%
associate-+l-98.8%
sub-neg98.8%
sub-neg98.8%
distribute-neg-in98.8%
unsub-neg98.8%
neg-mul-198.8%
associate-*r/98.8%
associate-*l/98.7%
distribute-neg-frac98.7%
neg-mul-198.7%
times-frac97.8%
distribute-lft-out--97.9%
*-commutative97.9%
associate-/r*97.9%
metadata-eval97.9%
Simplified97.9%
Final simplification99.1%
(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.3%
Final simplification97.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.45e-6) (not (<= y 3.7e+124))) (+ x (/ y (* z -3.0))) (+ x (* (/ t y) (/ 0.3333333333333333 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.45e-6) || !(y <= 3.7e+124)) {
tmp = x + (y / (z * -3.0));
} 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.45d-6)) .or. (.not. (y <= 3.7d+124))) then
tmp = x + (y / (z * (-3.0d0)))
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.45e-6) || !(y <= 3.7e+124)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = x + ((t / y) * (0.3333333333333333 / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.45e-6) or not (y <= 3.7e+124): tmp = x + (y / (z * -3.0)) else: tmp = x + ((t / y) * (0.3333333333333333 / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.45e-6) || !(y <= 3.7e+124)) tmp = Float64(x + Float64(y / Float64(z * -3.0))); else tmp = Float64(x + Float64(Float64(t / y) * Float64(0.3333333333333333 / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.45e-6) || ~((y <= 3.7e+124))) tmp = x + (y / (z * -3.0)); else tmp = x + ((t / y) * (0.3333333333333333 / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.45e-6], N[Not[LessEqual[y, 3.7e+124]], $MachinePrecision]], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t / y), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.45 \cdot 10^{-6} \lor \neg \left(y \leq 3.7 \cdot 10^{+124}\right):\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{y} \cdot \frac{0.3333333333333333}{z}\\
\end{array}
\end{array}
if y < -3.45e-6 or 3.70000000000000008e124 < y Initial program 99.2%
associate-+l-99.2%
sub-neg99.2%
sub-neg99.2%
distribute-neg-in99.2%
unsub-neg99.2%
neg-mul-199.2%
associate-*r/99.2%
associate-*l/99.1%
distribute-neg-frac99.1%
neg-mul-199.1%
times-frac99.8%
distribute-lft-out--99.8%
*-commutative99.8%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
associate-*l/99.6%
*-un-lft-identity99.6%
div-inv99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 95.7%
if -3.45e-6 < y < 3.70000000000000008e124Initial program 95.9%
associate-+l-95.9%
sub-neg95.9%
sub-neg95.9%
distribute-neg-in95.9%
unsub-neg95.9%
neg-mul-195.9%
associate-*r/95.9%
associate-*l/95.8%
distribute-neg-frac95.8%
neg-mul-195.8%
times-frac90.8%
distribute-lft-out--90.9%
*-commutative90.9%
associate-/r*90.9%
metadata-eval90.9%
Simplified90.9%
Taylor expanded in y around 0 89.0%
*-commutative89.0%
associate-*l/89.1%
times-frac83.5%
Simplified83.5%
Final simplification88.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.5e-8) (not (<= y 2.15e+29))) (+ x (/ y (* z -3.0))) (+ x (/ (* 0.3333333333333333 (/ t z)) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.5e-8) || !(y <= 2.15e+29)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = x + ((0.3333333333333333 * (t / z)) / 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 <= (-9.5d-8)) .or. (.not. (y <= 2.15d+29))) then
tmp = x + (y / (z * (-3.0d0)))
else
tmp = x + ((0.3333333333333333d0 * (t / z)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.5e-8) || !(y <= 2.15e+29)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = x + ((0.3333333333333333 * (t / z)) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9.5e-8) or not (y <= 2.15e+29): tmp = x + (y / (z * -3.0)) else: tmp = x + ((0.3333333333333333 * (t / z)) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9.5e-8) || !(y <= 2.15e+29)) tmp = Float64(x + Float64(y / Float64(z * -3.0))); else tmp = Float64(x + Float64(Float64(0.3333333333333333 * Float64(t / z)) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -9.5e-8) || ~((y <= 2.15e+29))) tmp = x + (y / (z * -3.0)); else tmp = x + ((0.3333333333333333 * (t / z)) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9.5e-8], N[Not[LessEqual[y, 2.15e+29]], $MachinePrecision]], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(0.3333333333333333 * N[(t / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{-8} \lor \neg \left(y \leq 2.15 \cdot 10^{+29}\right):\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{0.3333333333333333 \cdot \frac{t}{z}}{y}\\
\end{array}
\end{array}
if y < -9.50000000000000036e-8 or 2.1500000000000001e29 < y Initial program 99.2%
associate-+l-99.2%
sub-neg99.2%
sub-neg99.2%
distribute-neg-in99.2%
unsub-neg99.2%
neg-mul-199.2%
associate-*r/99.2%
associate-*l/99.1%
distribute-neg-frac99.1%
neg-mul-199.1%
times-frac99.8%
distribute-lft-out--99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
associate-*l/99.6%
*-un-lft-identity99.6%
div-inv99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 91.2%
if -9.50000000000000036e-8 < y < 2.1500000000000001e29Initial program 95.4%
associate-+l-95.4%
sub-neg95.4%
sub-neg95.4%
distribute-neg-in95.4%
unsub-neg95.4%
neg-mul-195.4%
associate-*r/95.4%
associate-*l/95.4%
distribute-neg-frac95.4%
neg-mul-195.4%
times-frac89.7%
distribute-lft-out--89.7%
*-commutative89.7%
associate-/r*89.7%
metadata-eval89.7%
Simplified89.7%
Taylor expanded in y around 0 92.6%
*-commutative92.6%
associate-*l/92.6%
times-frac86.3%
Simplified86.3%
associate-*l/96.4%
Applied egg-rr96.4%
Taylor expanded in t around 0 96.5%
Final simplification93.9%
(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.3%
associate-+l-97.3%
sub-neg97.3%
sub-neg97.3%
distribute-neg-in97.3%
unsub-neg97.3%
neg-mul-197.3%
associate-*r/97.3%
associate-*l/97.2%
distribute-neg-frac97.2%
neg-mul-197.2%
times-frac94.7%
distribute-lft-out--94.7%
*-commutative94.7%
associate-/r*94.7%
metadata-eval94.7%
Simplified94.7%
Taylor expanded in y around inf 65.5%
Final simplification65.5%
(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 97.3%
associate-+l-97.3%
sub-neg97.3%
sub-neg97.3%
distribute-neg-in97.3%
unsub-neg97.3%
neg-mul-197.3%
associate-*r/97.3%
associate-*l/97.2%
distribute-neg-frac97.2%
neg-mul-197.2%
times-frac94.7%
distribute-lft-out--94.7%
*-commutative94.7%
associate-/r*94.7%
metadata-eval94.7%
Simplified94.7%
clear-num94.7%
inv-pow94.7%
Applied egg-rr94.7%
unpow-194.7%
Simplified94.7%
associate-*l/94.6%
*-un-lft-identity94.6%
div-inv94.7%
metadata-eval94.7%
Applied egg-rr94.7%
Taylor expanded in y around inf 65.5%
Final simplification65.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 97.3%
associate-+l-97.3%
sub-neg97.3%
sub-neg97.3%
distribute-neg-in97.3%
unsub-neg97.3%
neg-mul-197.3%
associate-*r/97.3%
associate-*l/97.2%
distribute-neg-frac97.2%
neg-mul-197.2%
times-frac94.7%
distribute-lft-out--94.7%
*-commutative94.7%
associate-/r*94.7%
metadata-eval94.7%
Simplified94.7%
Taylor expanded in x around inf 31.6%
Final simplification31.6%
(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 2023182
(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))))