
(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 (if (<= t 8e+63) (+ x (fma -0.3333333333333333 (/ y z) (/ (/ (/ t z) y) 3.0))) (+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 8e+63) {
tmp = x + fma(-0.3333333333333333, (y / z), (((t / z) / y) / 3.0));
} else {
tmp = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 8e+63) tmp = Float64(x + fma(-0.3333333333333333, Float64(y / z), Float64(Float64(Float64(t / z) / y) / 3.0))); else tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(y * Float64(z * 3.0)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 8e+63], N[(x + N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + N[(N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8 \cdot 10^{+63}:\\
\;\;\;\;x + \mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, \frac{\frac{\frac{t}{z}}{y}}{3}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\end{array}
\end{array}
if t < 8.00000000000000046e63Initial program 94.0%
associate-+l-94.0%
sub-neg94.0%
sub-neg94.0%
distribute-neg-in94.0%
distribute-neg-frac94.0%
neg-mul-194.0%
*-commutative94.0%
times-frac94.0%
remove-double-neg94.0%
fma-def94.0%
metadata-eval94.0%
associate-*l*94.0%
associate-/r*99.8%
associate-/l/99.8%
Simplified99.8%
if 8.00000000000000046e63 < t Initial program 98.1%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (if (<= t 7.8e+133) (+ x (/ (* -0.3333333333333333 (- y (/ t y))) z)) (+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 7.8e+133) {
tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z);
} else {
tmp = (x - (y / (z * 3.0))) + (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 (t <= 7.8d+133) then
tmp = x + (((-0.3333333333333333d0) * (y - (t / y))) / z)
else
tmp = (x - (y / (z * 3.0d0))) + (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 (t <= 7.8e+133) {
tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z);
} else {
tmp = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 7.8e+133: tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z) else: tmp = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 7.8e+133) tmp = Float64(x + Float64(Float64(-0.3333333333333333 * Float64(y - Float64(t / y))) / z)); else tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(y * Float64(z * 3.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 7.8e+133) tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z); else tmp = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 7.8e+133], N[(x + N[(N[(-0.3333333333333333 * N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], 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}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 7.8 \cdot 10^{+133}:\\
\;\;\;\;x + \frac{-0.3333333333333333 \cdot \left(y - \frac{t}{y}\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\end{array}
\end{array}
if t < 7.80000000000000028e133Initial program 94.4%
associate-+l-94.4%
sub-neg94.4%
sub-neg94.4%
distribute-neg-in94.4%
unsub-neg94.4%
neg-mul-194.4%
associate-*r/94.4%
associate-*l/94.4%
distribute-neg-frac94.4%
neg-mul-194.4%
times-frac98.4%
distribute-lft-out--98.4%
*-commutative98.4%
associate-/r*98.4%
metadata-eval98.4%
Simplified98.4%
associate-*l/98.5%
Applied egg-rr98.5%
if 7.80000000000000028e133 < t Initial program 97.5%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ y (* z 3.0)))))
(if (<= t 2.55e+107)
(+ 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 <= 2.55e+107) {
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 <= 2.55d+107) 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 <= 2.55e+107) {
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 <= 2.55e+107: 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 <= 2.55e+107) 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 <= 2.55e+107) 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, 2.55e+107], 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.55 \cdot 10^{+107}:\\
\;\;\;\;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 < 2.5500000000000001e107Initial program 94.2%
associate-/r*99.8%
Simplified99.8%
if 2.5500000000000001e107 < t Initial program 97.9%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2e-123) (not (<= y 2.3e-89))) (+ x (* (- y (/ t y)) (/ -0.3333333333333333 z))) (+ x (* (/ t z) (/ 0.3333333333333333 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2e-123) || !(y <= 2.3e-89)) {
tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z));
} else {
tmp = x + ((t / z) * (0.3333333333333333 / 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 <= (-2d-123)) .or. (.not. (y <= 2.3d-89))) then
tmp = x + ((y - (t / y)) * ((-0.3333333333333333d0) / z))
else
tmp = x + ((t / z) * (0.3333333333333333d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2e-123) || !(y <= 2.3e-89)) {
tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z));
} else {
tmp = x + ((t / z) * (0.3333333333333333 / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2e-123) or not (y <= 2.3e-89): tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)) else: tmp = x + ((t / z) * (0.3333333333333333 / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2e-123) || !(y <= 2.3e-89)) tmp = Float64(x + Float64(Float64(y - Float64(t / y)) * Float64(-0.3333333333333333 / z))); else tmp = Float64(x + Float64(Float64(t / z) * Float64(0.3333333333333333 / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2e-123) || ~((y <= 2.3e-89))) tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)); else tmp = x + ((t / z) * (0.3333333333333333 / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2e-123], N[Not[LessEqual[y, 2.3e-89]], $MachinePrecision]], N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-123} \lor \neg \left(y \leq 2.3 \cdot 10^{-89}\right):\\
\;\;\;\;x + \left(y - \frac{t}{y}\right) \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\end{array}
\end{array}
if y < -2.0000000000000001e-123 or 2.3e-89 < y Initial program 98.1%
associate-+l-98.1%
sub-neg98.1%
sub-neg98.1%
distribute-neg-in98.1%
unsub-neg98.1%
neg-mul-198.1%
associate-*r/98.1%
associate-*l/98.1%
distribute-neg-frac98.1%
neg-mul-198.1%
times-frac98.1%
distribute-lft-out--98.7%
*-commutative98.7%
associate-/r*98.7%
metadata-eval98.7%
Simplified98.7%
if -2.0000000000000001e-123 < y < 2.3e-89Initial program 88.7%
associate-+l-88.7%
sub-neg88.7%
sub-neg88.7%
distribute-neg-in88.7%
unsub-neg88.7%
neg-mul-188.7%
associate-*r/88.7%
associate-*l/88.7%
distribute-neg-frac88.7%
neg-mul-188.7%
times-frac90.0%
distribute-lft-out--90.0%
*-commutative90.0%
associate-/r*90.0%
metadata-eval90.0%
Simplified90.0%
Taylor expanded in y around 0 88.8%
+-commutative88.8%
metadata-eval88.8%
cancel-sign-sub-inv88.8%
associate-/r*90.0%
associate-*r/90.0%
associate-*r/90.0%
div-sub90.0%
distribute-lft-out--90.0%
associate-/l*90.0%
Simplified90.0%
Taylor expanded in t around inf 88.8%
associate-/l*99.8%
Simplified99.8%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- y (/ t y))))
(if (<= y -9.5e-125)
(+ x (* t_1 (/ -0.3333333333333333 z)))
(if (<= y 1.36e-89)
(+ x (* (/ t z) (/ 0.3333333333333333 y)))
(+ x (/ (* -0.3333333333333333 t_1) z))))))
double code(double x, double y, double z, double t) {
double t_1 = y - (t / y);
double tmp;
if (y <= -9.5e-125) {
tmp = x + (t_1 * (-0.3333333333333333 / z));
} else if (y <= 1.36e-89) {
tmp = x + ((t / z) * (0.3333333333333333 / y));
} else {
tmp = x + ((-0.3333333333333333 * t_1) / 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 <= (-9.5d-125)) then
tmp = x + (t_1 * ((-0.3333333333333333d0) / z))
else if (y <= 1.36d-89) then
tmp = x + ((t / z) * (0.3333333333333333d0 / y))
else
tmp = x + (((-0.3333333333333333d0) * t_1) / 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 <= -9.5e-125) {
tmp = x + (t_1 * (-0.3333333333333333 / z));
} else if (y <= 1.36e-89) {
tmp = x + ((t / z) * (0.3333333333333333 / y));
} else {
tmp = x + ((-0.3333333333333333 * t_1) / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = y - (t / y) tmp = 0 if y <= -9.5e-125: tmp = x + (t_1 * (-0.3333333333333333 / z)) elif y <= 1.36e-89: tmp = x + ((t / z) * (0.3333333333333333 / y)) else: tmp = x + ((-0.3333333333333333 * t_1) / z) return tmp
function code(x, y, z, t) t_1 = Float64(y - Float64(t / y)) tmp = 0.0 if (y <= -9.5e-125) tmp = Float64(x + Float64(t_1 * Float64(-0.3333333333333333 / z))); elseif (y <= 1.36e-89) tmp = Float64(x + Float64(Float64(t / z) * Float64(0.3333333333333333 / y))); else tmp = Float64(x + Float64(Float64(-0.3333333333333333 * t_1) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y - (t / y); tmp = 0.0; if (y <= -9.5e-125) tmp = x + (t_1 * (-0.3333333333333333 / z)); elseif (y <= 1.36e-89) tmp = x + ((t / z) * (0.3333333333333333 / y)); else tmp = x + ((-0.3333333333333333 * t_1) / 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, -9.5e-125], N[(x + N[(t$95$1 * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.36e-89], N[(x + N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-0.3333333333333333 * t$95$1), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - \frac{t}{y}\\
\mathbf{if}\;y \leq -9.5 \cdot 10^{-125}:\\
\;\;\;\;x + t_1 \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 1.36 \cdot 10^{-89}:\\
\;\;\;\;x + \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-0.3333333333333333 \cdot t_1}{z}\\
\end{array}
\end{array}
if y < -9.50000000000000031e-125Initial program 98.0%
associate-+l-98.0%
sub-neg98.0%
sub-neg98.0%
distribute-neg-in98.0%
unsub-neg98.0%
neg-mul-198.0%
associate-*r/98.0%
associate-*l/98.0%
distribute-neg-frac98.0%
neg-mul-198.0%
times-frac97.2%
distribute-lft-out--98.1%
*-commutative98.1%
associate-/r*98.1%
metadata-eval98.1%
Simplified98.1%
if -9.50000000000000031e-125 < y < 1.35999999999999998e-89Initial program 88.7%
associate-+l-88.7%
sub-neg88.7%
sub-neg88.7%
distribute-neg-in88.7%
unsub-neg88.7%
neg-mul-188.7%
associate-*r/88.7%
associate-*l/88.7%
distribute-neg-frac88.7%
neg-mul-188.7%
times-frac90.0%
distribute-lft-out--90.0%
*-commutative90.0%
associate-/r*90.0%
metadata-eval90.0%
Simplified90.0%
Taylor expanded in y around 0 88.8%
+-commutative88.8%
metadata-eval88.8%
cancel-sign-sub-inv88.8%
associate-/r*90.0%
associate-*r/90.0%
associate-*r/90.0%
div-sub90.0%
distribute-lft-out--90.0%
associate-/l*90.0%
Simplified90.0%
Taylor expanded in t around inf 88.8%
associate-/l*99.8%
Simplified99.8%
associate-/r/99.9%
Applied egg-rr99.9%
if 1.35999999999999998e-89 < 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.7%
distribute-lft-out--99.7%
*-commutative99.7%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
associate-*l/99.8%
Applied egg-rr99.8%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8.8e+28) (not (<= y 4.3e+40))) (- x (/ y (* z 3.0))) (+ x (* t (/ 0.3333333333333333 (* y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8.8e+28) || !(y <= 4.3e+40)) {
tmp = x - (y / (z * 3.0));
} 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 <= (-8.8d+28)) .or. (.not. (y <= 4.3d+40))) then
tmp = x - (y / (z * 3.0d0))
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 <= -8.8e+28) || !(y <= 4.3e+40)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + (t * (0.3333333333333333 / (y * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -8.8e+28) or not (y <= 4.3e+40): tmp = x - (y / (z * 3.0)) else: tmp = x + (t * (0.3333333333333333 / (y * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -8.8e+28) || !(y <= 4.3e+40)) tmp = Float64(x - Float64(y / Float64(z * 3.0))); 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 <= -8.8e+28) || ~((y <= 4.3e+40))) tmp = x - (y / (z * 3.0)); else tmp = x + (t * (0.3333333333333333 / (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8.8e+28], N[Not[LessEqual[y, 4.3e+40]], $MachinePrecision]], N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $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 -8.8 \cdot 10^{+28} \lor \neg \left(y \leq 4.3 \cdot 10^{+40}\right):\\
\;\;\;\;x - \frac{y}{z \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{0.3333333333333333}{y \cdot z}\\
\end{array}
\end{array}
if y < -8.79999999999999946e28 or 4.3000000000000002e40 < y Initial program 98.1%
Taylor expanded in t around 0 95.6%
clear-num95.6%
un-div-inv95.6%
Applied egg-rr95.6%
associate-/r/95.6%
Applied egg-rr95.6%
*-commutative95.6%
clear-num95.6%
un-div-inv95.6%
div-inv95.7%
metadata-eval95.7%
Applied egg-rr95.7%
if -8.79999999999999946e28 < y < 4.3000000000000002e40Initial program 92.3%
associate-+l-92.3%
sub-neg92.3%
sub-neg92.3%
distribute-neg-in92.3%
unsub-neg92.3%
neg-mul-192.3%
associate-*r/92.3%
associate-*l/92.3%
distribute-neg-frac92.3%
neg-mul-192.3%
times-frac92.4%
distribute-lft-out--92.4%
*-commutative92.4%
associate-/r*92.4%
metadata-eval92.4%
Simplified92.4%
Taylor expanded in y around 0 88.2%
metadata-eval88.2%
times-frac88.2%
associate-*r*88.2%
*-commutative88.2%
associate-*l/87.5%
*-commutative87.5%
*-commutative87.5%
associate-*r*87.5%
associate-/r*87.5%
metadata-eval87.5%
Simplified87.5%
Final simplification91.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.55e+29) (not (<= y 1.45e+37))) (- x (/ y (* z 3.0))) (+ x (* (/ t z) (/ 0.3333333333333333 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.55e+29) || !(y <= 1.45e+37)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + ((t / z) * (0.3333333333333333 / 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 <= (-1.55d+29)) .or. (.not. (y <= 1.45d+37))) then
tmp = x - (y / (z * 3.0d0))
else
tmp = x + ((t / z) * (0.3333333333333333d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.55e+29) || !(y <= 1.45e+37)) {
tmp = x - (y / (z * 3.0));
} else {
tmp = x + ((t / z) * (0.3333333333333333 / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.55e+29) or not (y <= 1.45e+37): tmp = x - (y / (z * 3.0)) else: tmp = x + ((t / z) * (0.3333333333333333 / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.55e+29) || !(y <= 1.45e+37)) tmp = Float64(x - Float64(y / Float64(z * 3.0))); else tmp = Float64(x + Float64(Float64(t / z) * Float64(0.3333333333333333 / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.55e+29) || ~((y <= 1.45e+37))) tmp = x - (y / (z * 3.0)); else tmp = x + ((t / z) * (0.3333333333333333 / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.55e+29], N[Not[LessEqual[y, 1.45e+37]], $MachinePrecision]], N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{+29} \lor \neg \left(y \leq 1.45 \cdot 10^{+37}\right):\\
\;\;\;\;x - \frac{y}{z \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\end{array}
\end{array}
if y < -1.5499999999999999e29 or 1.44999999999999989e37 < y Initial program 98.1%
Taylor expanded in t around 0 95.6%
clear-num95.6%
un-div-inv95.6%
Applied egg-rr95.6%
associate-/r/95.6%
Applied egg-rr95.6%
*-commutative95.6%
clear-num95.6%
un-div-inv95.6%
div-inv95.7%
metadata-eval95.7%
Applied egg-rr95.7%
if -1.5499999999999999e29 < y < 1.44999999999999989e37Initial program 92.3%
associate-+l-92.3%
sub-neg92.3%
sub-neg92.3%
distribute-neg-in92.3%
unsub-neg92.3%
neg-mul-192.3%
associate-*r/92.3%
associate-*l/92.3%
distribute-neg-frac92.3%
neg-mul-192.3%
times-frac92.4%
distribute-lft-out--92.4%
*-commutative92.4%
associate-/r*92.4%
metadata-eval92.4%
Simplified92.4%
Taylor expanded in y around 0 92.4%
+-commutative92.4%
metadata-eval92.4%
cancel-sign-sub-inv92.4%
associate-/r*92.5%
associate-*r/92.5%
associate-*r/92.5%
div-sub92.5%
distribute-lft-out--92.5%
associate-/l*92.4%
Simplified92.4%
Taylor expanded in t around inf 88.2%
associate-/l*94.9%
Simplified94.9%
associate-/r/94.9%
Applied egg-rr94.9%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (- x (* (/ y z) 0.3333333333333333)))
double code(double x, double y, double z, double t) {
return x - ((y / z) * 0.3333333333333333);
}
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) * 0.3333333333333333d0)
end function
public static double code(double x, double y, double z, double t) {
return x - ((y / z) * 0.3333333333333333);
}
def code(x, y, z, t): return x - ((y / z) * 0.3333333333333333)
function code(x, y, z, t) return Float64(x - Float64(Float64(y / z) * 0.3333333333333333)) end
function tmp = code(x, y, z, t) tmp = x - ((y / z) * 0.3333333333333333); end
code[x_, y_, z_, t_] := N[(x - N[(N[(y / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{z} \cdot 0.3333333333333333
\end{array}
Initial program 95.0%
Taylor expanded in t around 0 64.3%
Final simplification64.3%
(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 95.0%
Taylor expanded in t around 0 64.3%
clear-num64.3%
un-div-inv64.3%
Applied egg-rr64.3%
associate-/r/64.3%
Applied egg-rr64.3%
*-commutative64.3%
clear-num64.3%
un-div-inv64.3%
div-inv64.3%
metadata-eval64.3%
Applied egg-rr64.3%
Final simplification64.3%
(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 95.0%
associate-+l-95.0%
sub-neg95.0%
sub-neg95.0%
distribute-neg-in95.0%
unsub-neg95.0%
neg-mul-195.0%
associate-*r/95.0%
associate-*l/95.0%
distribute-neg-frac95.0%
neg-mul-195.0%
times-frac95.4%
distribute-lft-out--95.8%
*-commutative95.8%
associate-/r*95.8%
metadata-eval95.8%
Simplified95.8%
Taylor expanded in x around inf 33.0%
Final simplification33.0%
(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 2023257
(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))))