
(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 9 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}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (* x y) (* z t)))) (if (<= t_1 1e+283) (/ t_1 a) (* y (- (/ x a) (* t (/ z (* y a))))))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= 1e+283) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - (t * (z / (y * a))));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) - (z * t)
if (t_1 <= 1d+283) then
tmp = t_1 / a
else
tmp = y * ((x / a) - (t * (z / (y * a))))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= 1e+283) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - (t * (z / (y * a))));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= 1e+283: tmp = t_1 / a else: tmp = y * ((x / a) - (t * (z / (y * a)))) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= 1e+283) tmp = Float64(t_1 / a); else tmp = Float64(y * Float64(Float64(x / a) - Float64(t * Float64(z / Float64(y * a))))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= 1e+283)
tmp = t_1 / a;
else
tmp = y * ((x / a) - (t * (z / (y * a))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+283], N[(t$95$1 / a), $MachinePrecision], N[(y * N[(N[(x / a), $MachinePrecision] - N[(t * N[(z / N[(y * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq 10^{+283}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - t \cdot \frac{z}{y \cdot a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < 9.99999999999999955e282Initial program 97.7%
if 9.99999999999999955e282 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 69.0%
Taylor expanded in x around inf
lower-*.f6435.3
Applied rewrites35.3%
Taylor expanded in y around inf
lower-*.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6496.1
Applied rewrites96.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* x y) a)))
(if (<= (* x y) -5e-86)
t_1
(if (<= (* x y) 2e-31)
(/ (* z (- t)) a)
(if (<= (* x y) 5e+43)
t_1
(if (<= (* x y) 5e+111) (* t (/ z (- a))) (* x (* y (/ 1.0 a)))))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -5e-86) {
tmp = t_1;
} else if ((x * y) <= 2e-31) {
tmp = (z * -t) / a;
} else if ((x * y) <= 5e+43) {
tmp = t_1;
} else if ((x * y) <= 5e+111) {
tmp = t * (z / -a);
} else {
tmp = x * (y * (1.0 / a));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) / a
if ((x * y) <= (-5d-86)) then
tmp = t_1
else if ((x * y) <= 2d-31) then
tmp = (z * -t) / a
else if ((x * y) <= 5d+43) then
tmp = t_1
else if ((x * y) <= 5d+111) then
tmp = t * (z / -a)
else
tmp = x * (y * (1.0d0 / a))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -5e-86) {
tmp = t_1;
} else if ((x * y) <= 2e-31) {
tmp = (z * -t) / a;
} else if ((x * y) <= 5e+43) {
tmp = t_1;
} else if ((x * y) <= 5e+111) {
tmp = t * (z / -a);
} else {
tmp = x * (y * (1.0 / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) / a tmp = 0 if (x * y) <= -5e-86: tmp = t_1 elif (x * y) <= 2e-31: tmp = (z * -t) / a elif (x * y) <= 5e+43: tmp = t_1 elif (x * y) <= 5e+111: tmp = t * (z / -a) else: tmp = x * (y * (1.0 / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / a) tmp = 0.0 if (Float64(x * y) <= -5e-86) tmp = t_1; elseif (Float64(x * y) <= 2e-31) tmp = Float64(Float64(z * Float64(-t)) / a); elseif (Float64(x * y) <= 5e+43) tmp = t_1; elseif (Float64(x * y) <= 5e+111) tmp = Float64(t * Float64(z / Float64(-a))); else tmp = Float64(x * Float64(y * Float64(1.0 / a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) / a;
tmp = 0.0;
if ((x * y) <= -5e-86)
tmp = t_1;
elseif ((x * y) <= 2e-31)
tmp = (z * -t) / a;
elseif ((x * y) <= 5e+43)
tmp = t_1;
elseif ((x * y) <= 5e+111)
tmp = t * (z / -a);
else
tmp = x * (y * (1.0 / a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e-86], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e-31], N[(N[(z * (-t)), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+43], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e+111], N[(t * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{a}\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-31}:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+111}:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{1}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -4.9999999999999999e-86 or 2e-31 < (*.f64 x y) < 5.0000000000000004e43Initial program 95.7%
Taylor expanded in x around inf
lower-*.f6473.0
Applied rewrites73.0%
if -4.9999999999999999e-86 < (*.f64 x y) < 2e-31Initial program 97.9%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6487.0
Applied rewrites87.0%
if 5.0000000000000004e43 < (*.f64 x y) < 4.9999999999999997e111Initial program 85.2%
Taylor expanded in x around inf
lower-*.f6432.3
Applied rewrites32.3%
Taylor expanded in x around 0
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6475.8
Applied rewrites75.8%
Applied rewrites70.5%
if 4.9999999999999997e111 < (*.f64 x y) Initial program 87.5%
Taylor expanded in x around inf
lower-*.f6476.3
Applied rewrites76.3%
Taylor expanded in x around 0
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6419.4
Applied rewrites19.4%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6482.3
Applied rewrites82.3%
Applied rewrites82.3%
Final simplification80.4%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* x y) a)))
(if (<= (* x y) -5e-86)
t_1
(if (<= (* x y) 2e-31)
(/ (* z (- t)) a)
(if (<= (* x y) 5e+43)
t_1
(if (<= (* x y) 5e+111) (* t (/ z (- a))) (* x (/ y a))))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -5e-86) {
tmp = t_1;
} else if ((x * y) <= 2e-31) {
tmp = (z * -t) / a;
} else if ((x * y) <= 5e+43) {
tmp = t_1;
} else if ((x * y) <= 5e+111) {
tmp = t * (z / -a);
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) / a
if ((x * y) <= (-5d-86)) then
tmp = t_1
else if ((x * y) <= 2d-31) then
tmp = (z * -t) / a
else if ((x * y) <= 5d+43) then
tmp = t_1
else if ((x * y) <= 5d+111) then
tmp = t * (z / -a)
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -5e-86) {
tmp = t_1;
} else if ((x * y) <= 2e-31) {
tmp = (z * -t) / a;
} else if ((x * y) <= 5e+43) {
tmp = t_1;
} else if ((x * y) <= 5e+111) {
tmp = t * (z / -a);
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) / a tmp = 0 if (x * y) <= -5e-86: tmp = t_1 elif (x * y) <= 2e-31: tmp = (z * -t) / a elif (x * y) <= 5e+43: tmp = t_1 elif (x * y) <= 5e+111: tmp = t * (z / -a) else: tmp = x * (y / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / a) tmp = 0.0 if (Float64(x * y) <= -5e-86) tmp = t_1; elseif (Float64(x * y) <= 2e-31) tmp = Float64(Float64(z * Float64(-t)) / a); elseif (Float64(x * y) <= 5e+43) tmp = t_1; elseif (Float64(x * y) <= 5e+111) tmp = Float64(t * Float64(z / Float64(-a))); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) / a;
tmp = 0.0;
if ((x * y) <= -5e-86)
tmp = t_1;
elseif ((x * y) <= 2e-31)
tmp = (z * -t) / a;
elseif ((x * y) <= 5e+43)
tmp = t_1;
elseif ((x * y) <= 5e+111)
tmp = t * (z / -a);
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e-86], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e-31], N[(N[(z * (-t)), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+43], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e+111], N[(t * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{a}\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-31}:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+111}:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.9999999999999999e-86 or 2e-31 < (*.f64 x y) < 5.0000000000000004e43Initial program 95.7%
Taylor expanded in x around inf
lower-*.f6473.0
Applied rewrites73.0%
if -4.9999999999999999e-86 < (*.f64 x y) < 2e-31Initial program 97.9%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6487.0
Applied rewrites87.0%
if 5.0000000000000004e43 < (*.f64 x y) < 4.9999999999999997e111Initial program 85.2%
Taylor expanded in x around inf
lower-*.f6432.3
Applied rewrites32.3%
Taylor expanded in x around 0
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6475.8
Applied rewrites75.8%
Applied rewrites70.5%
if 4.9999999999999997e111 < (*.f64 x y) Initial program 87.5%
Taylor expanded in x around inf
lower-*.f6476.3
Applied rewrites76.3%
Taylor expanded in x around 0
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6419.4
Applied rewrites19.4%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6482.3
Applied rewrites82.3%
Final simplification80.4%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (* x y) (* z t)))) (if (<= t_1 5e+262) (/ t_1 a) (fma (/ y a) x (* t (/ z (- a)))))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= 5e+262) {
tmp = t_1 / a;
} else {
tmp = fma((y / a), x, (t * (z / -a)));
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= 5e+262) tmp = Float64(t_1 / a); else tmp = fma(Float64(y / a), x, Float64(t * Float64(z / Float64(-a)))); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+262], N[(t$95$1 / a), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * x + N[(t * N[(z / (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+262}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, x, t \cdot \frac{z}{-a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < 5.00000000000000008e262Initial program 97.6%
if 5.00000000000000008e262 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 74.6%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6485.6
Applied rewrites85.6%
lift-neg.f64N/A
lift-/.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.7
Applied rewrites96.7%
Final simplification97.5%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (/ (- (* x y) (* z t)) a) 1e+268) (/ (* x y) a) (* y (/ x a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((((x * y) - (z * t)) / a) <= 1e+268) {
tmp = (x * y) / a;
} else {
tmp = y * (x / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((((x * y) - (z * t)) / a) <= 1d+268) then
tmp = (x * y) / a
else
tmp = y * (x / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((((x * y) - (z * t)) / a) <= 1e+268) {
tmp = (x * y) / a;
} else {
tmp = y * (x / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (((x * y) - (z * t)) / a) <= 1e+268: tmp = (x * y) / a else: tmp = y * (x / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(Float64(x * y) - Float64(z * t)) / a) <= 1e+268) tmp = Float64(Float64(x * y) / a); else tmp = Float64(y * Float64(x / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((((x * y) - (z * t)) / a) <= 1e+268)
tmp = (x * y) / a;
else
tmp = y * (x / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], 1e+268], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot y - z \cdot t}{a} \leq 10^{+268}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 9.9999999999999997e267Initial program 95.9%
Taylor expanded in x around inf
lower-*.f6453.5
Applied rewrites53.5%
if 9.9999999999999997e267 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) Initial program 87.4%
Taylor expanded in x around inf
lower-*.f6444.5
Applied rewrites44.5%
Taylor expanded in x around 0
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6457.6
Applied rewrites57.6%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6449.9
Applied rewrites49.9%
Applied rewrites52.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* z t) -1e-103) (* t (/ z (- a))) (if (<= (* z t) 5e+101) (/ (* x y) a) (* z (/ t (- a))))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -1e-103) {
tmp = t * (z / -a);
} else if ((z * t) <= 5e+101) {
tmp = (x * y) / a;
} else {
tmp = z * (t / -a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z * t) <= (-1d-103)) then
tmp = t * (z / -a)
else if ((z * t) <= 5d+101) then
tmp = (x * y) / a
else
tmp = z * (t / -a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -1e-103) {
tmp = t * (z / -a);
} else if ((z * t) <= 5e+101) {
tmp = (x * y) / a;
} else {
tmp = z * (t / -a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= -1e-103: tmp = t * (z / -a) elif (z * t) <= 5e+101: tmp = (x * y) / a else: tmp = z * (t / -a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= -1e-103) tmp = Float64(t * Float64(z / Float64(-a))); elseif (Float64(z * t) <= 5e+101) tmp = Float64(Float64(x * y) / a); else tmp = Float64(z * Float64(t / Float64(-a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z * t) <= -1e-103)
tmp = t * (z / -a);
elseif ((z * t) <= 5e+101)
tmp = (x * y) / a;
else
tmp = z * (t / -a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e-103], N[(t * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+101], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], N[(z * N[(t / (-a)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{-103}:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+101}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{t}{-a}\\
\end{array}
\end{array}
if (*.f64 z t) < -9.99999999999999958e-104Initial program 93.7%
Taylor expanded in x around inf
lower-*.f6427.8
Applied rewrites27.8%
Taylor expanded in x around 0
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6473.9
Applied rewrites73.9%
Applied rewrites68.0%
if -9.99999999999999958e-104 < (*.f64 z t) < 4.99999999999999989e101Initial program 96.2%
Taylor expanded in x around inf
lower-*.f6476.0
Applied rewrites76.0%
if 4.99999999999999989e101 < (*.f64 z t) Initial program 91.4%
Taylor expanded in x around inf
lower-*.f6420.5
Applied rewrites20.5%
Taylor expanded in x around 0
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6484.4
Applied rewrites84.4%
Final simplification75.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (let* ((t_1 (* z (/ t (- a))))) (if (<= (* z t) -1e-103) t_1 (if (<= (* z t) 5e+101) (/ (* x y) a) t_1))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (t / -a);
double tmp;
if ((z * t) <= -1e-103) {
tmp = t_1;
} else if ((z * t) <= 5e+101) {
tmp = (x * y) / a;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = z * (t / -a)
if ((z * t) <= (-1d-103)) then
tmp = t_1
else if ((z * t) <= 5d+101) then
tmp = (x * y) / a
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = z * (t / -a);
double tmp;
if ((z * t) <= -1e-103) {
tmp = t_1;
} else if ((z * t) <= 5e+101) {
tmp = (x * y) / a;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = z * (t / -a) tmp = 0 if (z * t) <= -1e-103: tmp = t_1 elif (z * t) <= 5e+101: tmp = (x * y) / a else: tmp = t_1 return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(z * Float64(t / Float64(-a))) tmp = 0.0 if (Float64(z * t) <= -1e-103) tmp = t_1; elseif (Float64(z * t) <= 5e+101) tmp = Float64(Float64(x * y) / a); else tmp = t_1; end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = z * (t / -a);
tmp = 0.0;
if ((z * t) <= -1e-103)
tmp = t_1;
elseif ((z * t) <= 5e+101)
tmp = (x * y) / a;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(t / (-a)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e-103], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e+101], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := z \cdot \frac{t}{-a}\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{-103}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+101}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -9.99999999999999958e-104 or 4.99999999999999989e101 < (*.f64 z t) Initial program 92.9%
Taylor expanded in x around inf
lower-*.f6425.1
Applied rewrites25.1%
Taylor expanded in x around 0
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6477.7
Applied rewrites77.7%
if -9.99999999999999958e-104 < (*.f64 z t) < 4.99999999999999989e101Initial program 96.2%
Taylor expanded in x around inf
lower-*.f6476.0
Applied rewrites76.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) 4e+303) (/ (- (* x y) (* z t)) a) (* x (* y (/ 1.0 a)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 4e+303) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x * (y * (1.0 / a));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= 4d+303) then
tmp = ((x * y) - (z * t)) / a
else
tmp = x * (y * (1.0d0 / a))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 4e+303) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x * (y * (1.0 / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= 4e+303: tmp = ((x * y) - (z * t)) / a else: tmp = x * (y * (1.0 / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= 4e+303) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(x * Float64(y * Float64(1.0 / a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= 4e+303)
tmp = ((x * y) - (z * t)) / a;
else
tmp = x * (y * (1.0 / a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], 4e+303], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y * N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 4 \cdot 10^{+303}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{1}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < 4e303Initial program 96.3%
if 4e303 < (*.f64 x y) Initial program 57.7%
Taylor expanded in x around inf
lower-*.f6457.7
Applied rewrites57.7%
Taylor expanded in x around 0
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6410.3
Applied rewrites10.3%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Applied rewrites99.9%
Final simplification96.5%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* x (/ y a)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x * (y / a)
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return x * (y / a)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = x * (y / a);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 94.7%
Taylor expanded in x around inf
lower-*.f6452.2
Applied rewrites52.2%
Taylor expanded in x around 0
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6452.3
Applied rewrites52.3%
Taylor expanded in x around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6451.5
Applied rewrites51.5%
(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 2024238
(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))