
(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.
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 (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+257)))
(- (* x (/ y a)) (* z (/ t a)))
(/ t_1 a))))assert(x < y && y < z && z < t && t < 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 <= -((double) INFINITY)) || !(t_1 <= 1e+257)) {
tmp = (x * (y / a)) - (z * (t / a));
} else {
tmp = t_1 / a;
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
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 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 1e+257)) {
tmp = (x * (y / a)) - (z * (t / a));
} else {
tmp = t_1 / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [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 <= -math.inf) or not (t_1 <= 1e+257): tmp = (x * (y / a)) - (z * (t / a)) else: tmp = t_1 / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) 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 <= Float64(-Inf)) || !(t_1 <= 1e+257)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); else tmp = Float64(t_1 / a); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
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 <= -Inf) || ~((t_1 <= 1e+257)))
tmp = (x * (y / a)) - (z * (t / a));
else
tmp = t_1 / a;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+257]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[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 -\infty \lor \neg \left(t_1 \leq 10^{+257}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 1.00000000000000003e257 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 78.6%
Taylor expanded in x around 0 78.6%
fma-def78.6%
associate-/l*89.7%
associate-*l/96.9%
Simplified96.9%
fma-udef96.9%
associate-/r/96.9%
+-commutative96.9%
clear-num96.9%
associate-/r/96.9%
clear-num96.9%
associate-/r/96.9%
neg-mul-196.9%
sub-neg96.9%
clear-num96.9%
associate-/r/96.9%
clear-num96.9%
*-commutative96.9%
div-inv96.9%
clear-num96.9%
Applied egg-rr96.9%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000003e257Initial program 99.1%
Final simplification98.6%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. 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) -0.04) (/ y (/ a x)) (if (<= (* x y) 2e+26) (/ (- t) (/ a z)) (/ (* x y) a))))
assert(x < y && y < z && z < t && 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 ((x * y) <= -0.04) {
tmp = y / (a / x);
} else if ((x * y) <= 2e+26) {
tmp = -t / (a / z);
} else {
tmp = (x * y) / a;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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) <= (-0.04d0)) then
tmp = y / (a / x)
else if ((x * y) <= 2d+26) then
tmp = -t / (a / z)
else
tmp = (x * y) / a
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
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) <= -0.04) {
tmp = y / (a / x);
} else if ((x * y) <= 2e+26) {
tmp = -t / (a / z);
} else {
tmp = (x * y) / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -0.04: tmp = y / (a / x) elif (x * y) <= 2e+26: tmp = -t / (a / z) else: tmp = (x * y) / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) 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) <= -0.04) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= 2e+26) tmp = Float64(Float64(-t) / Float64(a / z)); else tmp = Float64(Float64(x * y) / a); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
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) <= -0.04)
tmp = y / (a / x);
elseif ((x * y) <= 2e+26)
tmp = -t / (a / z);
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. 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], -0.04], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+26], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -0.04:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+26}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -0.0400000000000000008Initial program 90.8%
Taylor expanded in x around inf 74.3%
associate-*l/75.7%
Simplified75.7%
associate-/r/78.1%
Applied egg-rr78.1%
Taylor expanded in x around 0 74.3%
*-commutative74.3%
associate-/l*76.3%
Simplified76.3%
if -0.0400000000000000008 < (*.f64 x y) < 2.0000000000000001e26Initial program 93.6%
Taylor expanded in x around 0 74.6%
mul-1-neg74.6%
associate-/l*74.7%
Simplified74.7%
if 2.0000000000000001e26 < (*.f64 x y) Initial program 98.0%
Taylor expanded in x around inf 88.0%
Final simplification78.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. 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) -0.04) (/ y (/ a x)) (if (<= (* x y) 2e+26) (* z (/ (- t) a)) (/ (* x y) a))))
assert(x < y && y < z && z < t && 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 ((x * y) <= -0.04) {
tmp = y / (a / x);
} else if ((x * y) <= 2e+26) {
tmp = z * (-t / 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.
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) <= (-0.04d0)) then
tmp = y / (a / x)
else if ((x * y) <= 2d+26) then
tmp = z * (-t / a)
else
tmp = (x * y) / a
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
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) <= -0.04) {
tmp = y / (a / x);
} else if ((x * y) <= 2e+26) {
tmp = z * (-t / a);
} else {
tmp = (x * y) / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -0.04: tmp = y / (a / x) elif (x * y) <= 2e+26: tmp = z * (-t / a) else: tmp = (x * y) / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) 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) <= -0.04) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= 2e+26) tmp = Float64(z * Float64(Float64(-t) / a)); else tmp = Float64(Float64(x * y) / a); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
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) <= -0.04)
tmp = y / (a / x);
elseif ((x * y) <= 2e+26)
tmp = z * (-t / 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. 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], -0.04], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+26], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -0.04:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+26}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -0.0400000000000000008Initial program 90.8%
Taylor expanded in x around inf 74.3%
associate-*l/75.7%
Simplified75.7%
associate-/r/78.1%
Applied egg-rr78.1%
Taylor expanded in x around 0 74.3%
*-commutative74.3%
associate-/l*76.3%
Simplified76.3%
if -0.0400000000000000008 < (*.f64 x y) < 2.0000000000000001e26Initial program 93.6%
Taylor expanded in x around 0 93.6%
fma-def93.6%
associate-/l*93.5%
associate-*l/89.5%
Simplified89.5%
fma-udef89.5%
associate-/r/92.6%
+-commutative92.6%
clear-num92.5%
associate-/r/92.6%
clear-num92.6%
associate-/r/90.3%
neg-mul-190.3%
sub-neg90.3%
clear-num90.3%
associate-/r/90.3%
clear-num90.7%
*-commutative90.7%
div-inv90.6%
clear-num91.2%
Applied egg-rr91.2%
associate-*r/93.2%
clear-num93.0%
Applied egg-rr93.0%
Taylor expanded in x around 0 74.6%
mul-1-neg74.6%
associate-*l/72.7%
*-commutative72.7%
distribute-rgt-neg-out72.7%
distribute-neg-frac72.7%
Simplified72.7%
if 2.0000000000000001e26 < (*.f64 x y) Initial program 98.0%
Taylor expanded in x around inf 88.0%
Final simplification77.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. 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) -0.04) (/ y (/ a x)) (if (<= (* x y) 1e-5) (/ (* z (- t)) a) (/ (* x y) a))))
assert(x < y && y < z && z < t && 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 ((x * y) <= -0.04) {
tmp = y / (a / x);
} else if ((x * y) <= 1e-5) {
tmp = (z * -t) / 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.
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) <= (-0.04d0)) then
tmp = y / (a / x)
else if ((x * y) <= 1d-5) then
tmp = (z * -t) / a
else
tmp = (x * y) / a
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
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) <= -0.04) {
tmp = y / (a / x);
} else if ((x * y) <= 1e-5) {
tmp = (z * -t) / a;
} else {
tmp = (x * y) / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -0.04: tmp = y / (a / x) elif (x * y) <= 1e-5: tmp = (z * -t) / a else: tmp = (x * y) / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) 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) <= -0.04) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= 1e-5) tmp = Float64(Float64(z * Float64(-t)) / a); else tmp = Float64(Float64(x * y) / a); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
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) <= -0.04)
tmp = y / (a / x);
elseif ((x * y) <= 1e-5)
tmp = (z * -t) / 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. 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], -0.04], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-5], N[(N[(z * (-t)), $MachinePrecision] / a), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -0.04:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq 10^{-5}:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -0.0400000000000000008Initial program 90.8%
Taylor expanded in x around inf 74.3%
associate-*l/75.7%
Simplified75.7%
associate-/r/78.1%
Applied egg-rr78.1%
Taylor expanded in x around 0 74.3%
*-commutative74.3%
associate-/l*76.3%
Simplified76.3%
if -0.0400000000000000008 < (*.f64 x y) < 1.00000000000000008e-5Initial program 94.1%
Taylor expanded in x around 0 76.6%
mul-1-neg76.6%
distribute-rgt-neg-in76.6%
Simplified76.6%
if 1.00000000000000008e-5 < (*.f64 x y) Initial program 96.7%
Taylor expanded in x around inf 84.5%
Final simplification78.5%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. 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) (- INFINITY)) (* z (/ (- t) a)) (/ (- (* x y) (* z t)) a)))
assert(x < y && y < z && z < t && 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) <= -((double) INFINITY)) {
tmp = z * (-t / a);
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
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) <= -Double.POSITIVE_INFINITY) {
tmp = z * (-t / a);
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= -math.inf: tmp = z * (-t / a) else: tmp = ((x * y) - (z * t)) / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) 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) <= Float64(-Inf)) tmp = Float64(z * Float64(Float64(-t) / a)); else tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
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) <= -Inf)
tmp = z * (-t / a);
else
tmp = ((x * y) - (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. 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], (-Infinity)], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 36.7%
Taylor expanded in x around 0 36.7%
fma-def36.7%
associate-/l*75.2%
associate-*l/83.2%
Simplified83.2%
fma-udef83.2%
associate-/r/83.2%
+-commutative83.2%
clear-num83.2%
associate-/r/83.1%
clear-num83.3%
associate-/r/83.2%
neg-mul-183.2%
sub-neg83.2%
clear-num83.2%
associate-/r/83.2%
clear-num83.2%
*-commutative83.2%
div-inv83.1%
clear-num83.2%
Applied egg-rr83.2%
associate-*r/36.7%
clear-num36.7%
Applied egg-rr36.7%
Taylor expanded in x around 0 45.0%
mul-1-neg45.0%
associate-*l/83.8%
*-commutative83.8%
distribute-rgt-neg-out83.8%
distribute-neg-frac83.8%
Simplified83.8%
if -inf.0 < (*.f64 z t) Initial program 96.6%
Final simplification96.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. 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 (<= y 1.18e+128) (* y (/ x a)) (* x (/ y a))))
assert(x < y && y < z && z < t && 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 (y <= 1.18e+128) {
tmp = y * (x / 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.
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 (y <= 1.18d+128) then
tmp = y * (x / a)
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
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 (y <= 1.18e+128) {
tmp = y * (x / a);
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if y <= 1.18e+128: tmp = y * (x / a) else: tmp = x * (y / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (y <= 1.18e+128) tmp = Float64(y * Float64(x / a)); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
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 (y <= 1.18e+128)
tmp = y * (x / 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. 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[y, 1.18e+128], N[(y * N[(x / 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])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.18 \cdot 10^{+128}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if y < 1.18000000000000009e128Initial program 93.6%
Taylor expanded in x around inf 54.0%
associate-*l/54.6%
Simplified54.6%
if 1.18000000000000009e128 < y Initial program 94.8%
Taylor expanded in x around inf 88.7%
associate-*r/91.4%
*-commutative91.4%
Applied egg-rr91.4%
Final simplification60.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. 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 (<= y 8.8e+129) (/ y (/ a x)) (* x (/ y a))))
assert(x < y && y < z && z < t && 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 (y <= 8.8e+129) {
tmp = y / (a / x);
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 (y <= 8.8d+129) then
tmp = y / (a / x)
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
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 (y <= 8.8e+129) {
tmp = y / (a / x);
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if y <= 8.8e+129: tmp = y / (a / x) else: tmp = x * (y / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (y <= 8.8e+129) tmp = Float64(y / Float64(a / x)); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
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 (y <= 8.8e+129)
tmp = y / (a / x);
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. 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[y, 8.8e+129], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.8 \cdot 10^{+129}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if y < 8.7999999999999997e129Initial program 93.6%
Taylor expanded in x around inf 54.0%
associate-*l/54.6%
Simplified54.6%
associate-/r/53.7%
Applied egg-rr53.7%
Taylor expanded in x around 0 54.0%
*-commutative54.0%
associate-/l*54.8%
Simplified54.8%
if 8.7999999999999997e129 < y Initial program 94.8%
Taylor expanded in x around inf 88.7%
associate-*r/91.4%
*-commutative91.4%
Applied egg-rr91.4%
Final simplification60.4%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. 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 -6.5e-220) (/ y (/ a x)) (/ (* x y) a)))
assert(x < y && y < z && z < t && 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 (x <= -6.5e-220) {
tmp = y / (a / x);
} else {
tmp = (x * y) / a;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 <= (-6.5d-220)) then
tmp = y / (a / x)
else
tmp = (x * y) / a
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
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 <= -6.5e-220) {
tmp = y / (a / x);
} else {
tmp = (x * y) / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if x <= -6.5e-220: tmp = y / (a / x) else: tmp = (x * y) / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (x <= -6.5e-220) tmp = Float64(y / Float64(a / x)); else tmp = Float64(Float64(x * y) / a); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
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 <= -6.5e-220)
tmp = y / (a / x);
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. 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[x, -6.5e-220], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-220}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if x < -6.50000000000000005e-220Initial program 93.2%
Taylor expanded in x around inf 65.0%
associate-*l/67.0%
Simplified67.0%
associate-/r/63.3%
Applied egg-rr63.3%
Taylor expanded in x around 0 65.0%
*-commutative65.0%
associate-/l*67.5%
Simplified67.5%
if -6.50000000000000005e-220 < x Initial program 94.2%
Taylor expanded in x around inf 55.6%
Final simplification60.3%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. 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 (* y (/ x a)))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 = y * (x / a)
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return y * (x / a)
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = y * (x / a);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 93.8%
Taylor expanded in x around inf 59.3%
associate-*l/58.7%
Simplified58.7%
Final simplification58.7%
(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 2024020
(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))