
(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 11 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}
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* a_m 2.0) 5e-19)
(/ (fma x y (* z (* t -9.0))) (* a_m 2.0))
(if (<= (* a_m 2.0) 4e+259)
(- (* x (/ y (* a_m 2.0))) (* z (/ (* t 9.0) (* a_m 2.0))))
(* x (+ (* -4.5 (/ (* z t) (* a_m x))) (* 0.5 (/ y a_m))))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((a_m * 2.0) <= 5e-19) {
tmp = fma(x, y, (z * (t * -9.0))) / (a_m * 2.0);
} else if ((a_m * 2.0) <= 4e+259) {
tmp = (x * (y / (a_m * 2.0))) - (z * ((t * 9.0) / (a_m * 2.0)));
} else {
tmp = x * ((-4.5 * ((z * t) / (a_m * x))) + (0.5 * (y / a_m)));
}
return a_s * tmp;
}
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(a_m * 2.0) <= 5e-19) tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) / Float64(a_m * 2.0)); elseif (Float64(a_m * 2.0) <= 4e+259) tmp = Float64(Float64(x * Float64(y / Float64(a_m * 2.0))) - Float64(z * Float64(Float64(t * 9.0) / Float64(a_m * 2.0)))); else tmp = Float64(x * Float64(Float64(-4.5 * Float64(Float64(z * t) / Float64(a_m * x))) + Float64(0.5 * Float64(y / a_m)))); end return Float64(a_s * tmp) end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(a$95$m * 2.0), $MachinePrecision], 5e-19], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a$95$m * 2.0), $MachinePrecision], 4e+259], N[(N[(x * N[(y / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(N[(t * 9.0), $MachinePrecision] / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(-4.5 * N[(N[(z * t), $MachinePrecision] / N[(a$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \cdot 2 \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a\_m \cdot 2}\\
\mathbf{elif}\;a\_m \cdot 2 \leq 4 \cdot 10^{+259}:\\
\;\;\;\;x \cdot \frac{y}{a\_m \cdot 2} - z \cdot \frac{t \cdot 9}{a\_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-4.5 \cdot \frac{z \cdot t}{a\_m \cdot x} + 0.5 \cdot \frac{y}{a\_m}\right)\\
\end{array}
\end{array}
if (*.f64 a #s(literal 2 binary64)) < 5.0000000000000004e-19Initial program 93.9%
div-sub90.3%
*-commutative90.3%
div-sub93.9%
cancel-sign-sub-inv93.9%
*-commutative93.9%
fma-define94.4%
distribute-rgt-neg-in94.4%
associate-*r*94.5%
distribute-lft-neg-in94.5%
*-commutative94.5%
distribute-rgt-neg-in94.5%
metadata-eval94.5%
Simplified94.5%
if 5.0000000000000004e-19 < (*.f64 a #s(literal 2 binary64)) < 4e259Initial program 85.4%
div-sub85.4%
*-commutative85.4%
div-sub85.4%
cancel-sign-sub-inv85.4%
*-commutative85.4%
fma-define85.5%
distribute-rgt-neg-in85.5%
associate-*r*85.6%
distribute-lft-neg-in85.6%
*-commutative85.6%
distribute-rgt-neg-in85.6%
metadata-eval85.6%
Simplified85.6%
*-un-lft-identity85.6%
*-un-lft-identity85.6%
*-commutative85.6%
associate-*r*85.5%
metadata-eval85.5%
distribute-rgt-neg-in85.5%
distribute-lft-neg-in85.5%
fma-neg85.4%
div-sub85.4%
associate-/l*85.4%
associate-*l*85.5%
associate-/l*92.6%
Applied egg-rr92.6%
if 4e259 < (*.f64 a #s(literal 2 binary64)) Initial program 78.3%
div-sub78.3%
*-commutative78.3%
div-sub78.3%
cancel-sign-sub-inv78.3%
*-commutative78.3%
fma-define78.3%
distribute-rgt-neg-in78.3%
associate-*r*89.2%
distribute-lft-neg-in89.2%
*-commutative89.2%
distribute-rgt-neg-in89.2%
metadata-eval89.2%
Simplified89.2%
Taylor expanded in x around inf 89.5%
Final simplification93.9%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* a_m 2.0) 5e-19)
(/ (- (* x y) (* z (* t 9.0))) (* a_m 2.0))
(if (<= (* a_m 2.0) 4e+259)
(- (* x (/ y (* a_m 2.0))) (* z (/ (* t 9.0) (* a_m 2.0))))
(* x (+ (* -4.5 (/ (* z t) (* a_m x))) (* 0.5 (/ y a_m))))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((a_m * 2.0) <= 5e-19) {
tmp = ((x * y) - (z * (t * 9.0))) / (a_m * 2.0);
} else if ((a_m * 2.0) <= 4e+259) {
tmp = (x * (y / (a_m * 2.0))) - (z * ((t * 9.0) / (a_m * 2.0)));
} else {
tmp = x * ((-4.5 * ((z * t) / (a_m * x))) + (0.5 * (y / a_m)));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if ((a_m * 2.0d0) <= 5d-19) then
tmp = ((x * y) - (z * (t * 9.0d0))) / (a_m * 2.0d0)
else if ((a_m * 2.0d0) <= 4d+259) then
tmp = (x * (y / (a_m * 2.0d0))) - (z * ((t * 9.0d0) / (a_m * 2.0d0)))
else
tmp = x * (((-4.5d0) * ((z * t) / (a_m * x))) + (0.5d0 * (y / a_m)))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((a_m * 2.0) <= 5e-19) {
tmp = ((x * y) - (z * (t * 9.0))) / (a_m * 2.0);
} else if ((a_m * 2.0) <= 4e+259) {
tmp = (x * (y / (a_m * 2.0))) - (z * ((t * 9.0) / (a_m * 2.0)));
} else {
tmp = x * ((-4.5 * ((z * t) / (a_m * x))) + (0.5 * (y / a_m)));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (a_m * 2.0) <= 5e-19: tmp = ((x * y) - (z * (t * 9.0))) / (a_m * 2.0) elif (a_m * 2.0) <= 4e+259: tmp = (x * (y / (a_m * 2.0))) - (z * ((t * 9.0) / (a_m * 2.0))) else: tmp = x * ((-4.5 * ((z * t) / (a_m * x))) + (0.5 * (y / a_m))) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(a_m * 2.0) <= 5e-19) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(t * 9.0))) / Float64(a_m * 2.0)); elseif (Float64(a_m * 2.0) <= 4e+259) tmp = Float64(Float64(x * Float64(y / Float64(a_m * 2.0))) - Float64(z * Float64(Float64(t * 9.0) / Float64(a_m * 2.0)))); else tmp = Float64(x * Float64(Float64(-4.5 * Float64(Float64(z * t) / Float64(a_m * x))) + Float64(0.5 * Float64(y / a_m)))); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((a_m * 2.0) <= 5e-19)
tmp = ((x * y) - (z * (t * 9.0))) / (a_m * 2.0);
elseif ((a_m * 2.0) <= 4e+259)
tmp = (x * (y / (a_m * 2.0))) - (z * ((t * 9.0) / (a_m * 2.0)));
else
tmp = x * ((-4.5 * ((z * t) / (a_m * x))) + (0.5 * (y / a_m)));
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(a$95$m * 2.0), $MachinePrecision], 5e-19], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a$95$m * 2.0), $MachinePrecision], 4e+259], N[(N[(x * N[(y / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(N[(t * 9.0), $MachinePrecision] / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(-4.5 * N[(N[(z * t), $MachinePrecision] / N[(a$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \cdot 2 \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a\_m \cdot 2}\\
\mathbf{elif}\;a\_m \cdot 2 \leq 4 \cdot 10^{+259}:\\
\;\;\;\;x \cdot \frac{y}{a\_m \cdot 2} - z \cdot \frac{t \cdot 9}{a\_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-4.5 \cdot \frac{z \cdot t}{a\_m \cdot x} + 0.5 \cdot \frac{y}{a\_m}\right)\\
\end{array}
\end{array}
if (*.f64 a #s(literal 2 binary64)) < 5.0000000000000004e-19Initial program 93.9%
div-sub90.3%
*-commutative90.3%
div-sub93.9%
cancel-sign-sub-inv93.9%
*-commutative93.9%
fma-define94.4%
distribute-rgt-neg-in94.4%
associate-*r*94.5%
distribute-lft-neg-in94.5%
*-commutative94.5%
distribute-rgt-neg-in94.5%
metadata-eval94.5%
Simplified94.5%
*-commutative94.5%
associate-*r*94.4%
metadata-eval94.4%
distribute-rgt-neg-in94.4%
distribute-lft-neg-in94.4%
fma-neg93.9%
associate-*l*94.0%
Applied egg-rr94.0%
if 5.0000000000000004e-19 < (*.f64 a #s(literal 2 binary64)) < 4e259Initial program 85.4%
div-sub85.4%
*-commutative85.4%
div-sub85.4%
cancel-sign-sub-inv85.4%
*-commutative85.4%
fma-define85.5%
distribute-rgt-neg-in85.5%
associate-*r*85.6%
distribute-lft-neg-in85.6%
*-commutative85.6%
distribute-rgt-neg-in85.6%
metadata-eval85.6%
Simplified85.6%
*-un-lft-identity85.6%
*-un-lft-identity85.6%
*-commutative85.6%
associate-*r*85.5%
metadata-eval85.5%
distribute-rgt-neg-in85.5%
distribute-lft-neg-in85.5%
fma-neg85.4%
div-sub85.4%
associate-/l*85.4%
associate-*l*85.5%
associate-/l*92.6%
Applied egg-rr92.6%
if 4e259 < (*.f64 a #s(literal 2 binary64)) Initial program 78.3%
div-sub78.3%
*-commutative78.3%
div-sub78.3%
cancel-sign-sub-inv78.3%
*-commutative78.3%
fma-define78.3%
distribute-rgt-neg-in78.3%
associate-*r*89.2%
distribute-lft-neg-in89.2%
*-commutative89.2%
distribute-rgt-neg-in89.2%
metadata-eval89.2%
Simplified89.2%
Taylor expanded in x around inf 89.5%
Final simplification93.5%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* x y) -2e+238)
(* y (/ (* x 0.5) a_m))
(if (<= (* x y) 2e-166)
(/ (* t -4.5) (/ a_m z))
(if (<= (* x y) 5e+62)
(* z (* -4.5 (/ t a_m)))
(* 0.5 (* x (/ y a_m))))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -2e+238) {
tmp = y * ((x * 0.5) / a_m);
} else if ((x * y) <= 2e-166) {
tmp = (t * -4.5) / (a_m / z);
} else if ((x * y) <= 5e+62) {
tmp = z * (-4.5 * (t / a_m));
} else {
tmp = 0.5 * (x * (y / a_m));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if ((x * y) <= (-2d+238)) then
tmp = y * ((x * 0.5d0) / a_m)
else if ((x * y) <= 2d-166) then
tmp = (t * (-4.5d0)) / (a_m / z)
else if ((x * y) <= 5d+62) then
tmp = z * ((-4.5d0) * (t / a_m))
else
tmp = 0.5d0 * (x * (y / a_m))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -2e+238) {
tmp = y * ((x * 0.5) / a_m);
} else if ((x * y) <= 2e-166) {
tmp = (t * -4.5) / (a_m / z);
} else if ((x * y) <= 5e+62) {
tmp = z * (-4.5 * (t / a_m));
} else {
tmp = 0.5 * (x * (y / a_m));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x * y) <= -2e+238: tmp = y * ((x * 0.5) / a_m) elif (x * y) <= 2e-166: tmp = (t * -4.5) / (a_m / z) elif (x * y) <= 5e+62: tmp = z * (-4.5 * (t / a_m)) else: tmp = 0.5 * (x * (y / a_m)) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(x * y) <= -2e+238) tmp = Float64(y * Float64(Float64(x * 0.5) / a_m)); elseif (Float64(x * y) <= 2e-166) tmp = Float64(Float64(t * -4.5) / Float64(a_m / z)); elseif (Float64(x * y) <= 5e+62) tmp = Float64(z * Float64(-4.5 * Float64(t / a_m))); else tmp = Float64(0.5 * Float64(x * Float64(y / a_m))); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x * y) <= -2e+238)
tmp = y * ((x * 0.5) / a_m);
elseif ((x * y) <= 2e-166)
tmp = (t * -4.5) / (a_m / z);
elseif ((x * y) <= 5e+62)
tmp = z * (-4.5 * (t / a_m));
else
tmp = 0.5 * (x * (y / a_m));
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -2e+238], N[(y * N[(N[(x * 0.5), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-166], N[(N[(t * -4.5), $MachinePrecision] / N[(a$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+62], N[(z * N[(-4.5 * N[(t / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+238}:\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-166}:\\
\;\;\;\;\frac{t \cdot -4.5}{\frac{a\_m}{z}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+62}:\\
\;\;\;\;z \cdot \left(-4.5 \cdot \frac{t}{a\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a\_m}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e238Initial program 71.2%
div-sub62.5%
*-commutative62.5%
div-sub71.2%
cancel-sign-sub-inv71.2%
*-commutative71.2%
fma-define71.4%
distribute-rgt-neg-in71.4%
associate-*r*71.4%
distribute-lft-neg-in71.4%
*-commutative71.4%
distribute-rgt-neg-in71.4%
metadata-eval71.4%
Simplified71.4%
*-commutative71.4%
associate-*r*71.4%
metadata-eval71.4%
distribute-rgt-neg-in71.4%
distribute-lft-neg-in71.4%
fma-neg71.2%
associate-*l*71.2%
Applied egg-rr71.2%
Taylor expanded in x around inf 71.2%
associate-*r/71.2%
associate-*l*71.2%
*-commutative71.2%
associate-*r/95.5%
Simplified95.5%
if -2.0000000000000001e238 < (*.f64 x y) < 2.00000000000000008e-166Initial program 96.6%
div-sub94.2%
*-commutative94.2%
div-sub96.6%
cancel-sign-sub-inv96.6%
*-commutative96.6%
fma-define96.6%
distribute-rgt-neg-in96.6%
associate-*r*97.5%
distribute-lft-neg-in97.5%
*-commutative97.5%
distribute-rgt-neg-in97.5%
metadata-eval97.5%
Simplified97.5%
Taylor expanded in x around 0 74.5%
*-commutative74.5%
associate-/l*72.7%
associate-*r*72.7%
*-commutative72.7%
Simplified72.7%
associate-*r*72.7%
clear-num72.6%
un-div-inv73.4%
Applied egg-rr73.4%
if 2.00000000000000008e-166 < (*.f64 x y) < 5.00000000000000029e62Initial program 93.3%
div-sub93.3%
*-commutative93.3%
div-sub93.3%
cancel-sign-sub-inv93.3%
*-commutative93.3%
fma-define93.3%
distribute-rgt-neg-in93.3%
associate-*r*93.4%
distribute-lft-neg-in93.4%
*-commutative93.4%
distribute-rgt-neg-in93.4%
metadata-eval93.4%
Simplified93.4%
Taylor expanded in z around inf 86.9%
Taylor expanded in t around inf 69.9%
if 5.00000000000000029e62 < (*.f64 x y) Initial program 87.7%
div-sub84.5%
*-commutative84.5%
div-sub87.7%
cancel-sign-sub-inv87.7%
*-commutative87.7%
fma-define89.3%
distribute-rgt-neg-in89.3%
associate-*r*89.3%
distribute-lft-neg-in89.3%
*-commutative89.3%
distribute-rgt-neg-in89.3%
metadata-eval89.3%
Simplified89.3%
Taylor expanded in x around inf 79.9%
associate-/l*79.5%
Simplified79.5%
Final simplification76.2%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* x y) -1e+241)
(* x (+ (* -4.5 (/ (* z t) (* a_m x))) (* 0.5 (/ y a_m))))
(if (<= (* x y) 1e+294)
(/ (- (* x y) (* z (* t 9.0))) (* a_m 2.0))
(/ (* x 0.5) (* a_m (/ 1.0 y)))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -1e+241) {
tmp = x * ((-4.5 * ((z * t) / (a_m * x))) + (0.5 * (y / a_m)));
} else if ((x * y) <= 1e+294) {
tmp = ((x * y) - (z * (t * 9.0))) / (a_m * 2.0);
} else {
tmp = (x * 0.5) / (a_m * (1.0 / y));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if ((x * y) <= (-1d+241)) then
tmp = x * (((-4.5d0) * ((z * t) / (a_m * x))) + (0.5d0 * (y / a_m)))
else if ((x * y) <= 1d+294) then
tmp = ((x * y) - (z * (t * 9.0d0))) / (a_m * 2.0d0)
else
tmp = (x * 0.5d0) / (a_m * (1.0d0 / y))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -1e+241) {
tmp = x * ((-4.5 * ((z * t) / (a_m * x))) + (0.5 * (y / a_m)));
} else if ((x * y) <= 1e+294) {
tmp = ((x * y) - (z * (t * 9.0))) / (a_m * 2.0);
} else {
tmp = (x * 0.5) / (a_m * (1.0 / y));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x * y) <= -1e+241: tmp = x * ((-4.5 * ((z * t) / (a_m * x))) + (0.5 * (y / a_m))) elif (x * y) <= 1e+294: tmp = ((x * y) - (z * (t * 9.0))) / (a_m * 2.0) else: tmp = (x * 0.5) / (a_m * (1.0 / y)) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(x * y) <= -1e+241) tmp = Float64(x * Float64(Float64(-4.5 * Float64(Float64(z * t) / Float64(a_m * x))) + Float64(0.5 * Float64(y / a_m)))); elseif (Float64(x * y) <= 1e+294) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(t * 9.0))) / Float64(a_m * 2.0)); else tmp = Float64(Float64(x * 0.5) / Float64(a_m * Float64(1.0 / y))); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x * y) <= -1e+241)
tmp = x * ((-4.5 * ((z * t) / (a_m * x))) + (0.5 * (y / a_m)));
elseif ((x * y) <= 1e+294)
tmp = ((x * y) - (z * (t * 9.0))) / (a_m * 2.0);
else
tmp = (x * 0.5) / (a_m * (1.0 / y));
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+241], N[(x * N[(N[(-4.5 * N[(N[(z * t), $MachinePrecision] / N[(a$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+294], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] / N[(a$95$m * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+241}:\\
\;\;\;\;x \cdot \left(-4.5 \cdot \frac{z \cdot t}{a\_m \cdot x} + 0.5 \cdot \frac{y}{a\_m}\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{+294}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a\_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 0.5}{a\_m \cdot \frac{1}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.0000000000000001e241Initial program 69.9%
div-sub60.8%
*-commutative60.8%
div-sub69.9%
cancel-sign-sub-inv69.9%
*-commutative69.9%
fma-define70.1%
distribute-rgt-neg-in70.1%
associate-*r*70.1%
distribute-lft-neg-in70.1%
*-commutative70.1%
distribute-rgt-neg-in70.1%
metadata-eval70.1%
Simplified70.1%
Taylor expanded in x around inf 95.6%
if -1.0000000000000001e241 < (*.f64 x y) < 1.00000000000000007e294Initial program 96.1%
div-sub94.2%
*-commutative94.2%
div-sub96.1%
cancel-sign-sub-inv96.1%
*-commutative96.1%
fma-define96.1%
distribute-rgt-neg-in96.1%
associate-*r*96.6%
distribute-lft-neg-in96.6%
*-commutative96.6%
distribute-rgt-neg-in96.6%
metadata-eval96.6%
Simplified96.6%
*-commutative96.6%
associate-*r*96.1%
metadata-eval96.1%
distribute-rgt-neg-in96.1%
distribute-lft-neg-in96.1%
fma-neg96.1%
associate-*l*96.6%
Applied egg-rr96.6%
if 1.00000000000000007e294 < (*.f64 x y) Initial program 70.1%
div-sub65.6%
*-commutative65.6%
div-sub70.1%
cancel-sign-sub-inv70.1%
*-commutative70.1%
fma-define74.7%
distribute-rgt-neg-in74.7%
associate-*r*74.7%
distribute-lft-neg-in74.7%
*-commutative74.7%
distribute-rgt-neg-in74.7%
metadata-eval74.7%
Simplified74.7%
Taylor expanded in x around inf 74.7%
associate-/l*95.1%
Simplified95.1%
associate-*r*95.1%
clear-num95.1%
un-div-inv95.0%
*-commutative95.0%
Applied egg-rr95.0%
div-inv95.0%
Applied egg-rr95.0%
Final simplification96.4%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* x y) -1e+241)
(* y (/ (* x 0.5) a_m))
(if (<= (* x y) 1e+294)
(/ (- (* x y) (* z (* t 9.0))) (* a_m 2.0))
(/ (* x 0.5) (* a_m (/ 1.0 y)))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -1e+241) {
tmp = y * ((x * 0.5) / a_m);
} else if ((x * y) <= 1e+294) {
tmp = ((x * y) - (z * (t * 9.0))) / (a_m * 2.0);
} else {
tmp = (x * 0.5) / (a_m * (1.0 / y));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if ((x * y) <= (-1d+241)) then
tmp = y * ((x * 0.5d0) / a_m)
else if ((x * y) <= 1d+294) then
tmp = ((x * y) - (z * (t * 9.0d0))) / (a_m * 2.0d0)
else
tmp = (x * 0.5d0) / (a_m * (1.0d0 / y))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -1e+241) {
tmp = y * ((x * 0.5) / a_m);
} else if ((x * y) <= 1e+294) {
tmp = ((x * y) - (z * (t * 9.0))) / (a_m * 2.0);
} else {
tmp = (x * 0.5) / (a_m * (1.0 / y));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x * y) <= -1e+241: tmp = y * ((x * 0.5) / a_m) elif (x * y) <= 1e+294: tmp = ((x * y) - (z * (t * 9.0))) / (a_m * 2.0) else: tmp = (x * 0.5) / (a_m * (1.0 / y)) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(x * y) <= -1e+241) tmp = Float64(y * Float64(Float64(x * 0.5) / a_m)); elseif (Float64(x * y) <= 1e+294) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(t * 9.0))) / Float64(a_m * 2.0)); else tmp = Float64(Float64(x * 0.5) / Float64(a_m * Float64(1.0 / y))); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x * y) <= -1e+241)
tmp = y * ((x * 0.5) / a_m);
elseif ((x * y) <= 1e+294)
tmp = ((x * y) - (z * (t * 9.0))) / (a_m * 2.0);
else
tmp = (x * 0.5) / (a_m * (1.0 / y));
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+241], N[(y * N[(N[(x * 0.5), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+294], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] / N[(a$95$m * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+241}:\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 10^{+294}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a\_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 0.5}{a\_m \cdot \frac{1}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.0000000000000001e241Initial program 69.9%
div-sub60.8%
*-commutative60.8%
div-sub69.9%
cancel-sign-sub-inv69.9%
*-commutative69.9%
fma-define70.1%
distribute-rgt-neg-in70.1%
associate-*r*70.1%
distribute-lft-neg-in70.1%
*-commutative70.1%
distribute-rgt-neg-in70.1%
metadata-eval70.1%
Simplified70.1%
*-commutative70.1%
associate-*r*70.1%
metadata-eval70.1%
distribute-rgt-neg-in70.1%
distribute-lft-neg-in70.1%
fma-neg69.9%
associate-*l*69.9%
Applied egg-rr69.9%
Taylor expanded in x around inf 69.9%
associate-*r/69.9%
associate-*l*69.9%
*-commutative69.9%
associate-*r/95.3%
Simplified95.3%
if -1.0000000000000001e241 < (*.f64 x y) < 1.00000000000000007e294Initial program 96.1%
div-sub94.2%
*-commutative94.2%
div-sub96.1%
cancel-sign-sub-inv96.1%
*-commutative96.1%
fma-define96.1%
distribute-rgt-neg-in96.1%
associate-*r*96.6%
distribute-lft-neg-in96.6%
*-commutative96.6%
distribute-rgt-neg-in96.6%
metadata-eval96.6%
Simplified96.6%
*-commutative96.6%
associate-*r*96.1%
metadata-eval96.1%
distribute-rgt-neg-in96.1%
distribute-lft-neg-in96.1%
fma-neg96.1%
associate-*l*96.6%
Applied egg-rr96.6%
if 1.00000000000000007e294 < (*.f64 x y) Initial program 70.1%
div-sub65.6%
*-commutative65.6%
div-sub70.1%
cancel-sign-sub-inv70.1%
*-commutative70.1%
fma-define74.7%
distribute-rgt-neg-in74.7%
associate-*r*74.7%
distribute-lft-neg-in74.7%
*-commutative74.7%
distribute-rgt-neg-in74.7%
metadata-eval74.7%
Simplified74.7%
Taylor expanded in x around inf 74.7%
associate-/l*95.1%
Simplified95.1%
associate-*r*95.1%
clear-num95.1%
un-div-inv95.0%
*-commutative95.0%
Applied egg-rr95.0%
div-inv95.0%
Applied egg-rr95.0%
Final simplification96.4%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* x y) -1e+241)
(* y (/ (* x 0.5) a_m))
(if (<= (* x y) 1e+294)
(/ (- (* x y) (* 9.0 (* z t))) (* a_m 2.0))
(/ (* x 0.5) (* a_m (/ 1.0 y)))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -1e+241) {
tmp = y * ((x * 0.5) / a_m);
} else if ((x * y) <= 1e+294) {
tmp = ((x * y) - (9.0 * (z * t))) / (a_m * 2.0);
} else {
tmp = (x * 0.5) / (a_m * (1.0 / y));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if ((x * y) <= (-1d+241)) then
tmp = y * ((x * 0.5d0) / a_m)
else if ((x * y) <= 1d+294) then
tmp = ((x * y) - (9.0d0 * (z * t))) / (a_m * 2.0d0)
else
tmp = (x * 0.5d0) / (a_m * (1.0d0 / y))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -1e+241) {
tmp = y * ((x * 0.5) / a_m);
} else if ((x * y) <= 1e+294) {
tmp = ((x * y) - (9.0 * (z * t))) / (a_m * 2.0);
} else {
tmp = (x * 0.5) / (a_m * (1.0 / y));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x * y) <= -1e+241: tmp = y * ((x * 0.5) / a_m) elif (x * y) <= 1e+294: tmp = ((x * y) - (9.0 * (z * t))) / (a_m * 2.0) else: tmp = (x * 0.5) / (a_m * (1.0 / y)) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(x * y) <= -1e+241) tmp = Float64(y * Float64(Float64(x * 0.5) / a_m)); elseif (Float64(x * y) <= 1e+294) tmp = Float64(Float64(Float64(x * y) - Float64(9.0 * Float64(z * t))) / Float64(a_m * 2.0)); else tmp = Float64(Float64(x * 0.5) / Float64(a_m * Float64(1.0 / y))); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x * y) <= -1e+241)
tmp = y * ((x * 0.5) / a_m);
elseif ((x * y) <= 1e+294)
tmp = ((x * y) - (9.0 * (z * t))) / (a_m * 2.0);
else
tmp = (x * 0.5) / (a_m * (1.0 / y));
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+241], N[(y * N[(N[(x * 0.5), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+294], N[(N[(N[(x * y), $MachinePrecision] - N[(9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] / N[(a$95$m * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+241}:\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 10^{+294}:\\
\;\;\;\;\frac{x \cdot y - 9 \cdot \left(z \cdot t\right)}{a\_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 0.5}{a\_m \cdot \frac{1}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.0000000000000001e241Initial program 69.9%
div-sub60.8%
*-commutative60.8%
div-sub69.9%
cancel-sign-sub-inv69.9%
*-commutative69.9%
fma-define70.1%
distribute-rgt-neg-in70.1%
associate-*r*70.1%
distribute-lft-neg-in70.1%
*-commutative70.1%
distribute-rgt-neg-in70.1%
metadata-eval70.1%
Simplified70.1%
*-commutative70.1%
associate-*r*70.1%
metadata-eval70.1%
distribute-rgt-neg-in70.1%
distribute-lft-neg-in70.1%
fma-neg69.9%
associate-*l*69.9%
Applied egg-rr69.9%
Taylor expanded in x around inf 69.9%
associate-*r/69.9%
associate-*l*69.9%
*-commutative69.9%
associate-*r/95.3%
Simplified95.3%
if -1.0000000000000001e241 < (*.f64 x y) < 1.00000000000000007e294Initial program 96.1%
Taylor expanded in z around 0 96.6%
if 1.00000000000000007e294 < (*.f64 x y) Initial program 70.1%
div-sub65.6%
*-commutative65.6%
div-sub70.1%
cancel-sign-sub-inv70.1%
*-commutative70.1%
fma-define74.7%
distribute-rgt-neg-in74.7%
associate-*r*74.7%
distribute-lft-neg-in74.7%
*-commutative74.7%
distribute-rgt-neg-in74.7%
metadata-eval74.7%
Simplified74.7%
Taylor expanded in x around inf 74.7%
associate-/l*95.1%
Simplified95.1%
associate-*r*95.1%
clear-num95.1%
un-div-inv95.0%
*-commutative95.0%
Applied egg-rr95.0%
div-inv95.0%
Applied egg-rr95.0%
Final simplification96.4%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (or (<= x -8.5e+151) (not (<= x 8.4e-119)))
(* 0.5 (* x (/ y a_m)))
(* t (* -4.5 (/ z a_m))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x <= -8.5e+151) || !(x <= 8.4e-119)) {
tmp = 0.5 * (x * (y / a_m));
} else {
tmp = t * (-4.5 * (z / a_m));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if ((x <= (-8.5d+151)) .or. (.not. (x <= 8.4d-119))) then
tmp = 0.5d0 * (x * (y / a_m))
else
tmp = t * ((-4.5d0) * (z / a_m))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x <= -8.5e+151) || !(x <= 8.4e-119)) {
tmp = 0.5 * (x * (y / a_m));
} else {
tmp = t * (-4.5 * (z / a_m));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x <= -8.5e+151) or not (x <= 8.4e-119): tmp = 0.5 * (x * (y / a_m)) else: tmp = t * (-4.5 * (z / a_m)) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if ((x <= -8.5e+151) || !(x <= 8.4e-119)) tmp = Float64(0.5 * Float64(x * Float64(y / a_m))); else tmp = Float64(t * Float64(-4.5 * Float64(z / a_m))); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x <= -8.5e+151) || ~((x <= 8.4e-119)))
tmp = 0.5 * (x * (y / a_m));
else
tmp = t * (-4.5 * (z / a_m));
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[Or[LessEqual[x, -8.5e+151], N[Not[LessEqual[x, 8.4e-119]], $MachinePrecision]], N[(0.5 * N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(-4.5 * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{+151} \lor \neg \left(x \leq 8.4 \cdot 10^{-119}\right):\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a\_m}\right)\\
\end{array}
\end{array}
if x < -8.50000000000000051e151 or 8.4e-119 < x Initial program 90.0%
div-sub86.5%
*-commutative86.5%
div-sub90.0%
cancel-sign-sub-inv90.0%
*-commutative90.0%
fma-define90.7%
distribute-rgt-neg-in90.7%
associate-*r*90.7%
distribute-lft-neg-in90.7%
*-commutative90.7%
distribute-rgt-neg-in90.7%
metadata-eval90.7%
Simplified90.7%
Taylor expanded in x around inf 59.3%
associate-/l*61.0%
Simplified61.0%
if -8.50000000000000051e151 < x < 8.4e-119Initial program 93.7%
div-sub91.9%
*-commutative91.9%
div-sub93.7%
cancel-sign-sub-inv93.7%
*-commutative93.7%
fma-define93.7%
distribute-rgt-neg-in93.7%
associate-*r*94.7%
distribute-lft-neg-in94.7%
*-commutative94.7%
distribute-rgt-neg-in94.7%
metadata-eval94.7%
Simplified94.7%
Taylor expanded in x around 0 72.9%
*-commutative72.9%
associate-/l*73.4%
associate-*r*73.5%
*-commutative73.5%
Simplified73.5%
Final simplification66.5%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (or (<= x -8.2e+151) (not (<= x 2e-118)))
(* 0.5 (* x (/ y a_m)))
(* -4.5 (/ (* z t) a_m)))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x <= -8.2e+151) || !(x <= 2e-118)) {
tmp = 0.5 * (x * (y / a_m));
} else {
tmp = -4.5 * ((z * t) / a_m);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if ((x <= (-8.2d+151)) .or. (.not. (x <= 2d-118))) then
tmp = 0.5d0 * (x * (y / a_m))
else
tmp = (-4.5d0) * ((z * t) / a_m)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x <= -8.2e+151) || !(x <= 2e-118)) {
tmp = 0.5 * (x * (y / a_m));
} else {
tmp = -4.5 * ((z * t) / a_m);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (x <= -8.2e+151) or not (x <= 2e-118): tmp = 0.5 * (x * (y / a_m)) else: tmp = -4.5 * ((z * t) / a_m) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if ((x <= -8.2e+151) || !(x <= 2e-118)) tmp = Float64(0.5 * Float64(x * Float64(y / a_m))); else tmp = Float64(-4.5 * Float64(Float64(z * t) / a_m)); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if ((x <= -8.2e+151) || ~((x <= 2e-118)))
tmp = 0.5 * (x * (y / a_m));
else
tmp = -4.5 * ((z * t) / a_m);
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[Or[LessEqual[x, -8.2e+151], N[Not[LessEqual[x, 2e-118]], $MachinePrecision]], N[(0.5 * N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{+151} \lor \neg \left(x \leq 2 \cdot 10^{-118}\right):\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a\_m}\\
\end{array}
\end{array}
if x < -8.1999999999999996e151 or 1.99999999999999997e-118 < x Initial program 90.0%
div-sub86.5%
*-commutative86.5%
div-sub90.0%
cancel-sign-sub-inv90.0%
*-commutative90.0%
fma-define90.7%
distribute-rgt-neg-in90.7%
associate-*r*90.7%
distribute-lft-neg-in90.7%
*-commutative90.7%
distribute-rgt-neg-in90.7%
metadata-eval90.7%
Simplified90.7%
Taylor expanded in x around inf 59.3%
associate-/l*61.0%
Simplified61.0%
if -8.1999999999999996e151 < x < 1.99999999999999997e-118Initial program 93.7%
div-sub91.9%
*-commutative91.9%
div-sub93.7%
cancel-sign-sub-inv93.7%
*-commutative93.7%
fma-define93.7%
distribute-rgt-neg-in93.7%
associate-*r*94.7%
distribute-lft-neg-in94.7%
*-commutative94.7%
distribute-rgt-neg-in94.7%
metadata-eval94.7%
Simplified94.7%
Taylor expanded in x around 0 72.9%
Final simplification66.3%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= x -2.6e+162)
(* y (/ (* x 0.5) a_m))
(if (<= x 2e-118) (* t (* -4.5 (/ z a_m))) (* 0.5 (* x (/ y a_m)))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (x <= -2.6e+162) {
tmp = y * ((x * 0.5) / a_m);
} else if (x <= 2e-118) {
tmp = t * (-4.5 * (z / a_m));
} else {
tmp = 0.5 * (x * (y / a_m));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if (x <= (-2.6d+162)) then
tmp = y * ((x * 0.5d0) / a_m)
else if (x <= 2d-118) then
tmp = t * ((-4.5d0) * (z / a_m))
else
tmp = 0.5d0 * (x * (y / a_m))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (x <= -2.6e+162) {
tmp = y * ((x * 0.5) / a_m);
} else if (x <= 2e-118) {
tmp = t * (-4.5 * (z / a_m));
} else {
tmp = 0.5 * (x * (y / a_m));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if x <= -2.6e+162: tmp = y * ((x * 0.5) / a_m) elif x <= 2e-118: tmp = t * (-4.5 * (z / a_m)) else: tmp = 0.5 * (x * (y / a_m)) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (x <= -2.6e+162) tmp = Float64(y * Float64(Float64(x * 0.5) / a_m)); elseif (x <= 2e-118) tmp = Float64(t * Float64(-4.5 * Float64(z / a_m))); else tmp = Float64(0.5 * Float64(x * Float64(y / a_m))); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if (x <= -2.6e+162)
tmp = y * ((x * 0.5) / a_m);
elseif (x <= 2e-118)
tmp = t * (-4.5 * (z / a_m));
else
tmp = 0.5 * (x * (y / a_m));
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[x, -2.6e+162], N[(y * N[(N[(x * 0.5), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e-118], N[(t * N[(-4.5 * N[(z / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+162}:\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{a\_m}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-118}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a\_m}\right)\\
\end{array}
\end{array}
if x < -2.6e162Initial program 87.9%
div-sub81.2%
*-commutative81.2%
div-sub87.9%
cancel-sign-sub-inv87.9%
*-commutative87.9%
fma-define87.9%
distribute-rgt-neg-in87.9%
associate-*r*87.9%
distribute-lft-neg-in87.9%
*-commutative87.9%
distribute-rgt-neg-in87.9%
metadata-eval87.9%
Simplified87.9%
*-commutative87.9%
associate-*r*87.9%
metadata-eval87.9%
distribute-rgt-neg-in87.9%
distribute-lft-neg-in87.9%
fma-neg87.9%
associate-*l*87.9%
Applied egg-rr87.9%
Taylor expanded in x around inf 65.1%
associate-*r/65.1%
associate-*l*65.1%
*-commutative65.1%
associate-*r/68.0%
Simplified68.0%
if -2.6e162 < x < 1.99999999999999997e-118Initial program 93.8%
div-sub92.0%
*-commutative92.0%
div-sub93.8%
cancel-sign-sub-inv93.8%
*-commutative93.8%
fma-define93.8%
distribute-rgt-neg-in93.8%
associate-*r*94.7%
distribute-lft-neg-in94.7%
*-commutative94.7%
distribute-rgt-neg-in94.7%
metadata-eval94.7%
Simplified94.7%
Taylor expanded in x around 0 72.3%
*-commutative72.3%
associate-/l*72.8%
associate-*r*72.9%
*-commutative72.9%
Simplified72.9%
if 1.99999999999999997e-118 < x Initial program 90.4%
div-sub87.7%
*-commutative87.7%
div-sub90.4%
cancel-sign-sub-inv90.4%
*-commutative90.4%
fma-define91.3%
distribute-rgt-neg-in91.3%
associate-*r*91.4%
distribute-lft-neg-in91.4%
*-commutative91.4%
distribute-rgt-neg-in91.4%
metadata-eval91.4%
Simplified91.4%
Taylor expanded in x around inf 57.4%
associate-/l*58.1%
Simplified58.1%
Final simplification65.8%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (if (<= t 1.46e+112) (* -4.5 (/ (* z t) a_m)) (* -4.5 (* z (/ t a_m))))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (t <= 1.46e+112) {
tmp = -4.5 * ((z * t) / a_m);
} else {
tmp = -4.5 * (z * (t / a_m));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
real(8) :: tmp
if (t <= 1.46d+112) then
tmp = (-4.5d0) * ((z * t) / a_m)
else
tmp = (-4.5d0) * (z * (t / a_m))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (t <= 1.46e+112) {
tmp = -4.5 * ((z * t) / a_m);
} else {
tmp = -4.5 * (z * (t / a_m));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): tmp = 0 if t <= 1.46e+112: tmp = -4.5 * ((z * t) / a_m) else: tmp = -4.5 * (z * (t / a_m)) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (t <= 1.46e+112) tmp = Float64(-4.5 * Float64(Float64(z * t) / a_m)); else tmp = Float64(-4.5 * Float64(z * Float64(t / a_m))); end return Float64(a_s * tmp) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if (t <= 1.46e+112)
tmp = -4.5 * ((z * t) / a_m);
else
tmp = -4.5 * (z * (t / a_m));
end
tmp_2 = a_s * tmp;
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[t, 1.46e+112], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z * N[(t / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq 1.46 \cdot 10^{+112}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a\_m}\right)\\
\end{array}
\end{array}
if t < 1.4600000000000001e112Initial program 94.0%
div-sub92.0%
*-commutative92.0%
div-sub94.0%
cancel-sign-sub-inv94.0%
*-commutative94.0%
fma-define94.0%
distribute-rgt-neg-in94.0%
associate-*r*94.5%
distribute-lft-neg-in94.5%
*-commutative94.5%
distribute-rgt-neg-in94.5%
metadata-eval94.5%
Simplified94.5%
Taylor expanded in x around 0 51.0%
if 1.4600000000000001e112 < t Initial program 83.8%
div-sub78.8%
*-commutative78.8%
div-sub83.8%
cancel-sign-sub-inv83.8%
*-commutative83.8%
fma-define85.6%
distribute-rgt-neg-in85.6%
associate-*r*85.7%
distribute-lft-neg-in85.7%
*-commutative85.7%
distribute-rgt-neg-in85.7%
metadata-eval85.7%
Simplified85.7%
Taylor expanded in x around 0 62.5%
associate-*r/62.6%
associate-*r*62.6%
associate-*l/68.8%
associate-*r/68.8%
associate-*l*68.7%
Simplified68.7%
Final simplification55.2%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function. (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (* -4.5 (* z (/ t a_m)))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
double code(double a_s, double x, double y, double z, double t, double a_m) {
return a_s * (-4.5 * (z * (t / a_m)));
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
real(8) function code(a_s, x, y, z, t, a_m)
real(8), intent (in) :: a_s
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_m
code = a_s * ((-4.5d0) * (z * (t / a_m)))
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
return a_s * (-4.5 * (z * (t / a_m)));
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): return a_s * (-4.5 * (z * (t / a_m)))
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) return Float64(a_s * Float64(-4.5 * Float64(z * Float64(t / a_m)))) end
a\_m = abs(a);
a\_s = sign(a) * abs(1.0);
x, y, z, t, a_m = num2cell(sort([x, y, z, t, a_m])){:}
function tmp = code(a_s, x, y, z, t, a_m)
tmp = a_s * (-4.5 * (z * (t / a_m)));
end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y, z, t, and a_m should be sorted in increasing order before calling this function.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * N[(-4.5 * N[(z * N[(t / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(-4.5 \cdot \left(z \cdot \frac{t}{a\_m}\right)\right)
\end{array}
Initial program 91.6%
div-sub88.9%
*-commutative88.9%
div-sub91.6%
cancel-sign-sub-inv91.6%
*-commutative91.6%
fma-define92.0%
distribute-rgt-neg-in92.0%
associate-*r*92.5%
distribute-lft-neg-in92.5%
*-commutative92.5%
distribute-rgt-neg-in92.5%
metadata-eval92.5%
Simplified92.5%
Taylor expanded in x around 0 53.7%
associate-*r/53.7%
associate-*r*53.7%
associate-*l/53.4%
associate-*r/53.4%
associate-*l*53.4%
Simplified53.4%
Final simplification53.4%
(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 2024136
(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)))