
(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 10 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 1 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.2e+118)
(/ (fma x y (* z (- t))) a_m)
(- (/ (* y (/ x (sqrt a_m))) (sqrt a_m)) (* t (/ 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 (a_m <= 2.2e+118) {
tmp = fma(x, y, (z * -t)) / a_m;
} else {
tmp = ((y * (x / sqrt(a_m))) / sqrt(a_m)) - (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]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (a_m <= 2.2e+118) tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a_m); else tmp = Float64(Float64(Float64(y * Float64(x / sqrt(a_m))) / sqrt(a_m)) - Float64(t * Float64(z / 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[a$95$m, 2.2e+118], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(N[(y * N[(x / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[a$95$m], $MachinePrecision]), $MachinePrecision] - N[(t * 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}\;a\_m \leq 2.2 \cdot 10^{+118}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \frac{x}{\sqrt{a\_m}}}{\sqrt{a\_m}} - t \cdot \frac{z}{a\_m}\\
\end{array}
\end{array}
if a < 2.19999999999999986e118Initial program 92.2%
div-sub89.4%
*-commutative89.4%
div-sub92.2%
*-commutative92.2%
fma-neg92.6%
distribute-rgt-neg-out92.6%
Simplified92.6%
if 2.19999999999999986e118 < a Initial program 65.4%
div-sub65.4%
*-un-lft-identity65.4%
add-sqr-sqrt65.2%
times-frac65.3%
fma-neg65.3%
associate-/l*85.9%
Applied egg-rr85.9%
fma-undefine85.9%
distribute-lft-neg-in85.9%
cancel-sign-sub-inv85.9%
associate-*r/65.3%
*-commutative65.3%
associate-/l*83.5%
associate-*l/83.5%
*-lft-identity83.5%
*-commutative83.5%
associate-/l*87.9%
Simplified87.9%
Final simplification91.9%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 5e+39)
(/ (fma x y (* z (- t))) 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);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (a_m <= 5e+39) {
tmp = fma(x, y, (z * -t)) / 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]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (a_m <= 5e+39) tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / 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.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[a$95$m, 5e+39], N[(N[(x * y + N[(z * (-t)), $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])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 5 \cdot 10^{+39}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m} - \frac{z}{\frac{a\_m}{t}}\\
\end{array}
\end{array}
if a < 5.00000000000000015e39Initial program 92.4%
div-sub89.3%
*-commutative89.3%
div-sub92.4%
*-commutative92.4%
fma-neg92.9%
distribute-rgt-neg-out92.9%
Simplified92.9%
if 5.00000000000000015e39 < a Initial program 73.5%
div-sub73.5%
associate-/l*78.0%
associate-/l*92.0%
Applied egg-rr92.0%
clear-num91.9%
un-div-inv92.0%
Applied egg-rr92.0%
Final simplification92.7%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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
(let* ((t_1 (* t (/ z (- a_m)))) (t_2 (* x (/ y a_m))))
(*
a_s
(if (<= (* x y) -5e+140)
t_2
(if (<= (* x y) -5e+51)
t_1
(if (<= (* x y) -0.05)
(/ y (/ a_m x))
(if (<= (* x y) 1e+77) t_1 t_2)))))))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 t_1 = t * (z / -a_m);
double t_2 = x * (y / a_m);
double tmp;
if ((x * y) <= -5e+140) {
tmp = t_2;
} else if ((x * y) <= -5e+51) {
tmp = t_1;
} else if ((x * y) <= -0.05) {
tmp = y / (a_m / x);
} else if ((x * y) <= 1e+77) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t * (z / -a_m)
t_2 = x * (y / a_m)
if ((x * y) <= (-5d+140)) then
tmp = t_2
else if ((x * y) <= (-5d+51)) then
tmp = t_1
else if ((x * y) <= (-0.05d0)) then
tmp = y / (a_m / x)
else if ((x * y) <= 1d+77) then
tmp = t_1
else
tmp = t_2
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 t_1 = t * (z / -a_m);
double t_2 = x * (y / a_m);
double tmp;
if ((x * y) <= -5e+140) {
tmp = t_2;
} else if ((x * y) <= -5e+51) {
tmp = t_1;
} else if ((x * y) <= -0.05) {
tmp = y / (a_m / x);
} else if ((x * y) <= 1e+77) {
tmp = t_1;
} else {
tmp = t_2;
}
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): t_1 = t * (z / -a_m) t_2 = x * (y / a_m) tmp = 0 if (x * y) <= -5e+140: tmp = t_2 elif (x * y) <= -5e+51: tmp = t_1 elif (x * y) <= -0.05: tmp = y / (a_m / x) elif (x * y) <= 1e+77: tmp = t_1 else: tmp = t_2 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) t_1 = Float64(t * Float64(z / Float64(-a_m))) t_2 = Float64(x * Float64(y / a_m)) tmp = 0.0 if (Float64(x * y) <= -5e+140) tmp = t_2; elseif (Float64(x * y) <= -5e+51) tmp = t_1; elseif (Float64(x * y) <= -0.05) tmp = Float64(y / Float64(a_m / x)); elseif (Float64(x * y) <= 1e+77) tmp = t_1; else tmp = t_2; 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)
t_1 = t * (z / -a_m);
t_2 = x * (y / a_m);
tmp = 0.0;
if ((x * y) <= -5e+140)
tmp = t_2;
elseif ((x * y) <= -5e+51)
tmp = t_1;
elseif ((x * y) <= -0.05)
tmp = y / (a_m / x);
elseif ((x * y) <= 1e+77)
tmp = t_1;
else
tmp = t_2;
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_] := Block[{t$95$1 = N[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -5e+140], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -5e+51], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -0.05], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+77], t$95$1, t$95$2]]]]), $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])\\
\\
\begin{array}{l}
t_1 := t \cdot \frac{z}{-a\_m}\\
t_2 := x \cdot \frac{y}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+140}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq -0.05:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\
\mathbf{elif}\;x \cdot y \leq 10^{+77}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
\end{array}
if (*.f64 x y) < -5.00000000000000008e140 or 9.99999999999999983e76 < (*.f64 x y) Initial program 78.9%
Taylor expanded in x around inf 75.9%
associate-*r/89.0%
Simplified89.0%
if -5.00000000000000008e140 < (*.f64 x y) < -5e51 or -0.050000000000000003 < (*.f64 x y) < 9.99999999999999983e76Initial program 91.8%
Taylor expanded in x around 0 71.8%
mul-1-neg71.8%
associate-/l*76.7%
distribute-rgt-neg-in76.7%
distribute-neg-frac276.7%
Simplified76.7%
if -5e51 < (*.f64 x y) < -0.050000000000000003Initial program 99.6%
Taylor expanded in x around inf 70.9%
*-commutative70.9%
associate-*r/63.5%
Simplified63.5%
clear-num63.4%
div-inv65.8%
Applied egg-rr65.8%
Final simplification80.3%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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
(let* ((t_1 (* x (/ y a_m))))
(*
a_s
(if (<= (* x y) -5e+140)
t_1
(if (<= (* x y) -5e+51)
(* t (/ z (- a_m)))
(if (<= (* x y) -0.05)
(/ y (/ a_m x))
(if (<= (* x y) 1e+77) (* (/ t a_m) (- z)) t_1)))))))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 t_1 = x * (y / a_m);
double tmp;
if ((x * y) <= -5e+140) {
tmp = t_1;
} else if ((x * y) <= -5e+51) {
tmp = t * (z / -a_m);
} else if ((x * y) <= -0.05) {
tmp = y / (a_m / x);
} else if ((x * y) <= 1e+77) {
tmp = (t / a_m) * -z;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x * (y / a_m)
if ((x * y) <= (-5d+140)) then
tmp = t_1
else if ((x * y) <= (-5d+51)) then
tmp = t * (z / -a_m)
else if ((x * y) <= (-0.05d0)) then
tmp = y / (a_m / x)
else if ((x * y) <= 1d+77) then
tmp = (t / a_m) * -z
else
tmp = t_1
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 t_1 = x * (y / a_m);
double tmp;
if ((x * y) <= -5e+140) {
tmp = t_1;
} else if ((x * y) <= -5e+51) {
tmp = t * (z / -a_m);
} else if ((x * y) <= -0.05) {
tmp = y / (a_m / x);
} else if ((x * y) <= 1e+77) {
tmp = (t / a_m) * -z;
} else {
tmp = t_1;
}
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): t_1 = x * (y / a_m) tmp = 0 if (x * y) <= -5e+140: tmp = t_1 elif (x * y) <= -5e+51: tmp = t * (z / -a_m) elif (x * y) <= -0.05: tmp = y / (a_m / x) elif (x * y) <= 1e+77: tmp = (t / a_m) * -z else: tmp = t_1 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) t_1 = Float64(x * Float64(y / a_m)) tmp = 0.0 if (Float64(x * y) <= -5e+140) tmp = t_1; elseif (Float64(x * y) <= -5e+51) tmp = Float64(t * Float64(z / Float64(-a_m))); elseif (Float64(x * y) <= -0.05) tmp = Float64(y / Float64(a_m / x)); elseif (Float64(x * y) <= 1e+77) tmp = Float64(Float64(t / a_m) * Float64(-z)); else tmp = t_1; 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)
t_1 = x * (y / a_m);
tmp = 0.0;
if ((x * y) <= -5e+140)
tmp = t_1;
elseif ((x * y) <= -5e+51)
tmp = t * (z / -a_m);
elseif ((x * y) <= -0.05)
tmp = y / (a_m / x);
elseif ((x * y) <= 1e+77)
tmp = (t / a_m) * -z;
else
tmp = t_1;
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_] := Block[{t$95$1 = N[(x * N[(y / a$95$m), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(x * y), $MachinePrecision], -5e+140], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -5e+51], N[(t * N[(z / (-a$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -0.05], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+77], N[(N[(t / a$95$m), $MachinePrecision] * (-z)), $MachinePrecision], t$95$1]]]]), $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])\\
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{a\_m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+140}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+51}:\\
\;\;\;\;t \cdot \frac{z}{-a\_m}\\
\mathbf{elif}\;x \cdot y \leq -0.05:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\
\mathbf{elif}\;x \cdot y \leq 10^{+77}:\\
\;\;\;\;\frac{t}{a\_m} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if (*.f64 x y) < -5.00000000000000008e140 or 9.99999999999999983e76 < (*.f64 x y) Initial program 78.9%
Taylor expanded in x around inf 75.9%
associate-*r/89.0%
Simplified89.0%
if -5.00000000000000008e140 < (*.f64 x y) < -5e51Initial program 88.5%
Taylor expanded in x around 0 55.0%
mul-1-neg55.0%
associate-/l*71.4%
distribute-rgt-neg-in71.4%
distribute-neg-frac271.4%
Simplified71.4%
if -5e51 < (*.f64 x y) < -0.050000000000000003Initial program 99.6%
Taylor expanded in x around inf 70.9%
*-commutative70.9%
associate-*r/63.5%
Simplified63.5%
clear-num63.4%
div-inv65.8%
Applied egg-rr65.8%
if -0.050000000000000003 < (*.f64 x y) < 9.99999999999999983e76Initial program 92.2%
Taylor expanded in x around 0 73.9%
associate-*r/73.9%
mul-1-neg73.9%
distribute-rgt-neg-in73.9%
associate-*l/75.7%
Simplified75.7%
Final simplification79.4%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 (<= (* z t) -4e+278)
(* (/ t a_m) (- z))
(if (<= (* z t) 5e+260) (/ (- (* x y) (* z t)) a_m) (* t (/ 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 ((z * t) <= -4e+278) {
tmp = (t / a_m) * -z;
} else if ((z * t) <= 5e+260) {
tmp = ((x * y) - (z * t)) / a_m;
} else {
tmp = t * (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 ((z * t) <= (-4d+278)) then
tmp = (t / a_m) * -z
else if ((z * t) <= 5d+260) then
tmp = ((x * y) - (z * t)) / a_m
else
tmp = t * (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 ((z * t) <= -4e+278) {
tmp = (t / a_m) * -z;
} else if ((z * t) <= 5e+260) {
tmp = ((x * y) - (z * t)) / a_m;
} else {
tmp = 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]) def code(a_s, x, y, z, t, a_m): tmp = 0 if (z * t) <= -4e+278: tmp = (t / a_m) * -z elif (z * t) <= 5e+260: tmp = ((x * y) - (z * t)) / a_m else: tmp = 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]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (Float64(z * t) <= -4e+278) tmp = Float64(Float64(t / a_m) * Float64(-z)); elseif (Float64(z * t) <= 5e+260) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a_m); else tmp = Float64(t * Float64(z / Float64(-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 ((z * t) <= -4e+278)
tmp = (t / a_m) * -z;
elseif ((z * t) <= 5e+260)
tmp = ((x * y) - (z * t)) / a_m;
else
tmp = 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.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[N[(z * t), $MachinePrecision], -4e+278], N[(N[(t / a$95$m), $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+260], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(t * N[(z / (-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}\;z \cdot t \leq -4 \cdot 10^{+278}:\\
\;\;\;\;\frac{t}{a\_m} \cdot \left(-z\right)\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+260}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{z}{-a\_m}\\
\end{array}
\end{array}
if (*.f64 z t) < -3.99999999999999985e278Initial program 63.6%
Taylor expanded in x around 0 63.6%
associate-*r/63.6%
mul-1-neg63.6%
distribute-rgt-neg-in63.6%
associate-*l/95.0%
Simplified95.0%
if -3.99999999999999985e278 < (*.f64 z t) < 4.9999999999999996e260Initial program 93.9%
if 4.9999999999999996e260 < (*.f64 z t) Initial program 54.2%
Taylor expanded in x around 0 58.6%
mul-1-neg58.6%
associate-/l*94.1%
distribute-rgt-neg-in94.1%
distribute-neg-frac294.1%
Simplified94.1%
Final simplification94.0%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 9.5e+39)
(/ (- (* x y) (* z t)) 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);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (a_m <= 9.5e+39) {
tmp = ((x * y) - (z * t)) / 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.
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 <= 9.5d+39) then
tmp = ((x * y) - (z * t)) / 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;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (a_m <= 9.5e+39) {
tmp = ((x * y) - (z * t)) / 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]) def code(a_s, x, y, z, t, a_m): tmp = 0 if a_m <= 9.5e+39: tmp = ((x * y) - (z * t)) / 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]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (a_m <= 9.5e+39) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / 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])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if (a_m <= 9.5e+39)
tmp = ((x * y) - (z * t)) / 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.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[a$95$m, 9.5e+39], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $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])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 9.5 \cdot 10^{+39}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m} - z \cdot \frac{t}{a\_m}\\
\end{array}
\end{array}
if a < 9.50000000000000011e39Initial program 92.4%
if 9.50000000000000011e39 < a Initial program 73.5%
div-sub73.5%
associate-/l*78.0%
associate-/l*92.0%
Applied egg-rr92.0%
Final simplification92.3%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 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 5e+39)
(/ (- (* x y) (* z t)) 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);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (a_m <= 5e+39) {
tmp = ((x * y) - (z * t)) / 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.
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 <= 5d+39) then
tmp = ((x * y) - (z * t)) / 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;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (a_m <= 5e+39) {
tmp = ((x * y) - (z * t)) / 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]) def code(a_s, x, y, z, t, a_m): tmp = 0 if a_m <= 5e+39: tmp = ((x * y) - (z * t)) / 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]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (a_m <= 5e+39) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / 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])){:}
function tmp_2 = code(a_s, x, y, z, t, a_m)
tmp = 0.0;
if (a_m <= 5e+39)
tmp = ((x * y) - (z * t)) / 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.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[a$95$m, 5e+39], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $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])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;a\_m \leq 5 \cdot 10^{+39}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m} - \frac{z}{\frac{a\_m}{t}}\\
\end{array}
\end{array}
if a < 5.00000000000000015e39Initial program 92.4%
if 5.00000000000000015e39 < a Initial program 73.5%
div-sub73.5%
associate-/l*78.0%
associate-/l*92.0%
Applied egg-rr92.0%
clear-num91.9%
un-div-inv92.0%
Applied egg-rr92.0%
Final simplification92.3%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 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.1e-198) (* y (/ x 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);
double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (t <= 1.1e-198) {
tmp = y * (x / 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.
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.1d-198) then
tmp = y * (x / 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;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (t <= 1.1e-198) {
tmp = y * (x / 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]) def code(a_s, x, y, z, t, a_m): tmp = 0 if t <= 1.1e-198: tmp = y * (x / 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]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (t <= 1.1e-198) tmp = Float64(y * Float64(x / a_m)); else tmp = 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 (t <= 1.1e-198)
tmp = y * (x / 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.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[t, 1.1e-198], N[(y * N[(x / a$95$m), $MachinePrecision]), $MachinePrecision], 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])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq 1.1 \cdot 10^{-198}:\\
\;\;\;\;y \cdot \frac{x}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\
\end{array}
\end{array}
if t < 1.1e-198Initial program 90.2%
Taylor expanded in x around inf 49.0%
*-commutative49.0%
associate-*r/49.6%
Simplified49.6%
if 1.1e-198 < t Initial program 84.6%
Taylor expanded in x around inf 42.7%
associate-*r/47.1%
Simplified47.1%
Final simplification48.5%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 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 7.6e-193) (/ y (/ a_m x)) (* 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 (t <= 7.6e-193) {
tmp = y / (a_m / x);
} 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.
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 <= 7.6d-193) then
tmp = y / (a_m / x)
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;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if (t <= 7.6e-193) {
tmp = y / (a_m / x);
} 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]) def code(a_s, x, y, z, t, a_m): tmp = 0 if t <= 7.6e-193: tmp = y / (a_m / x) 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]) function code(a_s, x, y, z, t, a_m) tmp = 0.0 if (t <= 7.6e-193) tmp = Float64(y / Float64(a_m / x)); else tmp = 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 (t <= 7.6e-193)
tmp = y / (a_m / x);
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.
code[a$95$s_, x_, y_, z_, t_, a$95$m_] := N[(a$95$s * If[LessEqual[t, 7.6e-193], N[(y / N[(a$95$m / x), $MachinePrecision]), $MachinePrecision], 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])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq 7.6 \cdot 10^{-193}:\\
\;\;\;\;\frac{y}{\frac{a\_m}{x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a\_m}\\
\end{array}
\end{array}
if t < 7.60000000000000007e-193Initial program 90.2%
Taylor expanded in x around inf 49.0%
*-commutative49.0%
associate-*r/49.6%
Simplified49.6%
clear-num49.5%
div-inv49.8%
Applied egg-rr49.8%
if 7.60000000000000007e-193 < t Initial program 84.6%
Taylor expanded in x around inf 42.7%
associate-*r/47.1%
Simplified47.1%
Final simplification48.7%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 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 (* 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) {
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.
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;
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]) 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]) 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])){:}
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.
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])\\
\\
a\_s \cdot \left(x \cdot \frac{y}{a\_m}\right)
\end{array}
Initial program 87.9%
Taylor expanded in x around inf 46.3%
associate-*r/49.9%
Simplified49.9%
Final simplification49.9%
(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 2024044
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:herbie-target
(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))