
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
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 * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\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 t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
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 * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\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.
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 3.9e-43)
(/ (fma t (- z) (* x y)) a_m)
(- (* x (/ y a_m)) (/ z (/ a_m t))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 <= 3.9e-43) {
tmp = fma(t, -z, (x * y)) / a_m;
} else {
tmp = (x * (y / a_m)) - (z / (a_m / t));
}
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]) 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 (a_m <= 3.9e-43) tmp = Float64(fma(t, Float64(-z), Float64(x * y)) / a_m); else tmp = Float64(Float64(x * Float64(y / a_m)) - Float64(z / Float64(a_m / t))); 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.
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[a$95$m, 3.9e-43], N[(N[(t * (-z) + N[(x * y), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a$95$m / t), $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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 3.9 \cdot 10^{-43}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, -z, x \cdot y\right)}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m} - \frac{z}{\frac{a\_m}{t}}\\
\end{array}
\end{array}
if a < 3.9e-43Initial program 94.0%
sub-neg94.0%
+-commutative94.0%
distribute-lft-neg-out94.0%
*-commutative94.0%
fma-define94.5%
Simplified94.5%
if 3.9e-43 < a Initial program 86.9%
div-sub86.9%
associate-/l*85.6%
associate-/l*90.8%
Applied egg-rr90.8%
clear-num90.8%
un-div-inv91.0%
Applied egg-rr91.0%
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.
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
(let* ((t_1 (/ (* t z) (- a_m))))
(*
a_s
(if (<= (* x y) -1e+29)
(* y (/ x a_m))
(if (<= (* x y) 5e-208)
t_1
(if (<= (* x y) 0.001)
(* x (/ y a_m))
(if (<= (* x y) 2e+47) t_1 (/ y (/ a_m x)))))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 t_1 = (t * z) / -a_m;
double tmp;
if ((x * y) <= -1e+29) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e-208) {
tmp = t_1;
} else if ((x * y) <= 0.001) {
tmp = x * (y / a_m);
} else if ((x * y) <= 2e+47) {
tmp = t_1;
} else {
tmp = y / (a_m / x);
}
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.
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) :: t_1
real(8) :: tmp
t_1 = (t * z) / -a_m
if ((x * y) <= (-1d+29)) then
tmp = y * (x / a_m)
else if ((x * y) <= 5d-208) then
tmp = t_1
else if ((x * y) <= 0.001d0) then
tmp = x * (y / a_m)
else if ((x * y) <= 2d+47) then
tmp = t_1
else
tmp = y / (a_m / x)
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;
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 t_1 = (t * z) / -a_m;
double tmp;
if ((x * y) <= -1e+29) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e-208) {
tmp = t_1;
} else if ((x * y) <= 0.001) {
tmp = x * (y / a_m);
} else if ((x * y) <= 2e+47) {
tmp = t_1;
} else {
tmp = y / (a_m / x);
}
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]) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): t_1 = (t * z) / -a_m tmp = 0 if (x * y) <= -1e+29: tmp = y * (x / a_m) elif (x * y) <= 5e-208: tmp = t_1 elif (x * y) <= 0.001: tmp = x * (y / a_m) elif (x * y) <= 2e+47: tmp = t_1 else: tmp = y / (a_m / x) 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]) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) t_1 = Float64(Float64(t * z) / Float64(-a_m)) tmp = 0.0 if (Float64(x * y) <= -1e+29) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 5e-208) tmp = t_1; elseif (Float64(x * y) <= 0.001) tmp = Float64(x * Float64(y / a_m)); elseif (Float64(x * y) <= 2e+47) tmp = t_1; else tmp = Float64(y / Float64(a_m / x)); 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])){:}
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)
t_1 = (t * z) / -a_m;
tmp = 0.0;
if ((x * y) <= -1e+29)
tmp = y * (x / a_m);
elseif ((x * y) <= 5e-208)
tmp = t_1;
elseif ((x * y) <= 0.001)
tmp = x * (y / a_m);
elseif ((x * y) <= 2e+47)
tmp = t_1;
else
tmp = y / (a_m / x);
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.
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_] := Block[{t$95$1 = N[(N[(t * z), $MachinePrecision] / (-a$95$m)), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+29], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-208], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 0.001], N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+47], t$95$1, N[(y / N[(a$95$m / x), $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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := \frac{t \cdot z}{-a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+29}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-208}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 0.001:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\
\end{array}
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999914e28Initial program 88.7%
Taylor expanded in x around inf 75.8%
associate-*r/74.3%
Simplified74.3%
*-commutative74.3%
div-inv74.3%
associate-*l*86.5%
Applied egg-rr86.5%
associate-*l/86.6%
*-lft-identity86.6%
Simplified86.6%
if -9.99999999999999914e28 < (*.f64 x y) < 4.99999999999999963e-208 or 1e-3 < (*.f64 x y) < 2.0000000000000001e47Initial program 96.9%
Taylor expanded in x around 0 79.6%
mul-1-neg79.6%
*-commutative79.6%
distribute-rgt-neg-in79.6%
Simplified79.6%
if 4.99999999999999963e-208 < (*.f64 x y) < 1e-3Initial program 93.7%
Taylor expanded in x around inf 63.8%
associate-*r/63.7%
Simplified63.7%
if 2.0000000000000001e47 < (*.f64 x y) Initial program 84.4%
Taylor expanded in x around inf 76.8%
associate-*r/75.2%
Simplified75.2%
*-commutative75.2%
div-inv75.1%
associate-*l*78.6%
Applied egg-rr78.6%
associate-*l/78.5%
*-lft-identity78.5%
Simplified78.5%
clear-num78.5%
un-div-inv78.4%
Applied egg-rr78.4%
Final simplification79.0%
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.
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
(let* ((t_1 (* (- z) (/ t a_m))))
(*
a_s
(if (<= (* x y) -1e+29)
(* y (/ x a_m))
(if (<= (* x y) 5e-208)
t_1
(if (<= (* x y) 0.001)
(* x (/ y a_m))
(if (<= (* x y) 2e+47) t_1 (/ y (/ a_m x)))))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 t_1 = -z * (t / a_m);
double tmp;
if ((x * y) <= -1e+29) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e-208) {
tmp = t_1;
} else if ((x * y) <= 0.001) {
tmp = x * (y / a_m);
} else if ((x * y) <= 2e+47) {
tmp = t_1;
} else {
tmp = y / (a_m / x);
}
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.
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) :: t_1
real(8) :: tmp
t_1 = -z * (t / a_m)
if ((x * y) <= (-1d+29)) then
tmp = y * (x / a_m)
else if ((x * y) <= 5d-208) then
tmp = t_1
else if ((x * y) <= 0.001d0) then
tmp = x * (y / a_m)
else if ((x * y) <= 2d+47) then
tmp = t_1
else
tmp = y / (a_m / x)
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;
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 t_1 = -z * (t / a_m);
double tmp;
if ((x * y) <= -1e+29) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e-208) {
tmp = t_1;
} else if ((x * y) <= 0.001) {
tmp = x * (y / a_m);
} else if ((x * y) <= 2e+47) {
tmp = t_1;
} else {
tmp = y / (a_m / x);
}
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]) [x, y, z, t, a_m] = sort([x, y, z, t, a_m]) def code(a_s, x, y, z, t, a_m): t_1 = -z * (t / a_m) tmp = 0 if (x * y) <= -1e+29: tmp = y * (x / a_m) elif (x * y) <= 5e-208: tmp = t_1 elif (x * y) <= 0.001: tmp = x * (y / a_m) elif (x * y) <= 2e+47: tmp = t_1 else: tmp = y / (a_m / x) 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]) x, y, z, t, a_m = sort([x, y, z, t, a_m]) function code(a_s, x, y, z, t, a_m) t_1 = Float64(Float64(-z) * Float64(t / a_m)) tmp = 0.0 if (Float64(x * y) <= -1e+29) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 5e-208) tmp = t_1; elseif (Float64(x * y) <= 0.001) tmp = Float64(x * Float64(y / a_m)); elseif (Float64(x * y) <= 2e+47) tmp = t_1; else tmp = Float64(y / Float64(a_m / x)); 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])){:}
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)
t_1 = -z * (t / a_m);
tmp = 0.0;
if ((x * y) <= -1e+29)
tmp = y * (x / a_m);
elseif ((x * y) <= 5e-208)
tmp = t_1;
elseif ((x * y) <= 0.001)
tmp = x * (y / a_m);
elseif ((x * y) <= 2e+47)
tmp = t_1;
else
tmp = y / (a_m / x);
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.
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_] := Block[{t$95$1 = N[((-z) * N[(t / a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -1e+29], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-208], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 0.001], N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+47], t$95$1, N[(y / N[(a$95$m / x), $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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot \frac{t}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+29}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-208}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 0.001:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\
\end{array}
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999914e28Initial program 88.7%
Taylor expanded in x around inf 75.8%
associate-*r/74.3%
Simplified74.3%
*-commutative74.3%
div-inv74.3%
associate-*l*86.5%
Applied egg-rr86.5%
associate-*l/86.6%
*-lft-identity86.6%
Simplified86.6%
if -9.99999999999999914e28 < (*.f64 x y) < 4.99999999999999963e-208 or 1e-3 < (*.f64 x y) < 2.0000000000000001e47Initial program 96.9%
div-sub96.9%
associate-/l*89.8%
associate-/l*84.0%
Applied egg-rr84.0%
Taylor expanded in x around 0 79.6%
associate-*l/73.7%
*-commutative73.7%
neg-mul-173.7%
distribute-rgt-neg-in73.7%
distribute-frac-neg73.7%
Simplified73.7%
if 4.99999999999999963e-208 < (*.f64 x y) < 1e-3Initial program 93.7%
Taylor expanded in x around inf 63.8%
associate-*r/63.7%
Simplified63.7%
if 2.0000000000000001e47 < (*.f64 x y) Initial program 84.4%
Taylor expanded in x around inf 76.8%
associate-*r/75.2%
Simplified75.2%
*-commutative75.2%
div-inv75.1%
associate-*l*78.6%
Applied egg-rr78.6%
associate-*l/78.5%
*-lft-identity78.5%
Simplified78.5%
clear-num78.5%
un-div-inv78.4%
Applied egg-rr78.4%
Final simplification76.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.
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-53)
(* y (/ x a_m))
(if (<= (* x y) 5e-208) (* t (/ z (- a_m))) (/ (* x y) a_m)))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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-53) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e-208) {
tmp = t * (z / -a_m);
} else {
tmp = (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.
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-53)) then
tmp = y * (x / a_m)
else if ((x * y) <= 5d-208) then
tmp = t * (z / -a_m)
else
tmp = (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;
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-53) {
tmp = y * (x / a_m);
} else if ((x * y) <= 5e-208) {
tmp = t * (z / -a_m);
} else {
tmp = (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]) [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-53: tmp = y * (x / a_m) elif (x * y) <= 5e-208: tmp = t * (z / -a_m) else: tmp = (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]) 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-53) tmp = Float64(y * Float64(x / a_m)); elseif (Float64(x * y) <= 5e-208) tmp = Float64(t * Float64(z / Float64(-a_m))); else tmp = Float64(Float64(x * 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])){:}
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-53)
tmp = y * (x / a_m);
elseif ((x * y) <= 5e-208)
tmp = t * (z / -a_m);
else
tmp = (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.
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-53], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-208], N[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a$95$m), $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])\\\\
[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^{-53}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-208}:\\
\;\;\;\;t \cdot \frac{z}{-a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a\_m}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000006e-53Initial program 90.6%
Taylor expanded in x around inf 70.7%
associate-*r/68.0%
Simplified68.0%
*-commutative68.0%
div-inv68.1%
associate-*l*79.5%
Applied egg-rr79.5%
associate-*l/79.5%
*-lft-identity79.5%
Simplified79.5%
if -2.00000000000000006e-53 < (*.f64 x y) < 4.99999999999999963e-208Initial program 96.1%
Taylor expanded in x around 0 85.2%
mul-1-neg85.2%
associate-/l*84.3%
distribute-rgt-neg-in84.3%
distribute-neg-frac284.3%
Simplified84.3%
if 4.99999999999999963e-208 < (*.f64 x y) Initial program 89.2%
Taylor expanded in x around inf 67.7%
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.
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 4e-44)
(/ (- (* x y) (* t z)) a_m)
(- (* x (/ y a_m)) (/ z (/ a_m t))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 <= 4e-44) {
tmp = ((x * y) - (t * z)) / a_m;
} else {
tmp = (x * (y / a_m)) - (z / (a_m / t));
}
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.
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 <= 4d-44) then
tmp = ((x * y) - (t * z)) / a_m
else
tmp = (x * (y / a_m)) - (z / (a_m / t))
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;
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 <= 4e-44) {
tmp = ((x * y) - (t * z)) / a_m;
} else {
tmp = (x * (y / a_m)) - (z / (a_m / t));
}
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]) [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 <= 4e-44: tmp = ((x * y) - (t * z)) / a_m else: tmp = (x * (y / a_m)) - (z / (a_m / t)) 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]) 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 (a_m <= 4e-44) tmp = Float64(Float64(Float64(x * y) - Float64(t * z)) / a_m); else tmp = Float64(Float64(x * Float64(y / a_m)) - Float64(z / Float64(a_m / t))); 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])){:}
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 <= 4e-44)
tmp = ((x * y) - (t * z)) / a_m;
else
tmp = (x * (y / a_m)) - (z / (a_m / t));
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.
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[a$95$m, 4e-44], N[(N[(N[(x * y), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a$95$m / t), $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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 4 \cdot 10^{-44}:\\
\;\;\;\;\frac{x \cdot y - t \cdot z}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m} - \frac{z}{\frac{a\_m}{t}}\\
\end{array}
\end{array}
if a < 3.99999999999999981e-44Initial program 94.0%
if 3.99999999999999981e-44 < a Initial program 86.9%
div-sub86.9%
associate-/l*85.6%
associate-/l*90.8%
Applied egg-rr90.8%
clear-num90.8%
un-div-inv91.0%
Applied egg-rr91.0%
Final simplification93.1%
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.
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 1e-47)
(/ (- (* x y) (* t z)) a_m)
(- (* x (/ y a_m)) (* z (/ t a_m))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 <= 1e-47) {
tmp = ((x * y) - (t * z)) / a_m;
} else {
tmp = (x * (y / a_m)) - (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.
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 <= 1d-47) then
tmp = ((x * y) - (t * z)) / a_m
else
tmp = (x * (y / a_m)) - (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;
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 <= 1e-47) {
tmp = ((x * y) - (t * z)) / a_m;
} else {
tmp = (x * (y / a_m)) - (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]) [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 <= 1e-47: tmp = ((x * y) - (t * z)) / a_m else: tmp = (x * (y / a_m)) - (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]) 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 (a_m <= 1e-47) tmp = Float64(Float64(Float64(x * y) - Float64(t * z)) / a_m); else tmp = Float64(Float64(x * Float64(y / a_m)) - 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])){:}
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 <= 1e-47)
tmp = ((x * y) - (t * z)) / a_m;
else
tmp = (x * (y / a_m)) - (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.
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[a$95$m, 1e-47], N[(N[(N[(x * y), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision] - 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 10^{-47}:\\
\;\;\;\;\frac{x \cdot y - t \cdot z}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m} - z \cdot \frac{t}{a\_m}\\
\end{array}
\end{array}
if a < 9.9999999999999997e-48Initial program 94.0%
if 9.9999999999999997e-48 < a Initial program 86.9%
div-sub86.9%
associate-/l*85.6%
associate-/l*90.8%
Applied egg-rr90.8%
Final simplification93.0%
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.
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 z) (- INFINITY))
(* t (/ z (- a_m)))
(/ (- (* x y) (* t z)) a_m))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 * z) <= -((double) INFINITY)) {
tmp = t * (z / -a_m);
} else {
tmp = ((x * y) - (t * z)) / a_m;
}
return a_s * tmp;
}
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
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 * z) <= -Double.POSITIVE_INFINITY) {
tmp = t * (z / -a_m);
} else {
tmp = ((x * y) - (t * 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]) [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 * z) <= -math.inf: tmp = t * (z / -a_m) else: tmp = ((x * y) - (t * 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]) 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(t * z) <= Float64(-Inf)) tmp = Float64(t * Float64(z / Float64(-a_m))); else tmp = Float64(Float64(Float64(x * y) - Float64(t * 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])){:}
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 * z) <= -Inf)
tmp = t * (z / -a_m);
else
tmp = ((x * y) - (t * 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.
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[(t * z), $MachinePrecision], (-Infinity)], N[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a$95$m), $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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t \cdot z \leq -\infty:\\
\;\;\;\;t \cdot \frac{z}{-a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - t \cdot z}{a\_m}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 59.9%
Taylor expanded in x around 0 65.2%
mul-1-neg65.2%
associate-/l*94.7%
distribute-rgt-neg-in94.7%
distribute-neg-frac294.7%
Simplified94.7%
if -inf.0 < (*.f64 z t) Initial program 94.5%
Final simplification94.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. 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+237) (/ x (/ a_m y)) (/ (* x y) a_m))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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+237) {
tmp = x / (a_m / y);
} else {
tmp = (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.
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+237)) then
tmp = x / (a_m / y)
else
tmp = (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;
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+237) {
tmp = x / (a_m / y);
} else {
tmp = (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]) [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+237: tmp = x / (a_m / y) else: tmp = (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]) 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+237) tmp = Float64(x / Float64(a_m / y)); else tmp = Float64(Float64(x * 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])){:}
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+237)
tmp = x / (a_m / y);
else
tmp = (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.
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+237], N[(x / N[(a$95$m / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a$95$m), $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])\\\\
[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^{+237}:\\
\;\;\;\;\frac{x}{\frac{a\_m}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a\_m}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999988e237Initial program 73.0%
Taylor expanded in x around inf 69.3%
associate-*r/91.9%
Simplified91.9%
clear-num91.9%
un-div-inv91.9%
Applied egg-rr91.9%
if -1.99999999999999988e237 < (*.f64 x y) Initial program 93.9%
Taylor expanded in x around inf 52.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. 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 (/ y (/ a_m x))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 * (y / (a_m / x));
}
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.
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 * (y / (a_m / x))
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
assert x < y && y < z && z < t && t < a_m;
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 * (y / (a_m / x));
}
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]) [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 * (y / (a_m / x))
a\_m = abs(a) a\_s = copysign(1.0, a) x, y, z, t, a_m = sort([x, y, z, t, a_m]) 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(y / Float64(a_m / x))) 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])){:}
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 * (y / (a_m / x));
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.
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[(y / N[(a$95$m / x), $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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \frac{y}{\frac{a\_m}{x}}
\end{array}
Initial program 91.9%
Taylor expanded in x around inf 53.9%
associate-*r/52.1%
Simplified52.1%
*-commutative52.1%
div-inv52.0%
associate-*l*54.8%
Applied egg-rr54.8%
associate-*l/54.9%
*-lft-identity54.9%
Simplified54.9%
clear-num54.8%
un-div-inv54.9%
Applied egg-rr54.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. 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 (* y (/ x a_m))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 * (y * (x / 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.
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 * (y * (x / 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;
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 * (y * (x / 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]) [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 * (y * (x / 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]) 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(y * Float64(x / 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])){:}
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 * (y * (x / 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.
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[(y * N[(x / 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(y \cdot \frac{x}{a\_m}\right)
\end{array}
Initial program 91.9%
Taylor expanded in x around inf 53.9%
associate-*r/52.1%
Simplified52.1%
*-commutative52.1%
div-inv52.0%
associate-*l*54.8%
Applied egg-rr54.8%
associate-*l/54.9%
*-lft-identity54.9%
Simplified54.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. 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 (* x (/ y a_m))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
assert(x < y && y < z && z < t && t < a_m);
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 * (x * (y / 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.
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 * (x * (y / 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;
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 * (x * (y / 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]) [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 * (x * (y / 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]) 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(x * Float64(y / 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])){:}
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 * (x * (y / 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.
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[(x * N[(y / 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])\\\\
[x, y, z, t, a_m] = \mathsf{sort}([x, y, z, t, a_m])\\
\\
a\_s \cdot \left(x \cdot \frac{y}{a\_m}\right)
\end{array}
Initial program 91.9%
Taylor expanded in x around inf 53.9%
associate-*r/52.1%
Simplified52.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
(if (< z -2.468684968699548e+170)
t_1
(if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = ((y / a) * x) - ((t / a) * z)
if (z < (-2.468684968699548d+170)) then
tmp = t_1
else if (z < 6.309831121978371d-71) then
tmp = ((x * y) - (z * t)) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y / a) * x) - ((t / a) * z) tmp = 0 if z < -2.468684968699548e+170: tmp = t_1 elif z < 6.309831121978371e-71: tmp = ((x * y) - (z * t)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z)) tmp = 0.0 if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y / a) * x) - ((t / a) * z); tmp = 0.0; if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = ((x * y) - (z * t)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024095
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))
(/ (- (* x y) (* z t)) a))