
(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 (if (<= (* z t) -2e+305) (fma (/ x a) y (/ z (/ a (- t)))) (/ (fma y x (* 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) <= -2e+305) {
tmp = fma((x / a), y, (z / (a / -t)));
} else {
tmp = fma(y, x, (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) <= -2e+305) tmp = fma(Float64(x / a), y, Float64(z / Float64(a / Float64(-t)))); else tmp = Float64(fma(y, x, 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_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+305], N[(N[(x / a), $MachinePrecision] * y + N[(z / N[(a / (-t)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * x + 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 -2 \cdot 10^{+305}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{a}, y, \frac{z}{\frac{a}{-t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, z \cdot \left(-t\right)\right)}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -1.9999999999999999e305Initial program 49.8%
lift-*.f64N/A
lift-*.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6461.4
Applied rewrites61.4%
associate-/l*N/A
distribute-lft-neg-inN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
if -1.9999999999999999e305 < (*.f64 z t) Initial program 97.0%
lift-*.f64N/A
lift-*.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6497.0
Applied rewrites97.0%
Final simplification97.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 (<= (* z t) -2e+305) (fma (/ x a) y (* z (/ (- t) a))) (/ (fma y x (* 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) <= -2e+305) {
tmp = fma((x / a), y, (z * (-t / a)));
} else {
tmp = fma(y, x, (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) <= -2e+305) tmp = fma(Float64(x / a), y, Float64(z * Float64(Float64(-t) / a))); else tmp = Float64(fma(y, x, 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_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+305], N[(N[(x / a), $MachinePrecision] * y + N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * x + 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 -2 \cdot 10^{+305}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{a}, y, z \cdot \frac{-t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, z \cdot \left(-t\right)\right)}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -1.9999999999999999e305Initial program 49.8%
lift-*.f64N/A
lift-*.f64N/A
div-subN/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6461.4
Applied rewrites61.4%
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-frac-negN/A
lift-neg.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-frac-neg2N/A
lower-/.f64N/A
lower-neg.f6499.9
Applied rewrites99.9%
if -1.9999999999999999e305 < (*.f64 z t) Initial program 97.0%
lift-*.f64N/A
lift-*.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6497.0
Applied rewrites97.0%
Final simplification97.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 (<= (* z t) -2e-30) (- (* t (/ z a))) (if (<= (* z t) 1e-10) (/ (* x y) a) (* 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) <= -2e-30) {
tmp = -(t * (z / a));
} else if ((z * t) <= 1e-10) {
tmp = (x * y) / a;
} else {
tmp = 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 ((z * t) <= (-2d-30)) then
tmp = -(t * (z / a))
else if ((z * t) <= 1d-10) then
tmp = (x * y) / a
else
tmp = 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 ((z * t) <= -2e-30) {
tmp = -(t * (z / a));
} else if ((z * t) <= 1e-10) {
tmp = (x * y) / a;
} else {
tmp = 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) <= -2e-30: tmp = -(t * (z / a)) elif (z * t) <= 1e-10: tmp = (x * y) / a else: tmp = 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) <= -2e-30) tmp = Float64(-Float64(t * Float64(z / a))); elseif (Float64(z * t) <= 1e-10) tmp = Float64(Float64(x * y) / a); else tmp = Float64(z * Float64(Float64(-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) <= -2e-30)
tmp = -(t * (z / a));
elseif ((z * t) <= 1e-10)
tmp = (x * y) / a;
else
tmp = 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[LessEqual[N[(z * t), $MachinePrecision], -2e-30], (-N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), If[LessEqual[N[(z * t), $MachinePrecision], 1e-10], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], N[(z * N[((-t) / a), $MachinePrecision]), $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 -2 \cdot 10^{-30}:\\
\;\;\;\;-t \cdot \frac{z}{a}\\
\mathbf{elif}\;z \cdot t \leq 10^{-10}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -2e-30Initial program 86.9%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6470.7
Applied rewrites70.7%
lift-neg.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-neg.f64N/A
remove-double-negN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6476.1
Applied rewrites76.1%
if -2e-30 < (*.f64 z t) < 1.00000000000000004e-10Initial program 98.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6483.9
Applied rewrites83.9%
if 1.00000000000000004e-10 < (*.f64 z t) Initial program 94.1%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6482.7
Applied rewrites82.7%
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
associate-*l/N/A
distribute-frac-negN/A
distribute-frac-neg2N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-*.f6484.0
Applied rewrites84.0%
Final simplification81.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 (let* ((t_1 (* z (/ (- t) a)))) (if (<= (* z t) -1e+32) t_1 (if (<= (* z t) 1e-10) (/ (* x y) 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 = z * (-t / a);
double tmp;
if ((z * t) <= -1e+32) {
tmp = t_1;
} else if ((z * t) <= 1e-10) {
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.
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 = z * (-t / a)
if ((z * t) <= (-1d+32)) then
tmp = t_1
else if ((z * t) <= 1d-10) then
tmp = (x * y) / 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 = z * (-t / a);
double tmp;
if ((z * t) <= -1e+32) {
tmp = t_1;
} else if ((z * t) <= 1e-10) {
tmp = (x * y) / 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 = z * (-t / a) tmp = 0 if (z * t) <= -1e+32: tmp = t_1 elif (z * t) <= 1e-10: tmp = (x * y) / 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(z * Float64(Float64(-t) / a)) tmp = 0.0 if (Float64(z * t) <= -1e+32) tmp = t_1; elseif (Float64(z * t) <= 1e-10) 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])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = z * (-t / a);
tmp = 0.0;
if ((z * t) <= -1e+32)
tmp = t_1;
elseif ((z * t) <= 1e-10)
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.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+32], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e-10], 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])\\
\\
\begin{array}{l}
t_1 := z \cdot \frac{-t}{a}\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 10^{-10}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.00000000000000005e32 or 1.00000000000000004e-10 < (*.f64 z t) Initial program 89.3%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6478.5
Applied rewrites78.5%
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
associate-*l/N/A
distribute-frac-negN/A
distribute-frac-neg2N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-*.f6482.6
Applied rewrites82.6%
if -1.00000000000000005e32 < (*.f64 z t) < 1.00000000000000004e-10Initial program 98.2%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6479.8
Applied rewrites79.8%
Final simplification81.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 (<= (* z t) (- INFINITY)) (/ z (/ a (- t))) (/ (fma y x (* 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)) {
tmp = z / (a / -t);
} else {
tmp = fma(y, x, (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)) tmp = Float64(z / Float64(a / Float64(-t))); else tmp = Float64(fma(y, x, 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_] := If[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[(z / N[(a / (-t)), $MachinePrecision]), $MachinePrecision], N[(N[(y * x + 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:\\
\;\;\;\;\frac{z}{\frac{a}{-t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, z \cdot \left(-t\right)\right)}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 52.7%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6458.9
Applied rewrites58.9%
distribute-rgt-neg-outN/A
*-commutativeN/A
lift-*.f64N/A
remove-double-negN/A
lift-neg.f64N/A
frac-2negN/A
lift-*.f64N/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
if -inf.0 < (*.f64 z t) Initial program 96.6%
lift-*.f64N/A
lift-*.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6496.6
Applied rewrites96.6%
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 (<= (* z t) (- INFINITY)) (/ z (/ a (- t))) (/ (- (* 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)) {
tmp = z / (a / -t);
} 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) {
tmp = z / (a / -t);
} 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: tmp = z / (a / -t) 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)) tmp = Float64(z / Float64(a / Float64(-t))); 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)
tmp = z / (a / -t);
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[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[(z / N[(a / (-t)), $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}\;z \cdot t \leq -\infty:\\
\;\;\;\;\frac{z}{\frac{a}{-t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 52.7%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6458.9
Applied rewrites58.9%
distribute-rgt-neg-outN/A
*-commutativeN/A
lift-*.f64N/A
remove-double-negN/A
lift-neg.f64N/A
frac-2negN/A
lift-*.f64N/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
if -inf.0 < (*.f64 z t) Initial program 96.6%
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 (/ (* 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(Float64(x * 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[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\frac{x \cdot y}{a}
\end{array}
Initial program 93.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.0
Applied rewrites50.0%
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);
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.
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;
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]) def code(x, y, z, t, a): return (x / a) * y
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(Float64(x / a) * y) end
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. code[x_, y_, z_, t_, a_] := N[(N[(x / a), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\frac{x}{a} \cdot y
\end{array}
Initial program 93.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6450.0
Applied rewrites50.0%
associate-*l/N/A
lift-/.f64N/A
lower-*.f6449.1
Applied rewrites49.1%
(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 2024214
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(! :herbie-platform default (if (< z -246868496869954800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6309831121978371/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z)))))
(/ (- (* x y) (* z t)) a))