
(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 (- (* x y) (* z t))))
(if (or (<= t_1 -2e+286) (not (<= t_1 1e+257)))
(- (* x (/ y a)) (* z (/ t a)))
(/ (fma 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 t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -2e+286) || !(t_1 <= 1e+257)) {
tmp = (x * (y / a)) - (z * (t / a));
} else {
tmp = fma(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) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if ((t_1 <= -2e+286) || !(t_1 <= 1e+257)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); else tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a); end return tmp end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+286], N[Not[LessEqual[t$95$1, 1e+257]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + 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}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+286} \lor \neg \left(t\_1 \leq 10^{+257}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -2.00000000000000007e286 or 1.00000000000000003e257 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 71.0%
div-sub69.6%
associate-/l*78.4%
associate-/l*97.2%
Applied egg-rr97.2%
if -2.00000000000000007e286 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000003e257Initial program 99.5%
div-sub98.4%
*-commutative98.4%
div-sub99.5%
*-commutative99.5%
fma-neg99.5%
distribute-rgt-neg-out99.5%
Simplified99.5%
Final simplification98.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 (- (* x y) (* z t))))
(if (or (<= t_1 -2e+286) (not (<= t_1 1e+257)))
(- (* x (/ y a)) (* z (/ t 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 <= -2e+286) || !(t_1 <= 1e+257)) {
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.
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 <= (-2d+286)) .or. (.not. (t_1 <= 1d+257))) 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;
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 <= -2e+286) || !(t_1 <= 1e+257)) {
tmp = (x * (y / a)) - (z * (t / a));
} else {
tmp = t_1 / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if (t_1 <= -2e+286) or not (t_1 <= 1e+257): tmp = (x * (y / a)) - (z * (t / a)) else: tmp = t_1 / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if ((t_1 <= -2e+286) || !(t_1 <= 1e+257)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); else tmp = Float64(t_1 / a); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if ((t_1 <= -2e+286) || ~((t_1 <= 1e+257)))
tmp = (x * (y / a)) - (z * (t / a));
else
tmp = t_1 / a;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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, -2e+286], N[Not[LessEqual[t$95$1, 1e+257]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+286} \lor \neg \left(t\_1 \leq 10^{+257}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -2.00000000000000007e286 or 1.00000000000000003e257 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 71.0%
div-sub69.6%
associate-/l*78.4%
associate-/l*97.2%
Applied egg-rr97.2%
if -2.00000000000000007e286 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.00000000000000003e257Initial program 99.5%
Final simplification98.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 (or (<= (* z t) (- INFINITY)) (not (<= (* z t) 1e+249))) (* (/ t a) (- z)) (/ (- (* 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 (((z * t) <= -((double) INFINITY)) || !((z * t) <= 1e+249)) {
tmp = (t / a) * -z;
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z * t) <= -Double.POSITIVE_INFINITY) || !((z * t) <= 1e+249)) {
tmp = (t / a) * -z;
} 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 ((z * t) <= -math.inf) or not ((z * t) <= 1e+249): tmp = (t / a) * -z 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(z * t) <= Float64(-Inf)) || !(Float64(z * t) <= 1e+249)) tmp = Float64(Float64(t / a) * Float64(-z)); 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 (((z * t) <= -Inf) || ~(((z * t) <= 1e+249)))
tmp = (t / a) * -z;
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[(z * t), $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1e+249]], $MachinePrecision]], N[(N[(t / a), $MachinePrecision] * (-z)), $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}\;z \cdot t \leq -\infty \lor \neg \left(z \cdot t \leq 10^{+249}\right):\\
\;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0 or 9.9999999999999992e248 < (*.f64 z t) Initial program 62.6%
Taylor expanded in x around 0 62.6%
*-commutative62.6%
associate-*r/98.2%
neg-mul-198.2%
distribute-rgt-neg-in98.2%
distribute-frac-neg98.2%
Simplified98.2%
if -inf.0 < (*.f64 z t) < 9.9999999999999992e248Initial program 96.5%
Final simplification96.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 (or (<= (* x y) -2e-10) (not (<= (* x y) 5e-27))) (* y (/ x a)) (* 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 tmp;
if (((x * y) <= -2e-10) || !((x * y) <= 5e-27)) {
tmp = y * (x / a);
} else {
tmp = 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) :: tmp
if (((x * y) <= (-2d-10)) .or. (.not. ((x * y) <= 5d-27))) then
tmp = y * (x / a)
else
tmp = 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 tmp;
if (((x * y) <= -2e-10) || !((x * y) <= 5e-27)) {
tmp = y * (x / a);
} else {
tmp = t * (z / -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) <= -2e-10) or not ((x * y) <= 5e-27): tmp = y * (x / a) else: tmp = t * (z / -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) <= -2e-10) || !(Float64(x * y) <= 5e-27)) tmp = Float64(y * Float64(x / a)); else tmp = Float64(t * Float64(z / Float64(-a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (((x * y) <= -2e-10) || ~(((x * y) <= 5e-27)))
tmp = y * (x / a);
else
tmp = 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_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2e-10], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e-27]], $MachinePrecision]], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(t * N[(z / (-a)), $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 -2 \cdot 10^{-10} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{-27}\right):\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000007e-10 or 5.0000000000000002e-27 < (*.f64 x y) Initial program 87.7%
Taylor expanded in x around inf 75.2%
*-commutative75.2%
associate-/l*77.7%
Applied egg-rr77.7%
if -2.00000000000000007e-10 < (*.f64 x y) < 5.0000000000000002e-27Initial program 94.2%
Taylor expanded in x around 0 74.9%
mul-1-neg74.9%
associate-/l*77.4%
distribute-rgt-neg-in77.4%
distribute-neg-frac277.4%
Simplified77.4%
Final simplification77.5%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t -5e-152) (* t (/ z (- a))) (if (<= t 8.2e+49) (* y (/ x a)) (* (/ t a) (- z)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5e-152) {
tmp = t * (z / -a);
} else if (t <= 8.2e+49) {
tmp = y * (x / a);
} else {
tmp = (t / a) * -z;
}
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 (t <= (-5d-152)) then
tmp = t * (z / -a)
else if (t <= 8.2d+49) then
tmp = y * (x / a)
else
tmp = (t / a) * -z
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 (t <= -5e-152) {
tmp = t * (z / -a);
} else if (t <= 8.2e+49) {
tmp = y * (x / a);
} else {
tmp = (t / a) * -z;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if t <= -5e-152: tmp = t * (z / -a) elif t <= 8.2e+49: tmp = y * (x / a) else: tmp = (t / a) * -z return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (t <= -5e-152) tmp = Float64(t * Float64(z / Float64(-a))); elseif (t <= 8.2e+49) tmp = Float64(y * Float64(x / a)); else tmp = Float64(Float64(t / a) * Float64(-z)); 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 (t <= -5e-152)
tmp = t * (z / -a);
elseif (t <= 8.2e+49)
tmp = y * (x / a);
else
tmp = (t / a) * -z;
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[t, -5e-152], N[(t * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.2e+49], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * (-z)), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-152}:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{+49}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\
\end{array}
\end{array}
if t < -4.9999999999999997e-152Initial program 92.2%
Taylor expanded in x around 0 60.9%
mul-1-neg60.9%
associate-/l*64.2%
distribute-rgt-neg-in64.2%
distribute-neg-frac264.2%
Simplified64.2%
if -4.9999999999999997e-152 < t < 8.2e49Initial program 94.7%
Taylor expanded in x around inf 74.8%
*-commutative74.8%
associate-/l*72.2%
Applied egg-rr72.2%
if 8.2e49 < t Initial program 83.8%
Taylor expanded in x around 0 65.3%
*-commutative65.3%
associate-*r/74.5%
neg-mul-174.5%
distribute-rgt-neg-in74.5%
distribute-frac-neg74.5%
Simplified74.5%
Final simplification70.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 (<= t -5e-152) (* t (/ z (- a))) (if (<= t 9.5e+49) (* y (/ x 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 tmp;
if (t <= -5e-152) {
tmp = t * (z / -a);
} else if (t <= 9.5e+49) {
tmp = y * (x / a);
} else {
tmp = -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) :: tmp
if (t <= (-5d-152)) then
tmp = t * (z / -a)
else if (t <= 9.5d+49) then
tmp = y * (x / a)
else
tmp = -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 tmp;
if (t <= -5e-152) {
tmp = t * (z / -a);
} else if (t <= 9.5e+49) {
tmp = y * (x / a);
} else {
tmp = -z / (a / t);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if t <= -5e-152: tmp = t * (z / -a) elif t <= 9.5e+49: tmp = y * (x / a) else: tmp = -z / (a / t) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (t <= -5e-152) tmp = Float64(t * Float64(z / Float64(-a))); elseif (t <= 9.5e+49) tmp = Float64(y * Float64(x / a)); else tmp = Float64(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)
tmp = 0.0;
if (t <= -5e-152)
tmp = t * (z / -a);
elseif (t <= 9.5e+49)
tmp = y * (x / a);
else
tmp = -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_] := If[LessEqual[t, -5e-152], N[(t * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.5e+49], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-152}:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{+49}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\
\end{array}
\end{array}
if t < -4.9999999999999997e-152Initial program 92.2%
Taylor expanded in x around 0 60.9%
mul-1-neg60.9%
associate-/l*64.2%
distribute-rgt-neg-in64.2%
distribute-neg-frac264.2%
Simplified64.2%
if -4.9999999999999997e-152 < t < 9.49999999999999969e49Initial program 94.7%
Taylor expanded in x around inf 74.8%
*-commutative74.8%
associate-/l*72.2%
Applied egg-rr72.2%
if 9.49999999999999969e49 < t Initial program 83.8%
Taylor expanded in x around 0 65.3%
mul-1-neg65.3%
associate-/l*76.2%
distribute-rgt-neg-in76.2%
distribute-neg-frac276.2%
Simplified76.2%
*-commutative76.2%
associate-*l/65.3%
distribute-neg-frac265.3%
associate-*r/74.5%
distribute-lft-neg-in74.5%
clear-num74.5%
un-div-inv75.0%
Applied egg-rr75.0%
Final simplification70.5%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* x (/ y a)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x * (y / a)
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return x * (y / a)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = x * (y / a);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 91.2%
Taylor expanded in x around inf 52.2%
associate-*r/52.1%
Simplified52.1%
Final simplification52.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* 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.2%
Taylor expanded in x around inf 52.2%
*-commutative52.2%
associate-/l*51.7%
Applied egg-rr51.7%
Final simplification51.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
(if (< z -2.468684968699548e+170)
t_1
(if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = ((y / a) * x) - ((t / a) * z)
if (z < (-2.468684968699548d+170)) then
tmp = t_1
else if (z < 6.309831121978371d-71) then
tmp = ((x * y) - (z * t)) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y / a) * x) - ((t / a) * z) tmp = 0 if z < -2.468684968699548e+170: tmp = t_1 elif z < 6.309831121978371e-71: tmp = ((x * y) - (z * t)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z)) tmp = 0.0 if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y / a) * x) - ((t / a) * z); tmp = 0.0; if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = ((x * y) - (z * t)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024066
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(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))