
(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 (<= t_1 -4e+306)
(- (* x (/ y a)) (* z (/ t a)))
(if (<= t_1 1e+194) (/ t_1 a) (- (/ x (/ a y)) (/ z (/ a t)))))))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 <= -4e+306) {
tmp = (x * (y / a)) - (z * (t / a));
} else if (t_1 <= 1e+194) {
tmp = t_1 / a;
} else {
tmp = (x / (a / y)) - (z / (a / t));
}
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) :: t_1
real(8) :: tmp
t_1 = (x * y) - (z * t)
if (t_1 <= (-4d+306)) then
tmp = (x * (y / a)) - (z * (t / a))
else if (t_1 <= 1d+194) then
tmp = t_1 / a
else
tmp = (x / (a / y)) - (z / (a / t))
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 t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -4e+306) {
tmp = (x * (y / a)) - (z * (t / a));
} else if (t_1 <= 1e+194) {
tmp = t_1 / a;
} else {
tmp = (x / (a / y)) - (z / (a / t));
}
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 <= -4e+306: tmp = (x * (y / a)) - (z * (t / a)) elif t_1 <= 1e+194: tmp = t_1 / a else: tmp = (x / (a / y)) - (z / (a / t)) 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 <= -4e+306) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); elseif (t_1 <= 1e+194) tmp = Float64(t_1 / a); else tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); 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 <= -4e+306)
tmp = (x * (y / a)) - (z * (t / a));
elseif (t_1 <= 1e+194)
tmp = t_1 / a;
else
tmp = (x / (a / y)) - (z / (a / t));
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[LessEqual[t$95$1, -4e+306], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+194], N[(t$95$1 / a), $MachinePrecision], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $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}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+306}:\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{+194}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.00000000000000007e306Initial program 56.9%
div-inv56.9%
*-commutative56.9%
cancel-sign-sub-inv56.9%
*-commutative56.9%
add-sqr-sqrt13.7%
sqrt-unprod40.5%
sqr-neg40.5%
sqrt-unprod27.0%
add-sqr-sqrt35.0%
fma-def35.0%
Applied egg-rr35.0%
*-commutative35.0%
fma-udef35.0%
distribute-rgt-in35.0%
div-inv35.0%
associate-/l*53.8%
*-commutative53.8%
add-sqr-sqrt33.3%
sqrt-unprod46.7%
sqr-neg46.7%
sqrt-unprod23.7%
add-sqr-sqrt68.0%
*-commutative68.0%
associate-*l*91.9%
div-inv92.0%
cancel-sign-sub-inv92.0%
div-inv92.0%
clear-num92.1%
Applied egg-rr92.1%
if -4.00000000000000007e306 < (-.f64 (*.f64 x y) (*.f64 z t)) < 9.99999999999999945e193Initial program 99.1%
if 9.99999999999999945e193 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 81.1%
div-sub76.8%
associate-/l*89.2%
associate-/l*95.4%
Applied egg-rr95.4%
Final simplification97.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
(let* ((t_1 (- (* x y) (* z t))))
(if (or (<= t_1 -4e+306) (not (<= t_1 5e+202)))
(- (* 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 <= -4e+306) || !(t_1 <= 5e+202)) {
tmp = (x * (y / a)) - (z * (t / a));
} else {
tmp = t_1 / 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) :: t_1
real(8) :: tmp
t_1 = (x * y) - (z * t)
if ((t_1 <= (-4d+306)) .or. (.not. (t_1 <= 5d+202))) then
tmp = (x * (y / a)) - (z * (t / a))
else
tmp = t_1 / 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 t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -4e+306) || !(t_1 <= 5e+202)) {
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 <= -4e+306) or not (t_1 <= 5e+202): 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 <= -4e+306) || !(t_1 <= 5e+202)) 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 <= -4e+306) || ~((t_1 <= 5e+202)))
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, -4e+306], N[Not[LessEqual[t$95$1, 5e+202]], $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 -4 \cdot 10^{+306} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+202}\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)) < -4.00000000000000007e306 or 4.9999999999999999e202 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 69.3%
div-inv69.3%
*-commutative69.3%
cancel-sign-sub-inv69.3%
*-commutative69.3%
add-sqr-sqrt23.6%
sqrt-unprod50.8%
sqr-neg50.8%
sqrt-unprod29.8%
add-sqr-sqrt43.4%
fma-def43.4%
Applied egg-rr43.4%
*-commutative43.4%
fma-udef43.4%
distribute-rgt-in42.2%
div-inv42.1%
associate-/l*57.8%
*-commutative57.8%
add-sqr-sqrt30.1%
sqrt-unprod59.5%
sqr-neg59.5%
sqrt-unprod37.6%
add-sqr-sqrt78.9%
*-commutative78.9%
associate-*l*93.7%
div-inv93.7%
cancel-sign-sub-inv93.7%
div-inv93.7%
clear-num93.8%
Applied egg-rr93.8%
if -4.00000000000000007e306 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.9999999999999999e202Initial program 99.1%
Final simplification97.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
(let* ((t_1 (/ x (/ a y))))
(if (<= (* x y) -0.1)
t_1
(if (<= (* x y) 1e-51)
(/ (- t) (/ a z))
(if (<= (* x y) 1e+194) (/ (* x y) a) t_1)))))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 / (a / y);
double tmp;
if ((x * y) <= -0.1) {
tmp = t_1;
} else if ((x * y) <= 1e-51) {
tmp = -t / (a / z);
} else if ((x * y) <= 1e+194) {
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.
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 / (a / y)
if ((x * y) <= (-0.1d0)) then
tmp = t_1
else if ((x * y) <= 1d-51) then
tmp = -t / (a / z)
else if ((x * y) <= 1d+194) then
tmp = (x * y) / a
else
tmp = t_1
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 t_1 = x / (a / y);
double tmp;
if ((x * y) <= -0.1) {
tmp = t_1;
} else if ((x * y) <= 1e-51) {
tmp = -t / (a / z);
} else if ((x * y) <= 1e+194) {
tmp = (x * y) / a;
} else {
tmp = t_1;
}
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 / (a / y) tmp = 0 if (x * y) <= -0.1: tmp = t_1 elif (x * y) <= 1e-51: tmp = -t / (a / z) elif (x * y) <= 1e+194: tmp = (x * y) / a else: tmp = t_1 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(x / Float64(a / y)) tmp = 0.0 if (Float64(x * y) <= -0.1) tmp = t_1; elseif (Float64(x * y) <= 1e-51) tmp = Float64(Float64(-t) / Float64(a / z)); elseif (Float64(x * y) <= 1e+194) 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])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = x / (a / y);
tmp = 0.0;
if ((x * y) <= -0.1)
tmp = t_1;
elseif ((x * y) <= 1e-51)
tmp = -t / (a / z);
elseif ((x * y) <= 1e+194)
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.
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[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -0.1], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e-51], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+194], 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])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \frac{x}{\frac{a}{y}}\\
\mathbf{if}\;x \cdot y \leq -0.1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 10^{-51}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{elif}\;x \cdot y \leq 10^{+194}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -0.10000000000000001 or 9.99999999999999945e193 < (*.f64 x y) Initial program 81.0%
Taylor expanded in x around inf 70.8%
associate-*l/79.5%
Simplified79.5%
associate-/r/80.9%
Applied egg-rr80.9%
if -0.10000000000000001 < (*.f64 x y) < 1e-51Initial program 94.7%
Taylor expanded in x around 0 80.5%
mul-1-neg80.5%
associate-/l*80.4%
Simplified80.4%
if 1e-51 < (*.f64 x y) < 9.99999999999999945e193Initial program 99.5%
Taylor expanded in x around inf 71.9%
Final simplification79.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
(let* ((t_1 (/ x (/ a y))))
(if (<= (* x y) -0.1)
t_1
(if (<= (* x y) 1e-51)
(* (/ t a) (- z))
(if (<= (* x y) 1e+194) (/ (* x y) a) t_1)))))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 / (a / y);
double tmp;
if ((x * y) <= -0.1) {
tmp = t_1;
} else if ((x * y) <= 1e-51) {
tmp = (t / a) * -z;
} else if ((x * y) <= 1e+194) {
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.
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 / (a / y)
if ((x * y) <= (-0.1d0)) then
tmp = t_1
else if ((x * y) <= 1d-51) then
tmp = (t / a) * -z
else if ((x * y) <= 1d+194) then
tmp = (x * y) / a
else
tmp = t_1
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 t_1 = x / (a / y);
double tmp;
if ((x * y) <= -0.1) {
tmp = t_1;
} else if ((x * y) <= 1e-51) {
tmp = (t / a) * -z;
} else if ((x * y) <= 1e+194) {
tmp = (x * y) / a;
} else {
tmp = t_1;
}
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 / (a / y) tmp = 0 if (x * y) <= -0.1: tmp = t_1 elif (x * y) <= 1e-51: tmp = (t / a) * -z elif (x * y) <= 1e+194: tmp = (x * y) / a else: tmp = t_1 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(x / Float64(a / y)) tmp = 0.0 if (Float64(x * y) <= -0.1) tmp = t_1; elseif (Float64(x * y) <= 1e-51) tmp = Float64(Float64(t / a) * Float64(-z)); elseif (Float64(x * y) <= 1e+194) 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])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = x / (a / y);
tmp = 0.0;
if ((x * y) <= -0.1)
tmp = t_1;
elseif ((x * y) <= 1e-51)
tmp = (t / a) * -z;
elseif ((x * y) <= 1e+194)
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.
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[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -0.1], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e-51], N[(N[(t / a), $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+194], 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])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \frac{x}{\frac{a}{y}}\\
\mathbf{if}\;x \cdot y \leq -0.1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 10^{-51}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{+194}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -0.10000000000000001 or 9.99999999999999945e193 < (*.f64 x y) Initial program 81.0%
Taylor expanded in x around inf 70.8%
associate-*l/79.5%
Simplified79.5%
associate-/r/80.9%
Applied egg-rr80.9%
if -0.10000000000000001 < (*.f64 x y) < 1e-51Initial program 94.7%
div-inv94.6%
*-commutative94.6%
cancel-sign-sub-inv94.6%
*-commutative94.6%
add-sqr-sqrt52.0%
sqrt-unprod50.1%
sqr-neg50.1%
sqrt-unprod13.4%
add-sqr-sqrt27.1%
fma-def27.1%
Applied egg-rr27.1%
*-commutative27.1%
fma-udef27.1%
distribute-rgt-in27.1%
div-inv27.1%
associate-/l*26.0%
*-commutative26.0%
add-sqr-sqrt13.6%
sqrt-unprod45.7%
sqr-neg45.7%
sqrt-unprod44.5%
add-sqr-sqrt93.5%
*-commutative93.5%
associate-*l*87.3%
div-inv87.3%
cancel-sign-sub-inv87.3%
div-inv87.3%
clear-num87.3%
Applied egg-rr87.3%
Taylor expanded in x around 0 80.5%
associate-*r/80.5%
mul-1-neg80.5%
distribute-lft-neg-out80.5%
*-commutative80.5%
associate-*r/74.3%
Simplified74.3%
if 1e-51 < (*.f64 x y) < 9.99999999999999945e193Initial program 99.5%
Taylor expanded in x around inf 71.9%
Final simplification76.8%
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 (/ a y))))
(if (<= (* x y) -0.1)
t_1
(if (<= (* x y) 1e-51)
(/ (* t (- z)) a)
(if (<= (* x y) 1e+194) (/ (* x y) a) t_1)))))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 / (a / y);
double tmp;
if ((x * y) <= -0.1) {
tmp = t_1;
} else if ((x * y) <= 1e-51) {
tmp = (t * -z) / a;
} else if ((x * y) <= 1e+194) {
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.
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 / (a / y)
if ((x * y) <= (-0.1d0)) then
tmp = t_1
else if ((x * y) <= 1d-51) then
tmp = (t * -z) / a
else if ((x * y) <= 1d+194) then
tmp = (x * y) / a
else
tmp = t_1
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 t_1 = x / (a / y);
double tmp;
if ((x * y) <= -0.1) {
tmp = t_1;
} else if ((x * y) <= 1e-51) {
tmp = (t * -z) / a;
} else if ((x * y) <= 1e+194) {
tmp = (x * y) / a;
} else {
tmp = t_1;
}
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 / (a / y) tmp = 0 if (x * y) <= -0.1: tmp = t_1 elif (x * y) <= 1e-51: tmp = (t * -z) / a elif (x * y) <= 1e+194: tmp = (x * y) / a else: tmp = t_1 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(x / Float64(a / y)) tmp = 0.0 if (Float64(x * y) <= -0.1) tmp = t_1; elseif (Float64(x * y) <= 1e-51) tmp = Float64(Float64(t * Float64(-z)) / a); elseif (Float64(x * y) <= 1e+194) 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])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = x / (a / y);
tmp = 0.0;
if ((x * y) <= -0.1)
tmp = t_1;
elseif ((x * y) <= 1e-51)
tmp = (t * -z) / a;
elseif ((x * y) <= 1e+194)
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.
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[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -0.1], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e-51], N[(N[(t * (-z)), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+194], 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])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \frac{x}{\frac{a}{y}}\\
\mathbf{if}\;x \cdot y \leq -0.1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 10^{-51}:\\
\;\;\;\;\frac{t \cdot \left(-z\right)}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+194}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -0.10000000000000001 or 9.99999999999999945e193 < (*.f64 x y) Initial program 81.0%
Taylor expanded in x around inf 70.8%
associate-*l/79.5%
Simplified79.5%
associate-/r/80.9%
Applied egg-rr80.9%
if -0.10000000000000001 < (*.f64 x y) < 1e-51Initial program 94.7%
Taylor expanded in x around 0 80.5%
mul-1-neg80.5%
distribute-rgt-neg-in80.5%
Simplified80.5%
if 1e-51 < (*.f64 x y) < 9.99999999999999945e193Initial program 99.5%
Taylor expanded in x around inf 71.9%
Final simplification79.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 (<= (* x y) -5e+243) (* x (/ y a)) (if (<= (* x y) 5e+205) (/ (- (* x y) (* z t)) a) (/ x (/ a y)))))
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) <= -5e+243) {
tmp = x * (y / a);
} else if ((x * y) <= 5e+205) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x / (a / y);
}
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) <= (-5d+243)) then
tmp = x * (y / a)
else if ((x * y) <= 5d+205) then
tmp = ((x * y) - (z * t)) / a
else
tmp = x / (a / y)
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) <= -5e+243) {
tmp = x * (y / a);
} else if ((x * y) <= 5e+205) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x / (a / y);
}
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) <= -5e+243: tmp = x * (y / a) elif (x * y) <= 5e+205: tmp = ((x * y) - (z * t)) / a else: tmp = x / (a / y) 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) <= -5e+243) tmp = Float64(x * Float64(y / a)); elseif (Float64(x * y) <= 5e+205) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(x / Float64(a / y)); 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) <= -5e+243)
tmp = x * (y / a);
elseif ((x * y) <= 5e+205)
tmp = ((x * y) - (z * t)) / a;
else
tmp = x / (a / y);
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], -5e+243], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+205], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x / N[(a / y), $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}\;x \cdot y \leq -5 \cdot 10^{+243}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+205}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.00000000000000037e243Initial program 71.6%
Taylor expanded in x around inf 71.8%
*-commutative71.8%
associate-*l/97.0%
Applied egg-rr97.0%
if -5.00000000000000037e243 < (*.f64 x y) < 5.0000000000000002e205Initial program 94.8%
if 5.0000000000000002e205 < (*.f64 x y) Initial program 75.4%
Taylor expanded in x around inf 75.4%
associate-*l/90.9%
Simplified90.9%
associate-/r/93.8%
Applied egg-rr93.8%
Final simplification95.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 (* 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 89.5%
Taylor expanded in x around inf 55.9%
associate-*l/57.8%
Simplified57.8%
Final simplification57.8%
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 (* 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) {
return x * (y / 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 = x * (y / 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 x * (y / 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 x * (y / 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(x * Float64(y / 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 = x * (y / 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[(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])\\
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 89.5%
Taylor expanded in x around inf 55.9%
*-commutative55.9%
associate-*l/57.7%
Applied egg-rr57.7%
Final simplification57.7%
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 (/ x (/ a y)))
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 x / (a / y);
}
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 = x / (a / y)
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 x / (a / y);
}
[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 x / (a / y)
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(x / Float64(a / y)) 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 = x / (a / y);
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[(x / N[(a / y), $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])\\
\\
\frac{x}{\frac{a}{y}}
\end{array}
Initial program 89.5%
Taylor expanded in x around inf 55.9%
associate-*l/57.8%
Simplified57.8%
associate-/r/58.2%
Applied egg-rr58.2%
Final simplification58.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 2024036
(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))