
(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 8 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 (* y (/ x a))) (t_2 (- (* x y) (* z t))))
(if (<= t_2 -5e+290)
(- t_1 (/ z (/ a t)))
(if (<= t_2 2e+307) (/ t_2 a) (- t_1 (* t (/ z a)))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (x / a);
double t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -5e+290) {
tmp = t_1 - (z / (a / t));
} else if (t_2 <= 2e+307) {
tmp = t_2 / a;
} else {
tmp = t_1 - (t * (z / 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) :: t_2
real(8) :: tmp
t_1 = y * (x / a)
t_2 = (x * y) - (z * t)
if (t_2 <= (-5d+290)) then
tmp = t_1 - (z / (a / t))
else if (t_2 <= 2d+307) then
tmp = t_2 / a
else
tmp = t_1 - (t * (z / 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 = y * (x / a);
double t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -5e+290) {
tmp = t_1 - (z / (a / t));
} else if (t_2 <= 2e+307) {
tmp = t_2 / a;
} else {
tmp = t_1 - (t * (z / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = y * (x / a) t_2 = (x * y) - (z * t) tmp = 0 if t_2 <= -5e+290: tmp = t_1 - (z / (a / t)) elif t_2 <= 2e+307: tmp = t_2 / a else: tmp = t_1 - (t * (z / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(y * Float64(x / a)) t_2 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_2 <= -5e+290) tmp = Float64(t_1 - Float64(z / Float64(a / t))); elseif (t_2 <= 2e+307) tmp = Float64(t_2 / a); else tmp = Float64(t_1 - Float64(t * Float64(z / 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 = y * (x / a);
t_2 = (x * y) - (z * t);
tmp = 0.0;
if (t_2 <= -5e+290)
tmp = t_1 - (z / (a / t));
elseif (t_2 <= 2e+307)
tmp = t_2 / a;
else
tmp = t_1 - (t * (z / 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[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+290], N[(t$95$1 - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+307], N[(t$95$2 / a), $MachinePrecision], N[(t$95$1 - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := y \cdot \frac{x}{a}\\
t_2 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+290}:\\
\;\;\;\;t\_1 - \frac{z}{\frac{a}{t}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;\frac{t\_2}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t \cdot \frac{z}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999998e290Initial program 60.4%
div-sub53.5%
associate-/l*77.4%
associate-/l*88.3%
Applied egg-rr88.3%
associate-/r/90.5%
Applied egg-rr90.5%
if -4.9999999999999998e290 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999997e307Initial program 98.6%
if 1.99999999999999997e307 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 53.4%
div-sub50.3%
associate-/l*64.7%
associate-/l*87.6%
Applied egg-rr87.6%
associate-/r/84.6%
Applied egg-rr84.6%
associate-/r/87.7%
Applied egg-rr87.7%
Final simplification95.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ (- t) a))) (t_2 (/ (* x y) a)) (t_3 (* x (/ y a))))
(if (<= (* x y) -2e+94)
t_3
(if (<= (* x y) -1e+57)
t_1
(if (<= (* x y) -200000000000.0)
t_2
(if (<= (* x y) 2e-124) t_1 (if (<= (* x y) 5e+240) t_2 t_3)))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (-t / a);
double t_2 = (x * y) / a;
double t_3 = x * (y / a);
double tmp;
if ((x * y) <= -2e+94) {
tmp = t_3;
} else if ((x * y) <= -1e+57) {
tmp = t_1;
} else if ((x * y) <= -200000000000.0) {
tmp = t_2;
} else if ((x * y) <= 2e-124) {
tmp = t_1;
} else if ((x * y) <= 5e+240) {
tmp = t_2;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = z * (-t / a)
t_2 = (x * y) / a
t_3 = x * (y / a)
if ((x * y) <= (-2d+94)) then
tmp = t_3
else if ((x * y) <= (-1d+57)) then
tmp = t_1
else if ((x * y) <= (-200000000000.0d0)) then
tmp = t_2
else if ((x * y) <= 2d-124) then
tmp = t_1
else if ((x * y) <= 5d+240) then
tmp = t_2
else
tmp = t_3
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = z * (-t / a);
double t_2 = (x * y) / a;
double t_3 = x * (y / a);
double tmp;
if ((x * y) <= -2e+94) {
tmp = t_3;
} else if ((x * y) <= -1e+57) {
tmp = t_1;
} else if ((x * y) <= -200000000000.0) {
tmp = t_2;
} else if ((x * y) <= 2e-124) {
tmp = t_1;
} else if ((x * y) <= 5e+240) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = z * (-t / a) t_2 = (x * y) / a t_3 = x * (y / a) tmp = 0 if (x * y) <= -2e+94: tmp = t_3 elif (x * y) <= -1e+57: tmp = t_1 elif (x * y) <= -200000000000.0: tmp = t_2 elif (x * y) <= 2e-124: tmp = t_1 elif (x * y) <= 5e+240: tmp = t_2 else: tmp = t_3 return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(z * Float64(Float64(-t) / a)) t_2 = Float64(Float64(x * y) / a) t_3 = Float64(x * Float64(y / a)) tmp = 0.0 if (Float64(x * y) <= -2e+94) tmp = t_3; elseif (Float64(x * y) <= -1e+57) tmp = t_1; elseif (Float64(x * y) <= -200000000000.0) tmp = t_2; elseif (Float64(x * y) <= 2e-124) tmp = t_1; elseif (Float64(x * y) <= 5e+240) tmp = t_2; else tmp = t_3; end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = z * (-t / a);
t_2 = (x * y) / a;
t_3 = x * (y / a);
tmp = 0.0;
if ((x * y) <= -2e+94)
tmp = t_3;
elseif ((x * y) <= -1e+57)
tmp = t_1;
elseif ((x * y) <= -200000000000.0)
tmp = t_2;
elseif ((x * y) <= 2e-124)
tmp = t_1;
elseif ((x * y) <= 5e+240)
tmp = t_2;
else
tmp = t_3;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+94], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -1e+57], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -200000000000.0], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 2e-124], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e+240], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := z \cdot \frac{-t}{a}\\
t_2 := \frac{x \cdot y}{a}\\
t_3 := x \cdot \frac{y}{a}\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+94}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq -200000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-124}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+240}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 x y) < -2e94 or 5.0000000000000003e240 < (*.f64 x y) Initial program 72.8%
Taylor expanded in x around inf 72.9%
associate-*l/93.4%
Simplified93.4%
Taylor expanded in x around 0 72.9%
*-commutative72.9%
associate-*l/93.4%
*-commutative93.4%
Simplified93.4%
if -2e94 < (*.f64 x y) < -1.00000000000000005e57 or -2e11 < (*.f64 x y) < 1.99999999999999987e-124Initial program 90.2%
Taylor expanded in x around 0 76.6%
mul-1-neg76.6%
associate-/l*77.6%
Simplified77.6%
associate-/r/78.4%
Applied egg-rr78.4%
if -1.00000000000000005e57 < (*.f64 x y) < -2e11 or 1.99999999999999987e-124 < (*.f64 x y) < 5.0000000000000003e240Initial program 94.4%
Taylor expanded in x around inf 74.4%
Final simplification81.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) a)) (t_2 (* x (/ y a))))
(if (<= (* x y) -2e+94)
t_2
(if (<= (* x y) -1e+57)
(* z (/ (- t) a))
(if (<= (* x y) -200000000000.0)
t_1
(if (<= (* x y) 2e-124)
(/ (- t) (/ a z))
(if (<= (* x y) 5e+240) 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 = (x * y) / a;
double t_2 = x * (y / a);
double tmp;
if ((x * y) <= -2e+94) {
tmp = t_2;
} else if ((x * y) <= -1e+57) {
tmp = z * (-t / a);
} else if ((x * y) <= -200000000000.0) {
tmp = t_1;
} else if ((x * y) <= 2e-124) {
tmp = -t / (a / z);
} else if ((x * y) <= 5e+240) {
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 = (x * y) / a
t_2 = x * (y / a)
if ((x * y) <= (-2d+94)) then
tmp = t_2
else if ((x * y) <= (-1d+57)) then
tmp = z * (-t / a)
else if ((x * y) <= (-200000000000.0d0)) then
tmp = t_1
else if ((x * y) <= 2d-124) then
tmp = -t / (a / z)
else if ((x * y) <= 5d+240) 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 = (x * y) / a;
double t_2 = x * (y / a);
double tmp;
if ((x * y) <= -2e+94) {
tmp = t_2;
} else if ((x * y) <= -1e+57) {
tmp = z * (-t / a);
} else if ((x * y) <= -200000000000.0) {
tmp = t_1;
} else if ((x * y) <= 2e-124) {
tmp = -t / (a / z);
} else if ((x * y) <= 5e+240) {
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 = (x * y) / a t_2 = x * (y / a) tmp = 0 if (x * y) <= -2e+94: tmp = t_2 elif (x * y) <= -1e+57: tmp = z * (-t / a) elif (x * y) <= -200000000000.0: tmp = t_1 elif (x * y) <= 2e-124: tmp = -t / (a / z) elif (x * y) <= 5e+240: 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(x * y) / a) t_2 = Float64(x * Float64(y / a)) tmp = 0.0 if (Float64(x * y) <= -2e+94) tmp = t_2; elseif (Float64(x * y) <= -1e+57) tmp = Float64(z * Float64(Float64(-t) / a)); elseif (Float64(x * y) <= -200000000000.0) tmp = t_1; elseif (Float64(x * y) <= 2e-124) tmp = Float64(Float64(-t) / Float64(a / z)); elseif (Float64(x * y) <= 5e+240) 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 = (x * y) / a;
t_2 = x * (y / a);
tmp = 0.0;
if ((x * y) <= -2e+94)
tmp = t_2;
elseif ((x * y) <= -1e+57)
tmp = z * (-t / a);
elseif ((x * y) <= -200000000000.0)
tmp = t_1;
elseif ((x * y) <= 2e-124)
tmp = -t / (a / z);
elseif ((x * y) <= 5e+240)
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[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+94], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -1e+57], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -200000000000.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e-124], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+240], 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{x \cdot y}{a}\\
t_2 := x \cdot \frac{y}{a}\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+94}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{+57}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{elif}\;x \cdot y \leq -200000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-124}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+240}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 x y) < -2e94 or 5.0000000000000003e240 < (*.f64 x y) Initial program 72.8%
Taylor expanded in x around inf 72.9%
associate-*l/93.4%
Simplified93.4%
Taylor expanded in x around 0 72.9%
*-commutative72.9%
associate-*l/93.4%
*-commutative93.4%
Simplified93.4%
if -2e94 < (*.f64 x y) < -1.00000000000000005e57Initial program 90.9%
Taylor expanded in x around 0 73.4%
mul-1-neg73.4%
associate-/l*82.4%
Simplified82.4%
associate-/r/73.6%
Applied egg-rr73.6%
if -1.00000000000000005e57 < (*.f64 x y) < -2e11 or 1.99999999999999987e-124 < (*.f64 x y) < 5.0000000000000003e240Initial program 94.4%
Taylor expanded in x around inf 74.4%
if -2e11 < (*.f64 x y) < 1.99999999999999987e-124Initial program 90.1%
Taylor expanded in x around 0 77.0%
mul-1-neg77.0%
associate-/l*77.1%
Simplified77.1%
Final simplification80.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 (or (<= t_1 -5e+290) (not (<= t_1 2e+307)))
(- (* y (/ x a)) (* t (/ z a)))
(/ 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 <= -5e+290) || !(t_1 <= 2e+307)) {
tmp = (y * (x / a)) - (t * (z / 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.
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 <= (-5d+290)) .or. (.not. (t_1 <= 2d+307))) then
tmp = (y * (x / a)) - (t * (z / a))
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 <= -5e+290) || !(t_1 <= 2e+307)) {
tmp = (y * (x / a)) - (t * (z / a));
} 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 <= -5e+290) or not (t_1 <= 2e+307): tmp = (y * (x / a)) - (t * (z / a)) 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 <= -5e+290) || !(t_1 <= 2e+307)) tmp = Float64(Float64(y * Float64(x / a)) - Float64(t * Float64(z / a))); 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 <= -5e+290) || ~((t_1 <= 2e+307)))
tmp = (y * (x / a)) - (t * (z / 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.
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, -5e+290], N[Not[LessEqual[t$95$1, 2e+307]], $MachinePrecision]], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / 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])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+290} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+307}\right):\\
\;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999998e290 or 1.99999999999999997e307 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 57.4%
div-sub52.1%
associate-/l*71.9%
associate-/l*88.0%
Applied egg-rr88.0%
associate-/r/88.0%
Applied egg-rr88.0%
associate-/r/90.6%
Applied egg-rr90.6%
if -4.9999999999999998e290 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999997e307Initial program 98.6%
Final simplification96.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 (if (or (<= (* x y) -5e+265) (not (<= (* x y) 5e+248))) (* x (/ y a)) (/ (- (* x y) (* z t)) a)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) <= -5e+265) || !((x * y) <= 5e+248)) {
tmp = x * (y / a);
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (((x * y) <= (-5d+265)) .or. (.not. ((x * y) <= 5d+248))) then
tmp = x * (y / a)
else
tmp = ((x * y) - (z * t)) / a
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) <= -5e+265) || !((x * y) <= 5e+248)) {
tmp = x * (y / a);
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if ((x * y) <= -5e+265) or not ((x * y) <= 5e+248): tmp = x * (y / a) else: tmp = ((x * y) - (z * t)) / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if ((Float64(x * y) <= -5e+265) || !(Float64(x * y) <= 5e+248)) tmp = Float64(x * Float64(y / 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])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (((x * y) <= -5e+265) || ~(((x * y) <= 5e+248)))
tmp = x * (y / 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. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -5e+265], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e+248]], $MachinePrecision]], N[(x * N[(y / 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])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+265} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+248}\right):\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.0000000000000002e265 or 4.9999999999999996e248 < (*.f64 x y) Initial program 62.9%
Taylor expanded in x around inf 66.6%
associate-*l/98.0%
Simplified98.0%
Taylor expanded in x around 0 66.6%
*-commutative66.6%
associate-*l/98.1%
*-commutative98.1%
Simplified98.1%
if -5.0000000000000002e265 < (*.f64 x y) < 4.9999999999999996e248Initial program 92.6%
Final simplification93.8%
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 -5e-102) (* y (/ x a)) (* x (/ y a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -5e-102) {
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.
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 <= (-5d-102)) 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;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -5e-102) {
tmp = y * (x / a);
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if x <= -5e-102: tmp = y * (x / a) else: tmp = x * (y / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (x <= -5e-102) 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])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (x <= -5e-102)
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. code[x_, y_, z_, t_, a_] := If[LessEqual[x, -5e-102], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-102}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if x < -5.00000000000000026e-102Initial program 85.5%
Taylor expanded in x around inf 62.9%
associate-*l/71.0%
Simplified71.0%
if -5.00000000000000026e-102 < x Initial program 86.8%
Taylor expanded in x around inf 46.7%
associate-*l/47.6%
Simplified47.6%
Taylor expanded in x around 0 46.7%
*-commutative46.7%
associate-*l/49.9%
*-commutative49.9%
Simplified49.9%
Final simplification56.4%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= x -6.2e-102) (/ y (/ a x)) (* x (/ y a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -6.2e-102) {
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.
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.2d-102)) 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;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -6.2e-102) {
tmp = y / (a / x);
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if x <= -6.2e-102: tmp = y / (a / x) else: tmp = x * (y / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (x <= -6.2e-102) 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])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (x <= -6.2e-102)
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. code[x_, y_, z_, t_, a_] := If[LessEqual[x, -6.2e-102], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-102}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if x < -6.20000000000000026e-102Initial program 85.5%
Taylor expanded in x around inf 62.9%
associate-*l/71.0%
Simplified71.0%
*-commutative71.0%
clear-num71.0%
un-div-inv71.1%
Applied egg-rr71.1%
if -6.20000000000000026e-102 < x Initial program 86.8%
Taylor expanded in x around inf 46.7%
associate-*l/47.6%
Simplified47.6%
Taylor expanded in x around 0 46.7%
*-commutative46.7%
associate-*l/49.9%
*-commutative49.9%
Simplified49.9%
Final simplification56.4%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* 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 86.4%
Taylor expanded in x around inf 51.7%
associate-*l/54.8%
Simplified54.8%
Taylor expanded in x around 0 51.7%
*-commutative51.7%
associate-*l/55.2%
*-commutative55.2%
Simplified55.2%
Final simplification55.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 2024041
(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))