
(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 #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 1.8e-48)
(/ 1.0 (/ a_m (fma (- t) z (* x y))))
(fma (/ x a_m) y (* (/ (- 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 <= 1.8e-48) {
tmp = 1.0 / (a_m / fma(-t, z, (x * y)));
} else {
tmp = fma((x / a_m), y, ((-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 <= 1.8e-48) tmp = Float64(1.0 / Float64(a_m / fma(Float64(-t), z, Float64(x * y)))); else tmp = fma(Float64(x / a_m), y, Float64(Float64(Float64(-z) / 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, 1.8e-48], N[(1.0 / N[(a$95$m / N[((-t) * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / a$95$m), $MachinePrecision] * y + N[(N[((-z) / a$95$m), $MachinePrecision] * t), $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 1.8 \cdot 10^{-48}:\\
\;\;\;\;\frac{1}{\frac{a\_m}{\mathsf{fma}\left(-t, z, x \cdot y\right)}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{a\_m}, y, \frac{-z}{a\_m} \cdot t\right)\\
\end{array}
\end{array}
if a < 1.8000000000000001e-48Initial program 92.4%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6492.3
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f6492.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6492.9
Applied rewrites92.9%
if 1.8000000000000001e-48 < a Initial program 86.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6496.8
Applied rewrites96.8%
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
(let* ((t_1 (- (* x y) (* z t))))
(*
a_s
(if (<= t_1 (- INFINITY))
(fma x (/ y a_m) (* (/ (- t) a_m) z))
(if (<= t_1 2e+288)
(/ (fma (- z) t (* x y)) a_m)
(* (/ (- (* (/ x t) y) 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 t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(x, (y / a_m), ((-t / a_m) * z));
} else if (t_1 <= 2e+288) {
tmp = fma(-z, t, (x * y)) / a_m;
} else {
tmp = ((((x / t) * y) - 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) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(x, Float64(y / a_m), Float64(Float64(Float64(-t) / a_m) * z)); elseif (t_1 <= 2e+288) tmp = Float64(fma(Float64(-z), t, Float64(x * y)) / a_m); else tmp = Float64(Float64(Float64(Float64(Float64(x / t) * y) - z) / 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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(x * N[(y / a$95$m), $MachinePrecision] + N[(N[((-t) / a$95$m), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+288], N[(N[((-z) * t + N[(x * y), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(N[(N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] / a$95$m), $MachinePrecision] * t), $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])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{a\_m}, \frac{-t}{a\_m} \cdot z\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+288}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, t, x \cdot y\right)}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t} \cdot y - z}{a\_m} \cdot t\\
\end{array}
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 65.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f6465.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.0
Applied rewrites65.0%
lift-/.f64N/A
lift-fma.f64N/A
flip-+N/A
associate-/l/N/A
*-lft-identityN/A
frac-timesN/A
flip-+N/A
+-commutativeN/A
distribute-rgt-inN/A
div-invN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
div-invN/A
associate-*r/N/A
lift-/.f64N/A
Applied rewrites93.6%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 2e288Initial program 99.1%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.1
Applied rewrites99.1%
if 2e288 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 70.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6441.6
Applied rewrites41.6%
Taylor expanded in t around inf
+-commutativeN/A
distribute-rgt-inN/A
remove-double-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
mul-1-negN/A
distribute-lft-neg-outN/A
distribute-neg-inN/A
distribute-rgt-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites89.0%
Applied rewrites94.7%
Final simplification97.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 (<= (* x y) -4e-39)
(* (/ y a_m) x)
(if (<= (* x y) 2e-42) (/ (* (- z) t) a_m) (* (/ x a_m) 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) <= -4e-39) {
tmp = (y / a_m) * x;
} else if ((x * y) <= 2e-42) {
tmp = (-z * t) / a_m;
} else {
tmp = (x / a_m) * 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) <= (-4d-39)) then
tmp = (y / a_m) * x
else if ((x * y) <= 2d-42) then
tmp = (-z * t) / a_m
else
tmp = (x / a_m) * 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) <= -4e-39) {
tmp = (y / a_m) * x;
} else if ((x * y) <= 2e-42) {
tmp = (-z * t) / a_m;
} else {
tmp = (x / a_m) * 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) <= -4e-39: tmp = (y / a_m) * x elif (x * y) <= 2e-42: tmp = (-z * t) / a_m else: tmp = (x / a_m) * 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) <= -4e-39) tmp = Float64(Float64(y / a_m) * x); elseif (Float64(x * y) <= 2e-42) tmp = Float64(Float64(Float64(-z) * t) / a_m); else tmp = Float64(Float64(x / a_m) * 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) <= -4e-39)
tmp = (y / a_m) * x;
elseif ((x * y) <= 2e-42)
tmp = (-z * t) / a_m;
else
tmp = (x / a_m) * 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], -4e-39], N[(N[(y / a$95$m), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-42], N[(N[((-z) * t), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(x / a$95$m), $MachinePrecision] * y), $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 -4 \cdot 10^{-39}:\\
\;\;\;\;\frac{y}{a\_m} \cdot x\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-42}:\\
\;\;\;\;\frac{\left(-z\right) \cdot t}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a\_m} \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999972e-39Initial program 85.6%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6432.2
Applied rewrites32.2%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6473.7
Applied rewrites73.7%
if -3.99999999999999972e-39 < (*.f64 x y) < 2.00000000000000008e-42Initial program 96.4%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6483.8
Applied rewrites83.8%
if 2.00000000000000008e-42 < (*.f64 x y) Initial program 87.1%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6424.9
Applied rewrites24.9%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6464.7
Applied rewrites64.7%
Applied rewrites72.1%
Final simplification77.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.
(FPCore (a_s x y z t a_m)
:precision binary64
(*
a_s
(if (<= (* x y) -1e-31)
(* (/ y a_m) x)
(if (<= (* x y) 2e-42) (* (/ (- t) a_m) z) (* (/ x a_m) 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-31) {
tmp = (y / a_m) * x;
} else if ((x * y) <= 2e-42) {
tmp = (-t / a_m) * z;
} else {
tmp = (x / a_m) * 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-31)) then
tmp = (y / a_m) * x
else if ((x * y) <= 2d-42) then
tmp = (-t / a_m) * z
else
tmp = (x / a_m) * 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-31) {
tmp = (y / a_m) * x;
} else if ((x * y) <= 2e-42) {
tmp = (-t / a_m) * z;
} else {
tmp = (x / a_m) * 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-31: tmp = (y / a_m) * x elif (x * y) <= 2e-42: tmp = (-t / a_m) * z else: tmp = (x / a_m) * 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-31) tmp = Float64(Float64(y / a_m) * x); elseif (Float64(x * y) <= 2e-42) tmp = Float64(Float64(Float64(-t) / a_m) * z); else tmp = Float64(Float64(x / a_m) * 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-31)
tmp = (y / a_m) * x;
elseif ((x * y) <= 2e-42)
tmp = (-t / a_m) * z;
else
tmp = (x / a_m) * 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-31], N[(N[(y / a$95$m), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-42], N[(N[((-t) / a$95$m), $MachinePrecision] * z), $MachinePrecision], N[(N[(x / a$95$m), $MachinePrecision] * y), $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^{-31}:\\
\;\;\;\;\frac{y}{a\_m} \cdot x\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-42}:\\
\;\;\;\;\frac{-t}{a\_m} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a\_m} \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -1e-31Initial program 85.3%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6432.5
Applied rewrites32.5%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6474.6
Applied rewrites74.6%
if -1e-31 < (*.f64 x y) < 2.00000000000000008e-42Initial program 96.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6423.3
Applied rewrites23.3%
Taylor expanded in t around inf
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6478.3
Applied rewrites78.3%
if 2.00000000000000008e-42 < (*.f64 x y) Initial program 87.1%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6424.9
Applied rewrites24.9%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6464.7
Applied rewrites64.7%
Applied rewrites72.1%
Final simplification75.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) -4e-39)
(* (/ y a_m) x)
(if (<= (* x y) 2e-42) (* (/ (- z) a_m) t) (* (/ x a_m) 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) <= -4e-39) {
tmp = (y / a_m) * x;
} else if ((x * y) <= 2e-42) {
tmp = (-z / a_m) * t;
} else {
tmp = (x / a_m) * 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) <= (-4d-39)) then
tmp = (y / a_m) * x
else if ((x * y) <= 2d-42) then
tmp = (-z / a_m) * t
else
tmp = (x / a_m) * 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) <= -4e-39) {
tmp = (y / a_m) * x;
} else if ((x * y) <= 2e-42) {
tmp = (-z / a_m) * t;
} else {
tmp = (x / a_m) * 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) <= -4e-39: tmp = (y / a_m) * x elif (x * y) <= 2e-42: tmp = (-z / a_m) * t else: tmp = (x / a_m) * 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) <= -4e-39) tmp = Float64(Float64(y / a_m) * x); elseif (Float64(x * y) <= 2e-42) tmp = Float64(Float64(Float64(-z) / a_m) * t); else tmp = Float64(Float64(x / a_m) * 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) <= -4e-39)
tmp = (y / a_m) * x;
elseif ((x * y) <= 2e-42)
tmp = (-z / a_m) * t;
else
tmp = (x / a_m) * 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], -4e-39], N[(N[(y / a$95$m), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-42], N[(N[((-z) / a$95$m), $MachinePrecision] * t), $MachinePrecision], N[(N[(x / a$95$m), $MachinePrecision] * y), $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 -4 \cdot 10^{-39}:\\
\;\;\;\;\frac{y}{a\_m} \cdot x\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-42}:\\
\;\;\;\;\frac{-z}{a\_m} \cdot t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a\_m} \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999972e-39Initial program 85.6%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6432.2
Applied rewrites32.2%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6473.7
Applied rewrites73.7%
if -3.99999999999999972e-39 < (*.f64 x y) < 2.00000000000000008e-42Initial program 96.4%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6480.4
Applied rewrites80.4%
if 2.00000000000000008e-42 < (*.f64 x y) Initial program 87.1%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6424.9
Applied rewrites24.9%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6464.7
Applied rewrites64.7%
Applied rewrites72.1%
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) (- INFINITY))
(* (/ y a_m) x)
(/ (fma (- z) t (* 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) <= -((double) INFINITY)) {
tmp = (y / a_m) * x;
} else {
tmp = fma(-z, t, (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) <= Float64(-Inf)) tmp = Float64(Float64(y / a_m) * x); else tmp = Float64(fma(Float64(-z), t, Float64(x * 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[(x * y), $MachinePrecision], (-Infinity)], N[(N[(y / a$95$m), $MachinePrecision] * x), $MachinePrecision], N[(N[((-z) * t + N[(x * y), $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])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\frac{y}{a\_m} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, t, x \cdot y\right)}{a\_m}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 55.3%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6422.7
Applied rewrites22.7%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6494.7
Applied rewrites94.7%
if -inf.0 < (*.f64 x y) Initial program 93.7%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f6493.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.8
Applied rewrites93.8%
Final simplification93.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 (<= (* x y) (- INFINITY)) (* (/ y a_m) x) (/ (- (* x y) (* 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 * y) <= -((double) INFINITY)) {
tmp = (y / a_m) * x;
} else {
tmp = ((x * y) - (z * t)) / 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;
public static double code(double a_s, double x, double y, double z, double t, double a_m) {
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = (y / a_m) * x;
} else {
tmp = ((x * y) - (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 * y) <= -math.inf: tmp = (y / a_m) * x else: tmp = ((x * y) - (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 (Float64(x * y) <= Float64(-Inf)) tmp = Float64(Float64(y / a_m) * x); else tmp = Float64(Float64(Float64(x * y) - 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 * y) <= -Inf)
tmp = (y / a_m) * x;
else
tmp = ((x * y) - (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[N[(x * y), $MachinePrecision], (-Infinity)], N[(N[(y / a$95$m), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $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])\\
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\frac{y}{a\_m} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a\_m}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 55.3%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6422.7
Applied rewrites22.7%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6494.7
Applied rewrites94.7%
if -inf.0 < (*.f64 x y) Initial program 93.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. (FPCore (a_s x y z t a_m) :precision binary64 (* a_s (if (<= (- (* x y) (* z t)) 4e+67) (* (/ y a_m) x) (* (/ x a_m) 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) - (z * t)) <= 4e+67) {
tmp = (y / a_m) * x;
} else {
tmp = (x / a_m) * 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) - (z * t)) <= 4d+67) then
tmp = (y / a_m) * x
else
tmp = (x / a_m) * 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) - (z * t)) <= 4e+67) {
tmp = (y / a_m) * x;
} else {
tmp = (x / a_m) * 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) - (z * t)) <= 4e+67: tmp = (y / a_m) * x else: tmp = (x / a_m) * 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(Float64(x * y) - Float64(z * t)) <= 4e+67) tmp = Float64(Float64(y / a_m) * x); else tmp = Float64(Float64(x / a_m) * 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) - (z * t)) <= 4e+67)
tmp = (y / a_m) * x;
else
tmp = (x / a_m) * 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[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision], 4e+67], N[(N[(y / a$95$m), $MachinePrecision] * x), $MachinePrecision], N[(N[(x / a$95$m), $MachinePrecision] * y), $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 - z \cdot t \leq 4 \cdot 10^{+67}:\\
\;\;\;\;\frac{y}{a\_m} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a\_m} \cdot y\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < 3.99999999999999993e67Initial program 92.8%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6452.2
Applied rewrites52.2%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6447.5
Applied rewrites47.5%
if 3.99999999999999993e67 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 86.9%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6450.6
Applied rewrites50.6%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6448.3
Applied rewrites48.3%
Applied rewrites52.9%
Final simplification49.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 (<= a_m 4e-75) (/ (* x y) a_m) (* (/ x a_m) 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 (a_m <= 4e-75) {
tmp = (x * y) / a_m;
} else {
tmp = (x / a_m) * 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 (a_m <= 4d-75) then
tmp = (x * y) / a_m
else
tmp = (x / a_m) * 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 (a_m <= 4e-75) {
tmp = (x * y) / a_m;
} else {
tmp = (x / a_m) * 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 a_m <= 4e-75: tmp = (x * y) / a_m else: tmp = (x / a_m) * 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 (a_m <= 4e-75) tmp = Float64(Float64(x * y) / a_m); else tmp = Float64(Float64(x / a_m) * 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 (a_m <= 4e-75)
tmp = (x * y) / a_m;
else
tmp = (x / a_m) * 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[a$95$m, 4e-75], N[(N[(x * y), $MachinePrecision] / a$95$m), $MachinePrecision], N[(N[(x / a$95$m), $MachinePrecision] * y), $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 4 \cdot 10^{-75}:\\
\;\;\;\;\frac{x \cdot y}{a\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a\_m} \cdot y\\
\end{array}
\end{array}
if a < 3.9999999999999998e-75Initial program 92.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6451.2
Applied rewrites51.2%
if 3.9999999999999998e-75 < a Initial program 87.4%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6455.1
Applied rewrites55.1%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6443.0
Applied rewrites43.0%
Applied rewrites45.6%
Final simplification49.6%
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 (* (/ x a_m) 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) {
return a_s * ((x / a_m) * y);
}
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 / a_m) * y)
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 / a_m) * y);
}
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 / a_m) * y)
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(Float64(x / a_m) * y)) 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 / a_m) * y);
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[(N[(x / a$95$m), $MachinePrecision] * y), $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(\frac{x}{a\_m} \cdot y\right)
\end{array}
Initial program 90.9%
Taylor expanded in t around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6451.7
Applied rewrites51.7%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6447.8
Applied rewrites47.8%
Applied rewrites50.2%
Final simplification50.2%
(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 2024276
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(! :herbie-platform default (if (< z -246868496869954800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6309831121978371/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z)))))
(/ (- (* x y) (* z t)) a))