
(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 9 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: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* (* z 9.0) t) -5e+288) (* t (/ z (/ a -4.5))) (/ (fma x y (* -9.0 (* z t))) (* a 2.0))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z * 9.0) * t) <= -5e+288) {
tmp = t * (z / (a / -4.5));
} else {
tmp = fma(x, y, (-9.0 * (z * t))) / (a * 2.0);
}
return tmp;
}
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(z * 9.0) * t) <= -5e+288) tmp = Float64(t * Float64(z / Float64(a / -4.5))); else tmp = Float64(fma(x, y, Float64(-9.0 * Float64(z * t))) / Float64(a * 2.0)); end return tmp end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision], -5e+288], N[(t * N[(z / N[(a / -4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(z \cdot 9\right) \cdot t \leq -5 \cdot 10^{+288}:\\
\;\;\;\;t \cdot \frac{z}{\frac{a}{-4.5}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, -9 \cdot \left(z \cdot t\right)\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (*.f64 (*.f64 z 9) t) < -5.0000000000000003e288Initial program 76.3%
associate-*l*76.4%
Simplified76.4%
div-sub72.2%
associate-*r*72.1%
div-sub76.3%
associate-*r*76.4%
*-commutative76.4%
cancel-sign-sub-inv76.4%
distribute-lft-neg-in76.4%
metadata-eval76.4%
associate-*r*76.2%
*-commutative76.2%
fma-udef76.2%
*-un-lft-identity76.2%
associate-/l*76.2%
inv-pow76.2%
Applied egg-rr76.4%
Taylor expanded in x around 0 76.2%
associate-*r/76.2%
*-commutative76.2%
*-commutative76.2%
*-commutative76.2%
associate-*r*76.3%
associate-*r/99.8%
associate-/l*99.8%
Simplified99.8%
if -5.0000000000000003e288 < (*.f64 (*.f64 z 9) t) Initial program 94.9%
fma-neg94.9%
*-commutative94.9%
associate-*l*95.3%
distribute-lft-neg-in95.3%
metadata-eval95.3%
Simplified95.3%
Final simplification95.7%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -2e+29)
(* 0.5 (* x (/ y a)))
(if (<= (* x y) 2e+44)
(* -4.5 (/ (* z t) a))
(if (<= (* x y) 5e+117)
(* 0.5 (/ (* x y) a))
(if (<= (* x y) 5e+134)
(* -4.5 (* t (/ z a)))
(* 0.5 (/ x (/ a y))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+29) {
tmp = 0.5 * (x * (y / a));
} else if ((x * y) <= 2e+44) {
tmp = -4.5 * ((z * t) / a);
} else if ((x * y) <= 5e+117) {
tmp = 0.5 * ((x * y) / a);
} else if ((x * y) <= 5e+134) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = 0.5 * (x / (a / y));
}
return tmp;
}
NOTE: z and t 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+29)) then
tmp = 0.5d0 * (x * (y / a))
else if ((x * y) <= 2d+44) then
tmp = (-4.5d0) * ((z * t) / a)
else if ((x * y) <= 5d+117) then
tmp = 0.5d0 * ((x * y) / a)
else if ((x * y) <= 5d+134) then
tmp = (-4.5d0) * (t * (z / a))
else
tmp = 0.5d0 * (x / (a / y))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+29) {
tmp = 0.5 * (x * (y / a));
} else if ((x * y) <= 2e+44) {
tmp = -4.5 * ((z * t) / a);
} else if ((x * y) <= 5e+117) {
tmp = 0.5 * ((x * y) / a);
} else if ((x * y) <= 5e+134) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = 0.5 * (x / (a / y));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e+29: tmp = 0.5 * (x * (y / a)) elif (x * y) <= 2e+44: tmp = -4.5 * ((z * t) / a) elif (x * y) <= 5e+117: tmp = 0.5 * ((x * y) / a) elif (x * y) <= 5e+134: tmp = -4.5 * (t * (z / a)) else: tmp = 0.5 * (x / (a / y)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e+29) tmp = Float64(0.5 * Float64(x * Float64(y / a))); elseif (Float64(x * y) <= 2e+44) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (Float64(x * y) <= 5e+117) tmp = Float64(0.5 * Float64(Float64(x * y) / a)); elseif (Float64(x * y) <= 5e+134) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); else tmp = Float64(0.5 * Float64(x / Float64(a / y))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e+29)
tmp = 0.5 * (x * (y / a));
elseif ((x * y) <= 2e+44)
tmp = -4.5 * ((z * t) / a);
elseif ((x * y) <= 5e+117)
tmp = 0.5 * ((x * y) / a);
elseif ((x * y) <= 5e+134)
tmp = -4.5 * (t * (z / a));
else
tmp = 0.5 * (x / (a / y));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+29], N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+44], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+117], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+134], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+29}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+44}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+117}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+134}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999983e29Initial program 89.2%
associate-*l*89.2%
Simplified89.2%
div-sub84.9%
associate-*r*84.9%
div-sub89.2%
associate-*r*89.2%
*-commutative89.2%
cancel-sign-sub-inv89.2%
distribute-lft-neg-in89.2%
metadata-eval89.2%
associate-*r*89.2%
*-commutative89.2%
fma-udef89.2%
*-un-lft-identity89.2%
associate-/l*89.0%
inv-pow89.0%
Applied egg-rr89.0%
Taylor expanded in x around inf 75.3%
associate-*r/79.3%
Simplified79.3%
if -1.99999999999999983e29 < (*.f64 x y) < 2.0000000000000002e44Initial program 93.5%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in x around 0 75.0%
if 2.0000000000000002e44 < (*.f64 x y) < 4.99999999999999983e117Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 4.99999999999999983e117 < (*.f64 x y) < 4.99999999999999981e134Initial program 99.2%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in x around 0 84.1%
associate-/l*99.2%
associate-/r/84.1%
Simplified84.1%
Taylor expanded in t around 0 84.1%
associate-*r/99.5%
Simplified99.5%
if 4.99999999999999981e134 < (*.f64 x y) Initial program 97.2%
associate-*l*97.2%
Simplified97.2%
Taylor expanded in x around inf 90.3%
associate-/l*92.8%
Simplified92.8%
Final simplification80.0%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -2e+29)
(* 0.5 (* x (/ y a)))
(if (<= (* x y) 2e+44)
(* -4.5 (/ (* z t) a))
(if (<= (* x y) 5e+117)
(* 0.5 (/ (* x y) a))
(if (<= (* x y) 5e+134)
(* -4.5 (* t (/ z a)))
(* y (/ (* x 0.5) a)))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+29) {
tmp = 0.5 * (x * (y / a));
} else if ((x * y) <= 2e+44) {
tmp = -4.5 * ((z * t) / a);
} else if ((x * y) <= 5e+117) {
tmp = 0.5 * ((x * y) / a);
} else if ((x * y) <= 5e+134) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = y * ((x * 0.5) / a);
}
return tmp;
}
NOTE: z and t 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+29)) then
tmp = 0.5d0 * (x * (y / a))
else if ((x * y) <= 2d+44) then
tmp = (-4.5d0) * ((z * t) / a)
else if ((x * y) <= 5d+117) then
tmp = 0.5d0 * ((x * y) / a)
else if ((x * y) <= 5d+134) then
tmp = (-4.5d0) * (t * (z / a))
else
tmp = y * ((x * 0.5d0) / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+29) {
tmp = 0.5 * (x * (y / a));
} else if ((x * y) <= 2e+44) {
tmp = -4.5 * ((z * t) / a);
} else if ((x * y) <= 5e+117) {
tmp = 0.5 * ((x * y) / a);
} else if ((x * y) <= 5e+134) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = y * ((x * 0.5) / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e+29: tmp = 0.5 * (x * (y / a)) elif (x * y) <= 2e+44: tmp = -4.5 * ((z * t) / a) elif (x * y) <= 5e+117: tmp = 0.5 * ((x * y) / a) elif (x * y) <= 5e+134: tmp = -4.5 * (t * (z / a)) else: tmp = y * ((x * 0.5) / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e+29) tmp = Float64(0.5 * Float64(x * Float64(y / a))); elseif (Float64(x * y) <= 2e+44) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (Float64(x * y) <= 5e+117) tmp = Float64(0.5 * Float64(Float64(x * y) / a)); elseif (Float64(x * y) <= 5e+134) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); else tmp = Float64(y * Float64(Float64(x * 0.5) / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e+29)
tmp = 0.5 * (x * (y / a));
elseif ((x * y) <= 2e+44)
tmp = -4.5 * ((z * t) / a);
elseif ((x * y) <= 5e+117)
tmp = 0.5 * ((x * y) / a);
elseif ((x * y) <= 5e+134)
tmp = -4.5 * (t * (z / a));
else
tmp = y * ((x * 0.5) / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+29], N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+44], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+117], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+134], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+29}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+44}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+117}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+134}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999983e29Initial program 89.2%
associate-*l*89.2%
Simplified89.2%
div-sub84.9%
associate-*r*84.9%
div-sub89.2%
associate-*r*89.2%
*-commutative89.2%
cancel-sign-sub-inv89.2%
distribute-lft-neg-in89.2%
metadata-eval89.2%
associate-*r*89.2%
*-commutative89.2%
fma-udef89.2%
*-un-lft-identity89.2%
associate-/l*89.0%
inv-pow89.0%
Applied egg-rr89.0%
Taylor expanded in x around inf 75.3%
associate-*r/79.3%
Simplified79.3%
if -1.99999999999999983e29 < (*.f64 x y) < 2.0000000000000002e44Initial program 93.5%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in x around 0 75.0%
if 2.0000000000000002e44 < (*.f64 x y) < 4.99999999999999983e117Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 4.99999999999999983e117 < (*.f64 x y) < 4.99999999999999981e134Initial program 99.2%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in x around 0 84.1%
associate-/l*99.2%
associate-/r/84.1%
Simplified84.1%
Taylor expanded in t around 0 84.1%
associate-*r/99.5%
Simplified99.5%
if 4.99999999999999981e134 < (*.f64 x y) Initial program 97.2%
associate-*l*97.2%
Simplified97.2%
div-sub97.2%
associate-*r*97.2%
div-sub97.2%
associate-*r*97.2%
*-commutative97.2%
cancel-sign-sub-inv97.2%
distribute-lft-neg-in97.2%
metadata-eval97.2%
associate-*r*97.1%
*-commutative97.1%
fma-udef97.1%
*-un-lft-identity97.1%
associate-/l*97.0%
inv-pow97.0%
Applied egg-rr97.1%
Taylor expanded in x around inf 90.3%
associate-/l*92.8%
associate-*r/92.8%
associate-/r/92.8%
*-commutative92.8%
Simplified92.8%
Final simplification80.0%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -2e+29)
(* 0.5 (* x (/ y a)))
(if (<= (* x y) 2e+44)
(* -4.5 (/ (* z t) a))
(if (<= (* x y) 5e+117)
(* 0.5 (/ (* x y) a))
(if (<= (* x y) 5e+134)
(/ (* t -4.5) (/ a z))
(* y (/ (* x 0.5) a)))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+29) {
tmp = 0.5 * (x * (y / a));
} else if ((x * y) <= 2e+44) {
tmp = -4.5 * ((z * t) / a);
} else if ((x * y) <= 5e+117) {
tmp = 0.5 * ((x * y) / a);
} else if ((x * y) <= 5e+134) {
tmp = (t * -4.5) / (a / z);
} else {
tmp = y * ((x * 0.5) / a);
}
return tmp;
}
NOTE: z and t 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+29)) then
tmp = 0.5d0 * (x * (y / a))
else if ((x * y) <= 2d+44) then
tmp = (-4.5d0) * ((z * t) / a)
else if ((x * y) <= 5d+117) then
tmp = 0.5d0 * ((x * y) / a)
else if ((x * y) <= 5d+134) then
tmp = (t * (-4.5d0)) / (a / z)
else
tmp = y * ((x * 0.5d0) / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+29) {
tmp = 0.5 * (x * (y / a));
} else if ((x * y) <= 2e+44) {
tmp = -4.5 * ((z * t) / a);
} else if ((x * y) <= 5e+117) {
tmp = 0.5 * ((x * y) / a);
} else if ((x * y) <= 5e+134) {
tmp = (t * -4.5) / (a / z);
} else {
tmp = y * ((x * 0.5) / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e+29: tmp = 0.5 * (x * (y / a)) elif (x * y) <= 2e+44: tmp = -4.5 * ((z * t) / a) elif (x * y) <= 5e+117: tmp = 0.5 * ((x * y) / a) elif (x * y) <= 5e+134: tmp = (t * -4.5) / (a / z) else: tmp = y * ((x * 0.5) / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e+29) tmp = Float64(0.5 * Float64(x * Float64(y / a))); elseif (Float64(x * y) <= 2e+44) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (Float64(x * y) <= 5e+117) tmp = Float64(0.5 * Float64(Float64(x * y) / a)); elseif (Float64(x * y) <= 5e+134) tmp = Float64(Float64(t * -4.5) / Float64(a / z)); else tmp = Float64(y * Float64(Float64(x * 0.5) / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e+29)
tmp = 0.5 * (x * (y / a));
elseif ((x * y) <= 2e+44)
tmp = -4.5 * ((z * t) / a);
elseif ((x * y) <= 5e+117)
tmp = 0.5 * ((x * y) / a);
elseif ((x * y) <= 5e+134)
tmp = (t * -4.5) / (a / z);
else
tmp = y * ((x * 0.5) / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+29], N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+44], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+117], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+134], N[(N[(t * -4.5), $MachinePrecision] / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+29}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+44}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+117}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+134}:\\
\;\;\;\;\frac{t \cdot -4.5}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999983e29Initial program 89.2%
associate-*l*89.2%
Simplified89.2%
div-sub84.9%
associate-*r*84.9%
div-sub89.2%
associate-*r*89.2%
*-commutative89.2%
cancel-sign-sub-inv89.2%
distribute-lft-neg-in89.2%
metadata-eval89.2%
associate-*r*89.2%
*-commutative89.2%
fma-udef89.2%
*-un-lft-identity89.2%
associate-/l*89.0%
inv-pow89.0%
Applied egg-rr89.0%
Taylor expanded in x around inf 75.3%
associate-*r/79.3%
Simplified79.3%
if -1.99999999999999983e29 < (*.f64 x y) < 2.0000000000000002e44Initial program 93.5%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in x around 0 75.0%
if 2.0000000000000002e44 < (*.f64 x y) < 4.99999999999999983e117Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 4.99999999999999983e117 < (*.f64 x y) < 4.99999999999999981e134Initial program 99.2%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in x around 0 84.1%
associate-/l*99.2%
associate-/r/84.1%
Simplified84.1%
Taylor expanded in t around 0 84.1%
associate-*r/99.5%
Simplified99.5%
associate-*r*100.0%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
if 4.99999999999999981e134 < (*.f64 x y) Initial program 97.2%
associate-*l*97.2%
Simplified97.2%
div-sub97.2%
associate-*r*97.2%
div-sub97.2%
associate-*r*97.2%
*-commutative97.2%
cancel-sign-sub-inv97.2%
distribute-lft-neg-in97.2%
metadata-eval97.2%
associate-*r*97.1%
*-commutative97.1%
fma-udef97.1%
*-un-lft-identity97.1%
associate-/l*97.0%
inv-pow97.0%
Applied egg-rr97.1%
Taylor expanded in x around inf 90.3%
associate-/l*92.8%
associate-*r/92.8%
associate-/r/92.8%
*-commutative92.8%
Simplified92.8%
Final simplification80.0%
NOTE: z and t 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 (/ a -4.5)))
(/ (- (* x y) t_1) (* a 2.0)))))assert(z < t);
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 / (a / -4.5));
} else {
tmp = ((x * y) - t_1) / (a * 2.0);
}
return tmp;
}
assert z < t;
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 / (a / -4.5));
} else {
tmp = ((x * y) - t_1) / (a * 2.0);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (z * 9.0) * t tmp = 0 if t_1 <= -math.inf: tmp = t * (z / (a / -4.5)) else: tmp = ((x * y) - t_1) / (a * 2.0) return tmp
z, t = sort([z, t]) 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(z / Float64(a / -4.5))); else tmp = Float64(Float64(Float64(x * y) - t_1) / Float64(a * 2.0)); end return tmp end
z, t = num2cell(sort([z, t])){:}
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 / (a / -4.5));
else
tmp = ((x * y) - t_1) / (a * 2.0);
end
tmp_2 = tmp;
end
NOTE: z and t 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[(z / N[(a / -4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t \cdot \frac{z}{\frac{a}{-4.5}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - t_1}{a \cdot 2}\\
\end{array}
\end{array}
if (*.f64 (*.f64 z 9) t) < -inf.0Initial program 73.0%
associate-*l*73.0%
Simplified73.0%
div-sub68.2%
associate-*r*68.2%
div-sub73.0%
associate-*r*73.0%
*-commutative73.0%
cancel-sign-sub-inv73.0%
distribute-lft-neg-in73.0%
metadata-eval73.0%
associate-*r*73.0%
*-commutative73.0%
fma-udef73.0%
*-un-lft-identity73.0%
associate-/l*73.0%
inv-pow73.0%
Applied egg-rr73.0%
Taylor expanded in x around 0 73.0%
associate-*r/73.0%
*-commutative73.0%
*-commutative73.0%
*-commutative73.0%
associate-*r*73.0%
associate-*r/99.9%
associate-/l*99.8%
Simplified99.8%
if -inf.0 < (*.f64 (*.f64 z 9) t) Initial program 95.0%
Final simplification95.4%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -1e+205) (* 0.5 (/ x (/ a y))) (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e+205) {
tmp = 0.5 * (x / (a / y));
} else {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
NOTE: z and t 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) <= (-1d+205)) then
tmp = 0.5d0 * (x / (a / y))
else
tmp = ((x * y) - (z * (9.0d0 * t))) / (a * 2.0d0)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e+205) {
tmp = 0.5 * (x / (a / y));
} else {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -1e+205: tmp = 0.5 * (x / (a / y)) else: tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -1e+205) tmp = Float64(0.5 * Float64(x / Float64(a / y))); else tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -1e+205)
tmp = 0.5 * (x / (a / y));
else
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+205], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+205}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000002e205Initial program 82.9%
associate-*l*82.9%
Simplified82.9%
Taylor expanded in x around inf 82.9%
associate-/l*97.1%
Simplified97.1%
if -1.00000000000000002e205 < (*.f64 x y) Initial program 94.7%
associate-*l*95.1%
Simplified95.1%
Final simplification95.3%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* 0.5 (* x (/ y a)))))
(if (<= t -1.85e-59)
(* -4.5 (/ t (/ a z)))
(if (<= t 2.25e-48)
t_1
(if (<= t 1.63e-14)
(* -4.5 (/ (* z t) a))
(if (<= t 1.1e+61) t_1 (* -4.5 (* t (/ z a)))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = 0.5 * (x * (y / a));
double tmp;
if (t <= -1.85e-59) {
tmp = -4.5 * (t / (a / z));
} else if (t <= 2.25e-48) {
tmp = t_1;
} else if (t <= 1.63e-14) {
tmp = -4.5 * ((z * t) / a);
} else if (t <= 1.1e+61) {
tmp = t_1;
} else {
tmp = -4.5 * (t * (z / a));
}
return tmp;
}
NOTE: z and t 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 = 0.5d0 * (x * (y / a))
if (t <= (-1.85d-59)) then
tmp = (-4.5d0) * (t / (a / z))
else if (t <= 2.25d-48) then
tmp = t_1
else if (t <= 1.63d-14) then
tmp = (-4.5d0) * ((z * t) / a)
else if (t <= 1.1d+61) then
tmp = t_1
else
tmp = (-4.5d0) * (t * (z / a))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = 0.5 * (x * (y / a));
double tmp;
if (t <= -1.85e-59) {
tmp = -4.5 * (t / (a / z));
} else if (t <= 2.25e-48) {
tmp = t_1;
} else if (t <= 1.63e-14) {
tmp = -4.5 * ((z * t) / a);
} else if (t <= 1.1e+61) {
tmp = t_1;
} else {
tmp = -4.5 * (t * (z / a));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = 0.5 * (x * (y / a)) tmp = 0 if t <= -1.85e-59: tmp = -4.5 * (t / (a / z)) elif t <= 2.25e-48: tmp = t_1 elif t <= 1.63e-14: tmp = -4.5 * ((z * t) / a) elif t <= 1.1e+61: tmp = t_1 else: tmp = -4.5 * (t * (z / a)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(0.5 * Float64(x * Float64(y / a))) tmp = 0.0 if (t <= -1.85e-59) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); elseif (t <= 2.25e-48) tmp = t_1; elseif (t <= 1.63e-14) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (t <= 1.1e+61) tmp = t_1; else tmp = Float64(-4.5 * Float64(t * Float64(z / a))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = 0.5 * (x * (y / a));
tmp = 0.0;
if (t <= -1.85e-59)
tmp = -4.5 * (t / (a / z));
elseif (t <= 2.25e-48)
tmp = t_1;
elseif (t <= 1.63e-14)
tmp = -4.5 * ((z * t) / a);
elseif (t <= 1.1e+61)
tmp = t_1;
else
tmp = -4.5 * (t * (z / a));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.85e-59], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.25e-48], t$95$1, If[LessEqual[t, 1.63e-14], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.1e+61], t$95$1, N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := 0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\mathbf{if}\;t \leq -1.85 \cdot 10^{-59}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;t \leq 2.25 \cdot 10^{-48}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.63 \cdot 10^{-14}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{+61}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\end{array}
\end{array}
if t < -1.85e-59Initial program 90.8%
associate-*l*90.7%
Simplified90.7%
div-sub87.1%
div-inv87.2%
*-commutative87.2%
associate-/r*87.2%
metadata-eval87.2%
times-frac90.5%
Applied egg-rr90.5%
Taylor expanded in x around 0 63.2%
associate-/l*67.6%
Simplified67.6%
if -1.85e-59 < t < 2.24999999999999994e-48 or 1.63000000000000006e-14 < t < 1.1e61Initial program 94.8%
associate-*l*95.6%
Simplified95.6%
div-sub95.6%
associate-*r*94.8%
div-sub94.8%
associate-*r*95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
distribute-lft-neg-in95.6%
metadata-eval95.6%
associate-*r*95.6%
*-commutative95.6%
fma-udef95.6%
*-un-lft-identity95.6%
associate-/l*94.8%
inv-pow94.8%
Applied egg-rr94.8%
Taylor expanded in x around inf 76.0%
associate-*r/77.7%
Simplified77.7%
if 2.24999999999999994e-48 < t < 1.63000000000000006e-14Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in x around 0 49.7%
if 1.1e61 < t Initial program 92.8%
associate-*l*92.9%
Simplified92.9%
Taylor expanded in x around 0 72.4%
associate-/l*73.9%
associate-/r/70.6%
Simplified70.6%
Taylor expanded in t around 0 72.4%
associate-*r/73.9%
Simplified73.9%
Final simplification72.9%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.75e-47)
(* -4.5 (/ t (/ a z)))
(if (<= t 1.15e-48)
(* 0.5 (* x (/ y a)))
(if (<= t 1.63e-14)
(* -4.5 (/ (* z t) a))
(if (<= t 2.6e+62) (* 0.5 (/ x (/ a y))) (* -4.5 (* t (/ z a))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.75e-47) {
tmp = -4.5 * (t / (a / z));
} else if (t <= 1.15e-48) {
tmp = 0.5 * (x * (y / a));
} else if (t <= 1.63e-14) {
tmp = -4.5 * ((z * t) / a);
} else if (t <= 2.6e+62) {
tmp = 0.5 * (x / (a / y));
} else {
tmp = -4.5 * (t * (z / a));
}
return tmp;
}
NOTE: z and t 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 <= (-1.75d-47)) then
tmp = (-4.5d0) * (t / (a / z))
else if (t <= 1.15d-48) then
tmp = 0.5d0 * (x * (y / a))
else if (t <= 1.63d-14) then
tmp = (-4.5d0) * ((z * t) / a)
else if (t <= 2.6d+62) then
tmp = 0.5d0 * (x / (a / y))
else
tmp = (-4.5d0) * (t * (z / a))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.75e-47) {
tmp = -4.5 * (t / (a / z));
} else if (t <= 1.15e-48) {
tmp = 0.5 * (x * (y / a));
} else if (t <= 1.63e-14) {
tmp = -4.5 * ((z * t) / a);
} else if (t <= 2.6e+62) {
tmp = 0.5 * (x / (a / y));
} else {
tmp = -4.5 * (t * (z / a));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if t <= -1.75e-47: tmp = -4.5 * (t / (a / z)) elif t <= 1.15e-48: tmp = 0.5 * (x * (y / a)) elif t <= 1.63e-14: tmp = -4.5 * ((z * t) / a) elif t <= 2.6e+62: tmp = 0.5 * (x / (a / y)) else: tmp = -4.5 * (t * (z / a)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.75e-47) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); elseif (t <= 1.15e-48) tmp = Float64(0.5 * Float64(x * Float64(y / a))); elseif (t <= 1.63e-14) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (t <= 2.6e+62) tmp = Float64(0.5 * Float64(x / Float64(a / y))); else tmp = Float64(-4.5 * Float64(t * Float64(z / a))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= -1.75e-47)
tmp = -4.5 * (t / (a / z));
elseif (t <= 1.15e-48)
tmp = 0.5 * (x * (y / a));
elseif (t <= 1.63e-14)
tmp = -4.5 * ((z * t) / a);
elseif (t <= 2.6e+62)
tmp = 0.5 * (x / (a / y));
else
tmp = -4.5 * (t * (z / a));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.75e-47], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.15e-48], N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.63e-14], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.6e+62], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.75 \cdot 10^{-47}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-48}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\mathbf{elif}\;t \leq 1.63 \cdot 10^{-14}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{+62}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\end{array}
\end{array}
if t < -1.7499999999999999e-47Initial program 90.7%
associate-*l*90.6%
Simplified90.6%
div-sub87.0%
div-inv87.0%
*-commutative87.0%
associate-/r*87.0%
metadata-eval87.0%
times-frac90.4%
Applied egg-rr90.4%
Taylor expanded in x around 0 62.8%
associate-/l*67.2%
Simplified67.2%
if -1.7499999999999999e-47 < t < 1.15e-48Initial program 94.9%
associate-*l*95.9%
Simplified95.9%
div-sub95.9%
associate-*r*94.9%
div-sub94.9%
associate-*r*95.9%
*-commutative95.9%
cancel-sign-sub-inv95.9%
distribute-lft-neg-in95.9%
metadata-eval95.9%
associate-*r*95.9%
*-commutative95.9%
fma-udef95.9%
*-un-lft-identity95.9%
associate-/l*95.1%
inv-pow95.1%
Applied egg-rr95.0%
Taylor expanded in x around inf 81.1%
associate-*r/81.1%
Simplified81.1%
if 1.15e-48 < t < 1.63000000000000006e-14Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in x around 0 49.7%
if 1.63000000000000006e-14 < t < 2.59999999999999984e62Initial program 94.1%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in x around inf 48.8%
associate-/l*60.0%
Simplified60.0%
if 2.59999999999999984e62 < t Initial program 92.8%
associate-*l*92.9%
Simplified92.9%
Taylor expanded in x around 0 72.4%
associate-/l*73.9%
associate-/r/70.6%
Simplified70.6%
Taylor expanded in t around 0 72.4%
associate-*r/73.9%
Simplified73.9%
Final simplification72.9%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (* t (/ z a))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (t * (z / a));
}
NOTE: z and t 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 * (z / a))
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (t * (z / a));
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): return -4.5 * (t * (z / a))
z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(t * Float64(z / a))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (t * (z / a));
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
-4.5 \cdot \left(t \cdot \frac{z}{a}\right)
\end{array}
Initial program 93.2%
associate-*l*93.5%
Simplified93.5%
Taylor expanded in x around 0 49.9%
associate-/l*51.0%
associate-/r/48.9%
Simplified48.9%
Taylor expanded in t around 0 49.9%
associate-*r/50.6%
Simplified50.6%
Final simplification50.6%
(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 2023287
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:precision binary64
:herbie-target
(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)))))
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))