
(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 (/ a y))) (t_2 (- (* x y) (* z t))))
(if (<= t_2 -4e+249)
(- t_1 (* t (/ z a)))
(if (<= t_2 5e+261) (/ t_2 a) (- t_1 (/ z (/ a t)))))))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 t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -4e+249) {
tmp = t_1 - (t * (z / a));
} else if (t_2 <= 5e+261) {
tmp = t_2 / a;
} else {
tmp = t_1 - (z / (a / t));
}
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) :: t_2
real(8) :: tmp
t_1 = x / (a / y)
t_2 = (x * y) - (z * t)
if (t_2 <= (-4d+249)) then
tmp = t_1 - (t * (z / a))
else if (t_2 <= 5d+261) then
tmp = t_2 / a
else
tmp = t_1 - (z / (a / t))
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 / (a / y);
double t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -4e+249) {
tmp = t_1 - (t * (z / a));
} else if (t_2 <= 5e+261) {
tmp = t_2 / a;
} else {
tmp = t_1 - (z / (a / t));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = x / (a / y) t_2 = (x * y) - (z * t) tmp = 0 if t_2 <= -4e+249: tmp = t_1 - (t * (z / a)) elif t_2 <= 5e+261: tmp = t_2 / a else: tmp = t_1 - (z / (a / t)) return tmp
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)) t_2 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_2 <= -4e+249) tmp = Float64(t_1 - Float64(t * Float64(z / a))); elseif (t_2 <= 5e+261) tmp = Float64(t_2 / a); else tmp = Float64(t_1 - Float64(z / Float64(a / t))); 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 / (a / y);
t_2 = (x * y) - (z * t);
tmp = 0.0;
if (t_2 <= -4e+249)
tmp = t_1 - (t * (z / a));
elseif (t_2 <= 5e+261)
tmp = t_2 / a;
else
tmp = t_1 - (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.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+249], N[(t$95$1 - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+261], N[(t$95$2 / a), $MachinePrecision], N[(t$95$1 - N[(z / N[(a / t), $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}{\frac{a}{y}}\\
t_2 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_2 \leq -4 \cdot 10^{+249}:\\
\;\;\;\;t_1 - t \cdot \frac{z}{a}\\
\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+261}:\\
\;\;\;\;\frac{t_2}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1 - \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -3.9999999999999997e249Initial program 79.8%
div-sub77.7%
associate-/l*85.7%
associate-/l*97.6%
Applied egg-rr97.6%
associate-/r/97.7%
Applied egg-rr97.7%
if -3.9999999999999997e249 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000001e261Initial program 98.1%
if 5.0000000000000001e261 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 74.2%
div-sub74.2%
associate-/l*89.5%
associate-/l*95.5%
Applied egg-rr95.5%
Final simplification97.6%
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 -1e+273) (not (<= t_1 5e+283)))
(- (* x (/ y a)) (/ z (/ a t)))
(/ t_1 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+273) || !(t_1 <= 5e+283)) {
tmp = (x * (y / a)) - (z / (a / t));
} else {
tmp = t_1 / 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+273)) .or. (.not. (t_1 <= 5d+283))) then
tmp = (x * (y / a)) - (z / (a / t))
else
tmp = t_1 / 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+273) || !(t_1 <= 5e+283)) {
tmp = (x * (y / a)) - (z / (a / t));
} else {
tmp = t_1 / 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+273) or not (t_1 <= 5e+283): tmp = (x * (y / a)) - (z / (a / t)) else: tmp = t_1 / 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+273) || !(t_1 <= 5e+283)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z / Float64(a / t))); else tmp = Float64(t_1 / 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+273) || ~((t_1 <= 5e+283)))
tmp = (x * (y / a)) - (z / (a / t));
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.
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, -1e+273], N[Not[LessEqual[t$95$1, 5e+283]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $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 -1 \cdot 10^{+273} \lor \neg \left(t_1 \leq 5 \cdot 10^{+283}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -9.99999999999999945e272 or 5.0000000000000004e283 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 72.5%
div-sub71.0%
associate-/l*84.7%
associate-/l*96.9%
Applied egg-rr96.9%
clear-num96.9%
associate-/r/96.9%
clear-num96.9%
Applied egg-rr96.9%
if -9.99999999999999945e272 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000004e283Initial program 98.2%
Final simplification97.9%
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+249)
(- (/ x (/ a y)) (* t (/ z a)))
(if (<= t_1 5e+283) (/ t_1 a) (- (* x (/ y a)) (/ z (/ a t)))))))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+249) {
tmp = (x / (a / y)) - (t * (z / a));
} else if (t_1 <= 5e+283) {
tmp = t_1 / a;
} else {
tmp = (x * (y / a)) - (z / (a / t));
}
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 <= (-4d+249)) then
tmp = (x / (a / y)) - (t * (z / a))
else if (t_1 <= 5d+283) then
tmp = t_1 / a
else
tmp = (x * (y / a)) - (z / (a / t))
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 <= -4e+249) {
tmp = (x / (a / y)) - (t * (z / a));
} else if (t_1 <= 5e+283) {
tmp = t_1 / a;
} else {
tmp = (x * (y / a)) - (z / (a / t));
}
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 <= -4e+249: tmp = (x / (a / y)) - (t * (z / a)) elif t_1 <= 5e+283: tmp = t_1 / a else: tmp = (x * (y / a)) - (z / (a / t)) 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 <= -4e+249) tmp = Float64(Float64(x / Float64(a / y)) - Float64(t * Float64(z / a))); elseif (t_1 <= 5e+283) tmp = Float64(t_1 / a); else tmp = Float64(Float64(x * Float64(y / a)) - Float64(z / Float64(a / t))); 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 <= -4e+249)
tmp = (x / (a / y)) - (t * (z / a));
elseif (t_1 <= 5e+283)
tmp = t_1 / a;
else
tmp = (x * (y / a)) - (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.
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+249], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+283], N[(t$95$1 / a), $MachinePrecision], N[(N[(x * N[(y / a), $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])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+249}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - t \cdot \frac{z}{a}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+283}:\\
\;\;\;\;\frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -3.9999999999999997e249Initial program 79.8%
div-sub77.7%
associate-/l*85.7%
associate-/l*97.6%
Applied egg-rr97.6%
associate-/r/97.7%
Applied egg-rr97.7%
if -3.9999999999999997e249 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000004e283Initial program 98.2%
if 5.0000000000000004e283 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 67.2%
div-sub67.2%
associate-/l*86.7%
associate-/l*96.5%
Applied egg-rr96.5%
clear-num96.4%
associate-/r/96.4%
clear-num96.4%
Applied egg-rr96.4%
Final simplification97.9%
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 (- (/ t (/ a z)))) (t_2 (* x (/ y a))))
(if (<= (* x y) -10000000000000.0)
t_2
(if (<= (* x y) 5e-57)
t_1
(if (<= (* x y) 4e-13)
(/ (* x y) a)
(if (<= (* x y) 3e+46) t_1 t_2))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = -(t / (a / z));
double t_2 = x * (y / a);
double tmp;
if ((x * y) <= -10000000000000.0) {
tmp = t_2;
} else if ((x * y) <= 5e-57) {
tmp = t_1;
} else if ((x * y) <= 4e-13) {
tmp = (x * y) / a;
} else if ((x * y) <= 3e+46) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = -(t / (a / z))
t_2 = x * (y / a)
if ((x * y) <= (-10000000000000.0d0)) then
tmp = t_2
else if ((x * y) <= 5d-57) then
tmp = t_1
else if ((x * y) <= 4d-13) then
tmp = (x * y) / a
else if ((x * y) <= 3d+46) then
tmp = t_1
else
tmp = t_2
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 = -(t / (a / z));
double t_2 = x * (y / a);
double tmp;
if ((x * y) <= -10000000000000.0) {
tmp = t_2;
} else if ((x * y) <= 5e-57) {
tmp = t_1;
} else if ((x * y) <= 4e-13) {
tmp = (x * y) / a;
} else if ((x * y) <= 3e+46) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = -(t / (a / z)) t_2 = x * (y / a) tmp = 0 if (x * y) <= -10000000000000.0: tmp = t_2 elif (x * y) <= 5e-57: tmp = t_1 elif (x * y) <= 4e-13: tmp = (x * y) / a elif (x * y) <= 3e+46: tmp = t_1 else: tmp = t_2 return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(-Float64(t / Float64(a / z))) t_2 = Float64(x * Float64(y / a)) tmp = 0.0 if (Float64(x * y) <= -10000000000000.0) tmp = t_2; elseif (Float64(x * y) <= 5e-57) tmp = t_1; elseif (Float64(x * y) <= 4e-13) tmp = Float64(Float64(x * y) / a); elseif (Float64(x * y) <= 3e+46) tmp = t_1; else tmp = t_2; 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 = -(t / (a / z));
t_2 = x * (y / a);
tmp = 0.0;
if ((x * y) <= -10000000000000.0)
tmp = t_2;
elseif ((x * y) <= 5e-57)
tmp = t_1;
elseif ((x * y) <= 4e-13)
tmp = (x * y) / a;
elseif ((x * y) <= 3e+46)
tmp = t_1;
else
tmp = t_2;
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[(t / N[(a / z), $MachinePrecision]), $MachinePrecision])}, Block[{t$95$2 = N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -10000000000000.0], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 5e-57], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4e-13], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3e+46], t$95$1, t$95$2]]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := -\frac{t}{\frac{a}{z}}\\
t_2 := x \cdot \frac{y}{a}\\
\mathbf{if}\;x \cdot y \leq -10000000000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-13}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 3 \cdot 10^{+46}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (*.f64 x y) < -1e13 or 3.00000000000000023e46 < (*.f64 x y) Initial program 87.7%
Taylor expanded in x around inf 73.3%
associate-/l*76.2%
div-inv76.1%
*-commutative76.1%
clear-num76.4%
Applied egg-rr76.4%
if -1e13 < (*.f64 x y) < 5.0000000000000002e-57 or 4.0000000000000001e-13 < (*.f64 x y) < 3.00000000000000023e46Initial program 94.0%
Taylor expanded in x around 0 82.5%
mul-1-neg82.5%
associate-/l*79.8%
Simplified79.8%
if 5.0000000000000002e-57 < (*.f64 x y) < 4.0000000000000001e-13Initial program 99.1%
Taylor expanded in x around inf 87.6%
Final simplification78.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
(let* ((t_1 (* x (/ y a))))
(if (<= (* x y) -10000000000000.0)
t_1
(if (<= (* x y) 5e-57)
(- (/ t (/ a z)))
(if (<= (* x y) 4e-13)
(/ (* x y) a)
(if (<= (* x y) 3e+46) (* z (/ (- t) 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 = x * (y / a);
double tmp;
if ((x * y) <= -10000000000000.0) {
tmp = t_1;
} else if ((x * y) <= 5e-57) {
tmp = -(t / (a / z));
} else if ((x * y) <= 4e-13) {
tmp = (x * y) / a;
} else if ((x * y) <= 3e+46) {
tmp = z * (-t / 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 = x * (y / a)
if ((x * y) <= (-10000000000000.0d0)) then
tmp = t_1
else if ((x * y) <= 5d-57) then
tmp = -(t / (a / z))
else if ((x * y) <= 4d-13) then
tmp = (x * y) / a
else if ((x * y) <= 3d+46) then
tmp = z * (-t / 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 = x * (y / a);
double tmp;
if ((x * y) <= -10000000000000.0) {
tmp = t_1;
} else if ((x * y) <= 5e-57) {
tmp = -(t / (a / z));
} else if ((x * y) <= 4e-13) {
tmp = (x * y) / a;
} else if ((x * y) <= 3e+46) {
tmp = z * (-t / 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 = x * (y / a) tmp = 0 if (x * y) <= -10000000000000.0: tmp = t_1 elif (x * y) <= 5e-57: tmp = -(t / (a / z)) elif (x * y) <= 4e-13: tmp = (x * y) / a elif (x * y) <= 3e+46: tmp = z * (-t / 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(x * Float64(y / a)) tmp = 0.0 if (Float64(x * y) <= -10000000000000.0) tmp = t_1; elseif (Float64(x * y) <= 5e-57) tmp = Float64(-Float64(t / Float64(a / z))); elseif (Float64(x * y) <= 4e-13) tmp = Float64(Float64(x * y) / a); elseif (Float64(x * y) <= 3e+46) tmp = Float64(z * Float64(Float64(-t) / 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 = x * (y / a);
tmp = 0.0;
if ((x * y) <= -10000000000000.0)
tmp = t_1;
elseif ((x * y) <= 5e-57)
tmp = -(t / (a / z));
elseif ((x * y) <= 4e-13)
tmp = (x * y) / a;
elseif ((x * y) <= 3e+46)
tmp = z * (-t / 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[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -10000000000000.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-57], (-N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), If[LessEqual[N[(x * y), $MachinePrecision], 4e-13], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3e+46], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{a}\\
\mathbf{if}\;x \cdot y \leq -10000000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-57}:\\
\;\;\;\;-\frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-13}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 3 \cdot 10^{+46}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (*.f64 x y) < -1e13 or 3.00000000000000023e46 < (*.f64 x y) Initial program 87.7%
Taylor expanded in x around inf 73.3%
associate-/l*76.2%
div-inv76.1%
*-commutative76.1%
clear-num76.4%
Applied egg-rr76.4%
if -1e13 < (*.f64 x y) < 5.0000000000000002e-57Initial program 93.5%
Taylor expanded in x around 0 82.0%
mul-1-neg82.0%
associate-/l*79.0%
Simplified79.0%
if 5.0000000000000002e-57 < (*.f64 x y) < 4.0000000000000001e-13Initial program 99.1%
Taylor expanded in x around inf 87.6%
if 4.0000000000000001e-13 < (*.f64 x y) < 3.00000000000000023e46Initial program 99.5%
div-sub88.4%
associate-/l*88.4%
associate-/l*81.2%
Applied egg-rr81.2%
clear-num81.2%
associate-/r/81.2%
clear-num81.2%
Applied egg-rr81.2%
Taylor expanded in y around 0 89.0%
associate-*r/89.0%
mul-1-neg89.0%
*-commutative89.0%
distribute-rgt-neg-in89.0%
associate-*r/79.1%
Simplified79.1%
Final simplification78.2%
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) -10000000000000.0)
t_1
(if (<= (* x y) 5e-57)
(/ (* t (- z)) a)
(if (<= (* x y) 4e-13)
(/ (* x y) a)
(if (<= (* x y) 3e+46) (* z (/ (- t) 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 = x * (y / a);
double tmp;
if ((x * y) <= -10000000000000.0) {
tmp = t_1;
} else if ((x * y) <= 5e-57) {
tmp = (t * -z) / a;
} else if ((x * y) <= 4e-13) {
tmp = (x * y) / a;
} else if ((x * y) <= 3e+46) {
tmp = z * (-t / 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 = x * (y / a)
if ((x * y) <= (-10000000000000.0d0)) then
tmp = t_1
else if ((x * y) <= 5d-57) then
tmp = (t * -z) / a
else if ((x * y) <= 4d-13) then
tmp = (x * y) / a
else if ((x * y) <= 3d+46) then
tmp = z * (-t / 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 = x * (y / a);
double tmp;
if ((x * y) <= -10000000000000.0) {
tmp = t_1;
} else if ((x * y) <= 5e-57) {
tmp = (t * -z) / a;
} else if ((x * y) <= 4e-13) {
tmp = (x * y) / a;
} else if ((x * y) <= 3e+46) {
tmp = z * (-t / 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 = x * (y / a) tmp = 0 if (x * y) <= -10000000000000.0: tmp = t_1 elif (x * y) <= 5e-57: tmp = (t * -z) / a elif (x * y) <= 4e-13: tmp = (x * y) / a elif (x * y) <= 3e+46: tmp = z * (-t / 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(x * Float64(y / a)) tmp = 0.0 if (Float64(x * y) <= -10000000000000.0) tmp = t_1; elseif (Float64(x * y) <= 5e-57) tmp = Float64(Float64(t * Float64(-z)) / a); elseif (Float64(x * y) <= 4e-13) tmp = Float64(Float64(x * y) / a); elseif (Float64(x * y) <= 3e+46) tmp = Float64(z * Float64(Float64(-t) / 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 = x * (y / a);
tmp = 0.0;
if ((x * y) <= -10000000000000.0)
tmp = t_1;
elseif ((x * y) <= 5e-57)
tmp = (t * -z) / a;
elseif ((x * y) <= 4e-13)
tmp = (x * y) / a;
elseif ((x * y) <= 3e+46)
tmp = z * (-t / 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[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -10000000000000.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-57], N[(N[(t * (-z)), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e-13], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3e+46], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{a}\\
\mathbf{if}\;x \cdot y \leq -10000000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-57}:\\
\;\;\;\;\frac{t \cdot \left(-z\right)}{a}\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-13}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 3 \cdot 10^{+46}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (*.f64 x y) < -1e13 or 3.00000000000000023e46 < (*.f64 x y) Initial program 87.7%
Taylor expanded in x around inf 73.3%
associate-/l*76.2%
div-inv76.1%
*-commutative76.1%
clear-num76.4%
Applied egg-rr76.4%
if -1e13 < (*.f64 x y) < 5.0000000000000002e-57Initial program 93.5%
Taylor expanded in x around 0 82.0%
mul-1-neg82.0%
distribute-rgt-neg-in82.0%
Simplified82.0%
if 5.0000000000000002e-57 < (*.f64 x y) < 4.0000000000000001e-13Initial program 99.1%
Taylor expanded in x around inf 87.6%
if 4.0000000000000001e-13 < (*.f64 x y) < 3.00000000000000023e46Initial program 99.5%
div-sub88.4%
associate-/l*88.4%
associate-/l*81.2%
Applied egg-rr81.2%
clear-num81.2%
associate-/r/81.2%
clear-num81.2%
Applied egg-rr81.2%
Taylor expanded in y around 0 89.0%
associate-*r/89.0%
mul-1-neg89.0%
*-commutative89.0%
distribute-rgt-neg-in89.0%
associate-*r/79.1%
Simplified79.1%
Final simplification79.6%
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+285) (/ (- (* x y) (* z t)) a) (/ y (/ a x))))
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+285) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = y / (a / x);
}
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) <= 5d+285) then
tmp = ((x * y) - (z * t)) / a
else
tmp = y / (a / x)
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) <= 5e+285) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = y / (a / x);
}
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) <= 5e+285: tmp = ((x * y) - (z * t)) / a else: tmp = y / (a / x) 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) <= 5e+285) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(y / Float64(a / x)); 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) <= 5e+285)
tmp = ((x * y) - (z * t)) / a;
else
tmp = y / (a / x);
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], 5e+285], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(y / N[(a / x), $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 5 \cdot 10^{+285}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < 5.00000000000000016e285Initial program 93.4%
if 5.00000000000000016e285 < (*.f64 x y) Initial program 64.9%
Taylor expanded in x around inf 70.2%
associate-*l/99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification93.9%
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);
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.
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;
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]) def code(x, y, z, t, a): return y * (x / 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])){:}
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. 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])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 91.3%
Taylor expanded in x around inf 48.0%
associate-*l/50.7%
Simplified50.7%
Final simplification50.7%
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 91.3%
Taylor expanded in x around inf 48.0%
associate-/l*49.0%
div-inv48.9%
*-commutative48.9%
clear-num49.0%
Applied egg-rr49.0%
Final simplification49.0%
(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 2023322
(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))