
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - ((z * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - ((z * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\end{array}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (<= t_1 (- INFINITY))
(- (* y (/ x (* a 2.0))) (* t (/ (* z 9.0) (* a 2.0))))
(if (<= t_1 1e+286)
(/ (fma x (/ y 2.0) (* t (* z -4.5))) a)
(* z (fma -4.5 (/ t a) (* 0.5 (* x (/ y (* z a))))))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (y * (x / (a * 2.0))) - (t * ((z * 9.0) / (a * 2.0)));
} else if (t_1 <= 1e+286) {
tmp = fma(x, (y / 2.0), (t * (z * -4.5))) / a;
} else {
tmp = z * fma(-4.5, (t / a), (0.5 * (x * (y / (z * a)))));
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(y * Float64(x / Float64(a * 2.0))) - Float64(t * Float64(Float64(z * 9.0) / Float64(a * 2.0)))); elseif (t_1 <= 1e+286) tmp = Float64(fma(x, Float64(y / 2.0), Float64(t * Float64(z * -4.5))) / a); else tmp = Float64(z * fma(-4.5, Float64(t / a), Float64(0.5 * Float64(x * Float64(y / Float64(z * a)))))); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y * N[(x / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t * N[(N[(z * 9.0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+286], N[(N[(x * N[(y / 2.0), $MachinePrecision] + N[(t * N[(z * -4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(z * N[(-4.5 * N[(t / a), $MachinePrecision] + N[(0.5 * N[(x * N[(y / N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;y \cdot \frac{x}{a \cdot 2} - t \cdot \frac{z \cdot 9}{a \cdot 2}\\
\mathbf{elif}\;t\_1 \leq 10^{+286}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{y}{2}, t \cdot \left(z \cdot -4.5\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{fma}\left(-4.5, \frac{t}{a}, 0.5 \cdot \left(x \cdot \frac{y}{z \cdot a}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < -inf.0Initial program 74.3%
div-sub74.3%
*-commutative74.3%
associate-/l*90.0%
*-commutative90.0%
associate-/l*96.3%
Applied egg-rr96.3%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < 1.00000000000000003e286Initial program 99.2%
associate-/l/99.6%
div-sub99.6%
associate-/l*99.6%
fma-neg99.6%
*-commutative99.6%
associate-/l*99.6%
distribute-rgt-neg-out99.6%
distribute-frac-neg99.6%
distribute-rgt-neg-in99.6%
associate-/l*99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
if 1.00000000000000003e286 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) Initial program 63.1%
Taylor expanded in z around inf 78.8%
fma-define78.8%
associate-/l*82.5%
*-commutative82.5%
Simplified82.5%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* a 2.0) 5e+37) (/ (fma x y (* z (* t -9.0))) (* a 2.0)) (- (* y (/ x (* a 2.0))) (* t (/ (* z 9.0) (* a 2.0))))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 2.0) <= 5e+37) {
tmp = fma(x, y, (z * (t * -9.0))) / (a * 2.0);
} else {
tmp = (y * (x / (a * 2.0))) - (t * ((z * 9.0) / (a * 2.0)));
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 2.0) <= 5e+37) tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) / Float64(a * 2.0)); else tmp = Float64(Float64(y * Float64(x / Float64(a * 2.0))) - Float64(t * Float64(Float64(z * 9.0) / Float64(a * 2.0)))); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a * 2.0), $MachinePrecision], 5e+37], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(x / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t * N[(N[(z * 9.0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq 5 \cdot 10^{+37}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a \cdot 2} - t \cdot \frac{z \cdot 9}{a \cdot 2}\\
\end{array}
\end{array}
if (*.f64 a #s(literal 2 binary64)) < 4.99999999999999989e37Initial program 93.5%
div-sub92.6%
*-commutative92.6%
div-sub93.5%
cancel-sign-sub-inv93.5%
*-commutative93.5%
fma-define94.5%
distribute-rgt-neg-in94.5%
associate-*r*94.0%
distribute-lft-neg-in94.0%
*-commutative94.0%
distribute-rgt-neg-in94.0%
metadata-eval94.0%
Simplified94.0%
if 4.99999999999999989e37 < (*.f64 a #s(literal 2 binary64)) Initial program 87.1%
div-sub87.0%
*-commutative87.0%
associate-/l*86.9%
*-commutative86.9%
associate-/l*91.0%
Applied egg-rr91.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (<= t_1 -5e+264)
(- (* y (/ x (* a 2.0))) (* t (/ (* z 9.0) (* a 2.0))))
(if (<= t_1 1e+286)
(/ t_1 (* a 2.0))
(* z (+ (* -4.5 (/ t a)) (* 0.5 (/ (* x y) (* z a)))))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if (t_1 <= -5e+264) {
tmp = (y * (x / (a * 2.0))) - (t * ((z * 9.0) / (a * 2.0)));
} else if (t_1 <= 1e+286) {
tmp = t_1 / (a * 2.0);
} else {
tmp = z * ((-4.5 * (t / a)) + (0.5 * ((x * y) / (z * a))));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) - ((z * 9.0d0) * t)
if (t_1 <= (-5d+264)) then
tmp = (y * (x / (a * 2.0d0))) - (t * ((z * 9.0d0) / (a * 2.0d0)))
else if (t_1 <= 1d+286) then
tmp = t_1 / (a * 2.0d0)
else
tmp = z * (((-4.5d0) * (t / a)) + (0.5d0 * ((x * y) / (z * a))))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if (t_1 <= -5e+264) {
tmp = (y * (x / (a * 2.0))) - (t * ((z * 9.0) / (a * 2.0)));
} else if (t_1 <= 1e+286) {
tmp = t_1 / (a * 2.0);
} else {
tmp = z * ((-4.5 * (t / a)) + (0.5 * ((x * y) / (z * a))));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - ((z * 9.0) * t) tmp = 0 if t_1 <= -5e+264: tmp = (y * (x / (a * 2.0))) - (t * ((z * 9.0) / (a * 2.0))) elif t_1 <= 1e+286: tmp = t_1 / (a * 2.0) else: tmp = z * ((-4.5 * (t / a)) + (0.5 * ((x * y) / (z * a)))) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) tmp = 0.0 if (t_1 <= -5e+264) tmp = Float64(Float64(y * Float64(x / Float64(a * 2.0))) - Float64(t * Float64(Float64(z * 9.0) / Float64(a * 2.0)))); elseif (t_1 <= 1e+286) tmp = Float64(t_1 / Float64(a * 2.0)); else tmp = Float64(z * Float64(Float64(-4.5 * Float64(t / a)) + Float64(0.5 * Float64(Float64(x * y) / Float64(z * a))))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - ((z * 9.0) * t);
tmp = 0.0;
if (t_1 <= -5e+264)
tmp = (y * (x / (a * 2.0))) - (t * ((z * 9.0) / (a * 2.0)));
elseif (t_1 <= 1e+286)
tmp = t_1 / (a * 2.0);
else
tmp = z * ((-4.5 * (t / a)) + (0.5 * ((x * y) / (z * a))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+264], N[(N[(y * N[(x / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t * N[(N[(z * 9.0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+286], N[(t$95$1 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(-4.5 * N[(t / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(x * y), $MachinePrecision] / N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+264}:\\
\;\;\;\;y \cdot \frac{x}{a \cdot 2} - t \cdot \frac{z \cdot 9}{a \cdot 2}\\
\mathbf{elif}\;t\_1 \leq 10^{+286}:\\
\;\;\;\;\frac{t\_1}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-4.5 \cdot \frac{t}{a} + 0.5 \cdot \frac{x \cdot y}{z \cdot a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < -5.00000000000000033e264Initial program 78.3%
div-sub78.3%
*-commutative78.3%
associate-/l*90.1%
*-commutative90.1%
associate-/l*94.8%
Applied egg-rr94.8%
if -5.00000000000000033e264 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < 1.00000000000000003e286Initial program 99.6%
if 1.00000000000000003e286 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) Initial program 63.1%
Taylor expanded in z around inf 78.8%
Final simplification96.6%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (<= t_1 -5e+264)
(+ (* -4.5 (/ (* z t) a)) (* 0.5 (* y (/ x a))))
(if (<= t_1 1e+286)
(/ t_1 (* a 2.0))
(* z (+ (* -4.5 (/ t a)) (* 0.5 (/ (* x y) (* z a)))))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if (t_1 <= -5e+264) {
tmp = (-4.5 * ((z * t) / a)) + (0.5 * (y * (x / a)));
} else if (t_1 <= 1e+286) {
tmp = t_1 / (a * 2.0);
} else {
tmp = z * ((-4.5 * (t / a)) + (0.5 * ((x * y) / (z * a))));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) - ((z * 9.0d0) * t)
if (t_1 <= (-5d+264)) then
tmp = ((-4.5d0) * ((z * t) / a)) + (0.5d0 * (y * (x / a)))
else if (t_1 <= 1d+286) then
tmp = t_1 / (a * 2.0d0)
else
tmp = z * (((-4.5d0) * (t / a)) + (0.5d0 * ((x * y) / (z * a))))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if (t_1 <= -5e+264) {
tmp = (-4.5 * ((z * t) / a)) + (0.5 * (y * (x / a)));
} else if (t_1 <= 1e+286) {
tmp = t_1 / (a * 2.0);
} else {
tmp = z * ((-4.5 * (t / a)) + (0.5 * ((x * y) / (z * a))));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - ((z * 9.0) * t) tmp = 0 if t_1 <= -5e+264: tmp = (-4.5 * ((z * t) / a)) + (0.5 * (y * (x / a))) elif t_1 <= 1e+286: tmp = t_1 / (a * 2.0) else: tmp = z * ((-4.5 * (t / a)) + (0.5 * ((x * y) / (z * a)))) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) tmp = 0.0 if (t_1 <= -5e+264) tmp = Float64(Float64(-4.5 * Float64(Float64(z * t) / a)) + Float64(0.5 * Float64(y * Float64(x / a)))); elseif (t_1 <= 1e+286) tmp = Float64(t_1 / Float64(a * 2.0)); else tmp = Float64(z * Float64(Float64(-4.5 * Float64(t / a)) + Float64(0.5 * Float64(Float64(x * y) / Float64(z * a))))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - ((z * 9.0) * t);
tmp = 0.0;
if (t_1 <= -5e+264)
tmp = (-4.5 * ((z * t) / a)) + (0.5 * (y * (x / a)));
elseif (t_1 <= 1e+286)
tmp = t_1 / (a * 2.0);
else
tmp = z * ((-4.5 * (t / a)) + (0.5 * ((x * y) / (z * a))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+264], N[(N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+286], N[(t$95$1 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(-4.5 * N[(t / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(x * y), $MachinePrecision] / N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+264}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a} + 0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+286}:\\
\;\;\;\;\frac{t\_1}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-4.5 \cdot \frac{t}{a} + 0.5 \cdot \frac{x \cdot y}{z \cdot a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < -5.00000000000000033e264Initial program 78.3%
Taylor expanded in x around 0 80.8%
div-inv80.8%
*-commutative80.8%
associate-*l*92.6%
div-inv92.6%
Applied egg-rr92.6%
if -5.00000000000000033e264 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < 1.00000000000000003e286Initial program 99.6%
if 1.00000000000000003e286 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) Initial program 63.1%
Taylor expanded in z around inf 78.8%
Final simplification96.3%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (<= t_1 -5e+264)
(+ (* -4.5 (/ (* z t) a)) (* 0.5 (* y (/ x a))))
(if (<= t_1 1e+246)
(/ t_1 (* a 2.0))
(+ (* -4.5 (* z (/ t a))) (* 0.5 (/ (* x y) a)))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if (t_1 <= -5e+264) {
tmp = (-4.5 * ((z * t) / a)) + (0.5 * (y * (x / a)));
} else if (t_1 <= 1e+246) {
tmp = t_1 / (a * 2.0);
} else {
tmp = (-4.5 * (z * (t / a))) + (0.5 * ((x * y) / a));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) - ((z * 9.0d0) * t)
if (t_1 <= (-5d+264)) then
tmp = ((-4.5d0) * ((z * t) / a)) + (0.5d0 * (y * (x / a)))
else if (t_1 <= 1d+246) then
tmp = t_1 / (a * 2.0d0)
else
tmp = ((-4.5d0) * (z * (t / a))) + (0.5d0 * ((x * y) / a))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if (t_1 <= -5e+264) {
tmp = (-4.5 * ((z * t) / a)) + (0.5 * (y * (x / a)));
} else if (t_1 <= 1e+246) {
tmp = t_1 / (a * 2.0);
} else {
tmp = (-4.5 * (z * (t / a))) + (0.5 * ((x * y) / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - ((z * 9.0) * t) tmp = 0 if t_1 <= -5e+264: tmp = (-4.5 * ((z * t) / a)) + (0.5 * (y * (x / a))) elif t_1 <= 1e+246: tmp = t_1 / (a * 2.0) else: tmp = (-4.5 * (z * (t / a))) + (0.5 * ((x * y) / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) tmp = 0.0 if (t_1 <= -5e+264) tmp = Float64(Float64(-4.5 * Float64(Float64(z * t) / a)) + Float64(0.5 * Float64(y * Float64(x / a)))); elseif (t_1 <= 1e+246) tmp = Float64(t_1 / Float64(a * 2.0)); else tmp = Float64(Float64(-4.5 * Float64(z * Float64(t / a))) + Float64(0.5 * Float64(Float64(x * y) / a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - ((z * 9.0) * t);
tmp = 0.0;
if (t_1 <= -5e+264)
tmp = (-4.5 * ((z * t) / a)) + (0.5 * (y * (x / a)));
elseif (t_1 <= 1e+246)
tmp = t_1 / (a * 2.0);
else
tmp = (-4.5 * (z * (t / a))) + (0.5 * ((x * y) / a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+264], N[(N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+246], N[(t$95$1 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+264}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a} + 0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+246}:\\
\;\;\;\;\frac{t\_1}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right) + 0.5 \cdot \frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < -5.00000000000000033e264Initial program 78.3%
Taylor expanded in x around 0 80.8%
div-inv80.8%
*-commutative80.8%
associate-*l*92.6%
div-inv92.6%
Applied egg-rr92.6%
if -5.00000000000000033e264 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) < 1.00000000000000007e246Initial program 99.7%
if 1.00000000000000007e246 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z #s(literal 9 binary64)) t)) Initial program 66.6%
Taylor expanded in x around 0 66.6%
*-commutative66.6%
associate-*l/66.6%
associate-*r*66.6%
Applied egg-rr66.6%
Taylor expanded in t around 0 66.6%
associate-*l/81.0%
Simplified81.0%
Final simplification96.3%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (* z 9.0) t)))
(if (<= t_1 (- INFINITY))
(* t (/ (* z -4.5) a))
(if (<= t_1 5e+292)
(/ (- (* x y) t_1) (* a 2.0))
(* z (* t (/ -4.5 a)))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (z * 9.0) * t;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t * ((z * -4.5) / a);
} else if (t_1 <= 5e+292) {
tmp = ((x * y) - t_1) / (a * 2.0);
} else {
tmp = z * (t * (-4.5 / a));
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z * 9.0) * t;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t * ((z * -4.5) / a);
} else if (t_1 <= 5e+292) {
tmp = ((x * y) - t_1) / (a * 2.0);
} else {
tmp = z * (t * (-4.5 / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (z * 9.0) * t tmp = 0 if t_1 <= -math.inf: tmp = t * ((z * -4.5) / a) elif t_1 <= 5e+292: tmp = ((x * y) - t_1) / (a * 2.0) else: tmp = z * (t * (-4.5 / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(z * 9.0) * t) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(t * Float64(Float64(z * -4.5) / a)); elseif (t_1 <= 5e+292) tmp = Float64(Float64(Float64(x * y) - t_1) / Float64(a * 2.0)); else tmp = Float64(z * Float64(t * Float64(-4.5 / a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (z * 9.0) * t;
tmp = 0.0;
if (t_1 <= -Inf)
tmp = t * ((z * -4.5) / a);
elseif (t_1 <= 5e+292)
tmp = ((x * y) - t_1) / (a * 2.0);
else
tmp = z * (t * (-4.5 / a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(t * N[(N[(z * -4.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+292], N[(N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(t * N[(-4.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t \cdot \frac{z \cdot -4.5}{a}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+292}:\\
\;\;\;\;\frac{x \cdot y - t\_1}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t \cdot \frac{-4.5}{a}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 z #s(literal 9 binary64)) t) < -inf.0Initial program 57.6%
Taylor expanded in x around 0 57.6%
*-commutative57.6%
associate-/l*99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r/99.6%
Simplified99.6%
if -inf.0 < (*.f64 (*.f64 z #s(literal 9 binary64)) t) < 4.9999999999999996e292Initial program 96.0%
if 4.9999999999999996e292 < (*.f64 (*.f64 z #s(literal 9 binary64)) t) Initial program 69.7%
Taylor expanded in x around 0 82.2%
associate-*r/82.2%
*-commutative82.2%
associate-*r*82.2%
*-commutative82.2%
Simplified82.2%
associate-*r/99.8%
associate-*r/99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.9%
Applied egg-rr99.9%
*-commutative99.9%
clear-num99.9%
div-inv99.8%
div-inv99.8%
associate-/r*99.8%
*-commutative99.8%
Applied egg-rr99.8%
associate-/r/99.8%
/-rgt-identity99.8%
associate-/l*99.9%
Applied egg-rr99.9%
Final simplification96.4%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -2e+106) (* 0.5 (/ x (/ a y))) (if (<= (* x y) 1e+32) (/ (* t (* z -4.5)) a) (* 0.5 (* y (/ x a))))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+106) {
tmp = 0.5 * (x / (a / y));
} else if ((x * y) <= 1e+32) {
tmp = (t * (z * -4.5)) / a;
} else {
tmp = 0.5 * (y * (x / a));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= (-2d+106)) then
tmp = 0.5d0 * (x / (a / y))
else if ((x * y) <= 1d+32) then
tmp = (t * (z * (-4.5d0))) / a
else
tmp = 0.5d0 * (y * (x / a))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+106) {
tmp = 0.5 * (x / (a / y));
} else if ((x * y) <= 1e+32) {
tmp = (t * (z * -4.5)) / a;
} else {
tmp = 0.5 * (y * (x / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e+106: tmp = 0.5 * (x / (a / y)) elif (x * y) <= 1e+32: tmp = (t * (z * -4.5)) / a else: tmp = 0.5 * (y * (x / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e+106) tmp = Float64(0.5 * Float64(x / Float64(a / y))); elseif (Float64(x * y) <= 1e+32) tmp = Float64(Float64(t * Float64(z * -4.5)) / a); else tmp = Float64(0.5 * Float64(y * Float64(x / a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e+106)
tmp = 0.5 * (x / (a / y));
elseif ((x * y) <= 1e+32)
tmp = (t * (z * -4.5)) / a;
else
tmp = 0.5 * (y * (x / a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+106], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+32], N[(N[(t * N[(z * -4.5), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+106}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 10^{+32}:\\
\;\;\;\;\frac{t \cdot \left(z \cdot -4.5\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000018e106Initial program 79.8%
Taylor expanded in x around 0 79.7%
*-commutative79.7%
associate-*l/79.6%
associate-*r*79.6%
Applied egg-rr79.6%
Taylor expanded in t around 0 74.4%
associate-*r/81.7%
*-rgt-identity81.7%
associate-*r/81.8%
*-commutative81.8%
associate-/r/81.7%
associate-/l*81.7%
*-rgt-identity81.7%
Simplified81.7%
if -2.00000000000000018e106 < (*.f64 x y) < 1.00000000000000005e32Initial program 96.8%
Taylor expanded in x around 0 74.9%
associate-*r/74.9%
*-commutative74.9%
associate-*r*74.9%
*-commutative74.9%
Simplified74.9%
if 1.00000000000000005e32 < (*.f64 x y) Initial program 88.0%
Taylor expanded in x around inf 79.0%
div-inv86.1%
*-commutative86.1%
associate-*l*83.0%
div-inv83.1%
Applied egg-rr75.9%
Final simplification76.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -2e+106) (* 0.5 (/ x (/ a y))) (if (<= (* x y) 1e+32) (* -4.5 (/ (* z t) a)) (* 0.5 (* y (/ x a))))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+106) {
tmp = 0.5 * (x / (a / y));
} else if ((x * y) <= 1e+32) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = 0.5 * (y * (x / a));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= (-2d+106)) then
tmp = 0.5d0 * (x / (a / y))
else if ((x * y) <= 1d+32) then
tmp = (-4.5d0) * ((z * t) / a)
else
tmp = 0.5d0 * (y * (x / a))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+106) {
tmp = 0.5 * (x / (a / y));
} else if ((x * y) <= 1e+32) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = 0.5 * (y * (x / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e+106: tmp = 0.5 * (x / (a / y)) elif (x * y) <= 1e+32: tmp = -4.5 * ((z * t) / a) else: tmp = 0.5 * (y * (x / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e+106) tmp = Float64(0.5 * Float64(x / Float64(a / y))); elseif (Float64(x * y) <= 1e+32) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); else tmp = Float64(0.5 * Float64(y * Float64(x / a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e+106)
tmp = 0.5 * (x / (a / y));
elseif ((x * y) <= 1e+32)
tmp = -4.5 * ((z * t) / a);
else
tmp = 0.5 * (y * (x / a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+106], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+32], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+106}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 10^{+32}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000018e106Initial program 79.8%
Taylor expanded in x around 0 79.7%
*-commutative79.7%
associate-*l/79.6%
associate-*r*79.6%
Applied egg-rr79.6%
Taylor expanded in t around 0 74.4%
associate-*r/81.7%
*-rgt-identity81.7%
associate-*r/81.8%
*-commutative81.8%
associate-/r/81.7%
associate-/l*81.7%
*-rgt-identity81.7%
Simplified81.7%
if -2.00000000000000018e106 < (*.f64 x y) < 1.00000000000000005e32Initial program 96.8%
Taylor expanded in x around 0 74.9%
if 1.00000000000000005e32 < (*.f64 x y) Initial program 88.0%
Taylor expanded in x around inf 79.0%
div-inv86.1%
*-commutative86.1%
associate-*l*83.0%
div-inv83.1%
Applied egg-rr75.9%
Final simplification76.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t -2.4e-156) (* -4.5 (/ (* z t) a)) (if (<= t 0.006) (* 0.5 (* y (/ x a))) (* -4.5 (/ t (/ a z))))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.4e-156) {
tmp = -4.5 * ((z * t) / a);
} else if (t <= 0.006) {
tmp = 0.5 * (y * (x / a));
} else {
tmp = -4.5 * (t / (a / z));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-2.4d-156)) then
tmp = (-4.5d0) * ((z * t) / a)
else if (t <= 0.006d0) then
tmp = 0.5d0 * (y * (x / a))
else
tmp = (-4.5d0) * (t / (a / z))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.4e-156) {
tmp = -4.5 * ((z * t) / a);
} else if (t <= 0.006) {
tmp = 0.5 * (y * (x / a));
} else {
tmp = -4.5 * (t / (a / z));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if t <= -2.4e-156: tmp = -4.5 * ((z * t) / a) elif t <= 0.006: tmp = 0.5 * (y * (x / a)) else: tmp = -4.5 * (t / (a / z)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.4e-156) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (t <= 0.006) tmp = Float64(0.5 * Float64(y * Float64(x / a))); else tmp = Float64(-4.5 * Float64(t / Float64(a / z))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= -2.4e-156)
tmp = -4.5 * ((z * t) / a);
elseif (t <= 0.006)
tmp = 0.5 * (y * (x / a));
else
tmp = -4.5 * (t / (a / z));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.4e-156], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 0.006], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{-156}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;t \leq 0.006:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -2.4e-156Initial program 89.4%
Taylor expanded in x around 0 59.7%
if -2.4e-156 < t < 0.0060000000000000001Initial program 96.9%
Taylor expanded in x around inf 70.2%
div-inv96.8%
*-commutative96.8%
associate-*l*92.0%
div-inv92.0%
Applied egg-rr67.4%
if 0.0060000000000000001 < t Initial program 90.1%
Taylor expanded in x around 0 65.6%
associate-*r/65.7%
*-commutative65.7%
associate-*r*65.7%
*-commutative65.7%
Simplified65.7%
associate-*r/68.7%
associate-*r/68.7%
*-commutative68.7%
*-commutative68.7%
associate-*l*68.8%
Applied egg-rr68.8%
*-commutative68.8%
clear-num68.7%
div-inv68.7%
div-inv68.7%
associate-/r*67.2%
*-commutative67.2%
Applied egg-rr67.2%
associate-/l/68.7%
*-commutative68.7%
associate-/l*68.6%
associate-*l/68.7%
*-un-lft-identity68.7%
Applied egg-rr68.7%
Final simplification64.7%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (/ t (/ a z))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (t / (a / z));
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (-4.5d0) * (t / (a / z))
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (t / (a / z));
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return -4.5 * (t / (a / z))
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(t / Float64(a / z))) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (t / (a / z));
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
-4.5 \cdot \frac{t}{\frac{a}{z}}
\end{array}
Initial program 92.4%
Taylor expanded in x around 0 53.2%
associate-*r/53.2%
*-commutative53.2%
associate-*r*53.2%
*-commutative53.2%
Simplified53.2%
associate-*r/54.6%
associate-*r/54.6%
*-commutative54.6%
*-commutative54.6%
associate-*l*54.6%
Applied egg-rr54.6%
*-commutative54.6%
clear-num54.6%
div-inv54.9%
div-inv54.9%
associate-/r*53.0%
*-commutative53.0%
Applied egg-rr53.0%
associate-/l/54.9%
*-commutative54.9%
associate-/l*54.9%
associate-*l/55.0%
*-un-lft-identity55.0%
Applied egg-rr55.0%
(FPCore (x y z t a)
:precision binary64
(if (< a -2.090464557976709e+86)
(- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z))))
(if (< a 2.144030707833976e+99)
(/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))
(- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a < -2.090464557976709e+86) {
tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z)));
} else if (a < 2.144030707833976e+99) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a < (-2.090464557976709d+86)) then
tmp = (0.5d0 * ((y * x) / a)) - (4.5d0 * (t / (a / z)))
else if (a < 2.144030707833976d+99) then
tmp = ((x * y) - (z * (9.0d0 * t))) / (a * 2.0d0)
else
tmp = ((y / a) * (x * 0.5d0)) - ((t / a) * (z * 4.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a < -2.090464557976709e+86) {
tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z)));
} else if (a < 2.144030707833976e+99) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a < -2.090464557976709e+86: tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z))) elif a < 2.144030707833976e+99: tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0) else: tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a < -2.090464557976709e+86) tmp = Float64(Float64(0.5 * Float64(Float64(y * x) / a)) - Float64(4.5 * Float64(t / Float64(a / z)))); elseif (a < 2.144030707833976e+99) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); else tmp = Float64(Float64(Float64(y / a) * Float64(x * 0.5)) - Float64(Float64(t / a) * Float64(z * 4.5))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a < -2.090464557976709e+86) tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z))); elseif (a < 2.144030707833976e+99) tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0); else tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Less[a, -2.090464557976709e+86], N[(N[(0.5 * N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] - N[(4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[a, 2.144030707833976e+99], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / a), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z * 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a < -2.090464557976709 \cdot 10^{+86}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;a < 2.144030707833976 \cdot 10^{+99}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(x \cdot 0.5\right) - \frac{t}{a} \cdot \left(z \cdot 4.5\right)\\
\end{array}
\end{array}
herbie shell --seed 2024112
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:precision binary64
:alt
(! :herbie-platform default (if (< a -209046455797670900000000000000000000000000000000000000000000000000000000000000000000000) (- (* 1/2 (/ (* y x) a)) (* 9/2 (/ t (/ a z)))) (if (< a 2144030707833976000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z (* 9 t))) (* a 2)) (- (* (/ y a) (* x 1/2)) (* (/ t a) (* z 9/2))))))
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))