
(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 (if (or (<= (* z t) -1e+267) (not (<= (* z t) 2e+234))) (* (/ (- 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) <= -1e+267) || !((z * t) <= 2e+234)) {
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) <= -1e+267) || !(Float64(z * t) <= 2e+234)) tmp = Float64(Float64(Float64(-z) / a) * t); else tmp = Float64(fma(y, x, Float64(Float64(-z) * 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[Or[LessEqual[N[(z * t), $MachinePrecision], -1e+267], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+234]], $MachinePrecision]], N[(N[((-z) / a), $MachinePrecision] * t), $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 -1 \cdot 10^{+267} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+234}\right):\\
\;\;\;\;\frac{-z}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(-z\right) \cdot t\right)}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -9.9999999999999997e266 or 2.00000000000000004e234 < (*.f64 z t) Initial program 72.9%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6475.3
Applied rewrites75.3%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6496.0
Applied rewrites96.0%
if -9.9999999999999997e266 < (*.f64 z t) < 2.00000000000000004e234Initial program 97.5%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6497.5
Applied rewrites97.5%
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
(let* ((t_1 (/ (* (- z) t) a)))
(if (<= (* z t) -1e+267)
(* (/ (- z) a) t)
(if (<= (* z t) -1e-66)
t_1
(if (<= (* z t) 1e-53)
(/ (* x y) a)
(if (<= (* z t) 5000000000000.0)
t_1
(if (<= (* z t) 1e+106) (* 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 t_1 = (-z * t) / a;
double tmp;
if ((z * t) <= -1e+267) {
tmp = (-z / a) * t;
} else if ((z * t) <= -1e-66) {
tmp = t_1;
} else if ((z * t) <= 1e-53) {
tmp = (x * y) / a;
} else if ((z * t) <= 5000000000000.0) {
tmp = t_1;
} else if ((z * t) <= 1e+106) {
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) :: t_1
real(8) :: tmp
t_1 = (-z * t) / a
if ((z * t) <= (-1d+267)) then
tmp = (-z / a) * t
else if ((z * t) <= (-1d-66)) then
tmp = t_1
else if ((z * t) <= 1d-53) then
tmp = (x * y) / a
else if ((z * t) <= 5000000000000.0d0) then
tmp = t_1
else if ((z * t) <= 1d+106) 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 t_1 = (-z * t) / a;
double tmp;
if ((z * t) <= -1e+267) {
tmp = (-z / a) * t;
} else if ((z * t) <= -1e-66) {
tmp = t_1;
} else if ((z * t) <= 1e-53) {
tmp = (x * y) / a;
} else if ((z * t) <= 5000000000000.0) {
tmp = t_1;
} else if ((z * t) <= 1e+106) {
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): t_1 = (-z * t) / a tmp = 0 if (z * t) <= -1e+267: tmp = (-z / a) * t elif (z * t) <= -1e-66: tmp = t_1 elif (z * t) <= 1e-53: tmp = (x * y) / a elif (z * t) <= 5000000000000.0: tmp = t_1 elif (z * t) <= 1e+106: 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) t_1 = Float64(Float64(Float64(-z) * t) / a) tmp = 0.0 if (Float64(z * t) <= -1e+267) tmp = Float64(Float64(Float64(-z) / a) * t); elseif (Float64(z * t) <= -1e-66) tmp = t_1; elseif (Float64(z * t) <= 1e-53) tmp = Float64(Float64(x * y) / a); elseif (Float64(z * t) <= 5000000000000.0) tmp = t_1; elseif (Float64(z * t) <= 1e+106) tmp = Float64(x * Float64(y / a)); else tmp = Float64(Float64(-z) * 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)
t_1 = (-z * t) / a;
tmp = 0.0;
if ((z * t) <= -1e+267)
tmp = (-z / a) * t;
elseif ((z * t) <= -1e-66)
tmp = t_1;
elseif ((z * t) <= 1e-53)
tmp = (x * y) / a;
elseif ((z * t) <= 5000000000000.0)
tmp = t_1;
elseif ((z * t) <= 1e+106)
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_] := Block[{t$95$1 = N[(N[((-z) * t), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+267], N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -1e-66], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e-53], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5000000000000.0], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e+106], N[(x * N[(y / a), $MachinePrecision]), $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}
t_1 := \frac{\left(-z\right) \cdot t}{a}\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+267}:\\
\;\;\;\;\frac{-z}{a} \cdot t\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 10^{-53}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;z \cdot t \leq 5000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 10^{+106}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) \cdot \frac{t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -9.9999999999999997e266Initial program 74.2%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6478.0
Applied rewrites78.0%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6496.6
Applied rewrites96.6%
if -9.9999999999999997e266 < (*.f64 z t) < -9.9999999999999998e-67 or 1.00000000000000003e-53 < (*.f64 z t) < 5e12Initial program 98.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6475.6
Applied rewrites75.6%
if -9.9999999999999998e-67 < (*.f64 z t) < 1.00000000000000003e-53Initial program 97.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
sqrt-prodN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-neg.f6420.9
Applied rewrites20.9%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f6488.4
Applied rewrites88.4%
if 5e12 < (*.f64 z t) < 1.00000000000000009e106Initial program 90.4%
Taylor expanded in x around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f6470.6
Applied rewrites70.6%
Applied rewrites65.9%
if 1.00000000000000009e106 < (*.f64 z t) Initial program 86.1%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r/N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6490.6
Applied rewrites90.6%
Final simplification84.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 (if (<= (- (* x y) (* z t)) 2e+270) (/ (fma y x (* (- z) t)) a) (fma (/ y a) x (* (- 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) - (z * t)) <= 2e+270) {
tmp = fma(y, x, (-z * t)) / a;
} else {
tmp = fma((y / a), x, (-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(Float64(x * y) - Float64(z * t)) <= 2e+270) tmp = Float64(fma(y, x, Float64(Float64(-z) * t)) / a); else tmp = fma(Float64(y / a), x, Float64(Float64(-t) * Float64(z / 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[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision], 2e+270], N[(N[(y * x + N[((-z) * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * x + 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}
\mathbf{if}\;x \cdot y - z \cdot t \leq 2 \cdot 10^{+270}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(-z\right) \cdot t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, x, \left(-t\right) \cdot \frac{z}{a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < 2.0000000000000001e270Initial program 97.1%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6497.1
Applied rewrites97.1%
if 2.0000000000000001e270 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 68.2%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6497.1
Applied rewrites97.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 (if (or (<= (* z t) -1e+267) (not (<= (* z t) 2e+234))) (* (/ (- 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) <= -1e+267) || !((z * t) <= 2e+234)) {
tmp = (-z / a) * t;
} 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 (((z * t) <= (-1d+267)) .or. (.not. ((z * t) <= 2d+234))) then
tmp = (-z / a) * t
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 (((z * t) <= -1e+267) || !((z * t) <= 2e+234)) {
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) <= -1e+267) or not ((z * t) <= 2e+234): 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) <= -1e+267) || !(Float64(z * t) <= 2e+234)) tmp = Float64(Float64(Float64(-z) / a) * 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) <= -1e+267) || ~(((z * t) <= 2e+234)))
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[Or[LessEqual[N[(z * t), $MachinePrecision], -1e+267], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+234]], $MachinePrecision]], N[(N[((-z) / a), $MachinePrecision] * t), $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 -1 \cdot 10^{+267} \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+234}\right):\\
\;\;\;\;\frac{-z}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -9.9999999999999997e266 or 2.00000000000000004e234 < (*.f64 z t) Initial program 72.9%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6475.3
Applied rewrites75.3%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6496.0
Applied rewrites96.0%
if -9.9999999999999997e266 < (*.f64 z t) < 2.00000000000000004e234Initial program 97.5%
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 (or (<= (* z t) -1e-66) (not (<= (* z t) 1e+106))) (* (/ (- z) a) t) (/ (* 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 (((z * t) <= -1e-66) || !((z * t) <= 1e+106)) {
tmp = (-z / a) * t;
} 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 (((z * t) <= (-1d-66)) .or. (.not. ((z * t) <= 1d+106))) then
tmp = (-z / a) * t
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 (((z * t) <= -1e-66) || !((z * t) <= 1e+106)) {
tmp = (-z / a) * t;
} 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 ((z * t) <= -1e-66) or not ((z * t) <= 1e+106): tmp = (-z / a) * t 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 ((Float64(z * t) <= -1e-66) || !(Float64(z * t) <= 1e+106)) tmp = Float64(Float64(Float64(-z) / a) * t); else tmp = Float64(Float64(x * 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 (((z * t) <= -1e-66) || ~(((z * t) <= 1e+106)))
tmp = (-z / a) * t;
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[Or[LessEqual[N[(z * t), $MachinePrecision], -1e-66], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1e+106]], $MachinePrecision]], N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision], N[(N[(x * y), $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 -1 \cdot 10^{-66} \lor \neg \left(z \cdot t \leq 10^{+106}\right):\\
\;\;\;\;\frac{-z}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -9.9999999999999998e-67 or 1.00000000000000009e106 < (*.f64 z t) Initial program 89.7%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6490.5
Applied rewrites90.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6479.3
Applied rewrites79.3%
if -9.9999999999999998e-67 < (*.f64 z t) < 1.00000000000000009e106Initial program 96.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
sqrt-prodN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-neg.f6423.8
Applied rewrites23.8%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f6477.9
Applied rewrites77.9%
Final simplification78.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 (<= (* z t) -1e-66) (* (/ (- z) a) t) (if (<= (* z t) 1e-53) (/ (* 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) <= -1e-66) {
tmp = (-z / a) * t;
} else if ((z * t) <= 1e-53) {
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) <= (-1d-66)) then
tmp = (-z / a) * t
else if ((z * t) <= 1d-53) 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) <= -1e-66) {
tmp = (-z / a) * t;
} else if ((z * t) <= 1e-53) {
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) <= -1e-66: tmp = (-z / a) * t elif (z * t) <= 1e-53: 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) <= -1e-66) tmp = Float64(Float64(Float64(-z) / a) * t); elseif (Float64(z * t) <= 1e-53) tmp = Float64(Float64(x * y) / a); else tmp = Float64(Float64(-z) * 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) <= -1e-66)
tmp = (-z / a) * t;
elseif ((z * t) <= 1e-53)
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], -1e-66], N[(N[((-z) / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e-53], 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 -1 \cdot 10^{-66}:\\
\;\;\;\;\frac{-z}{a} \cdot t\\
\mathbf{elif}\;z \cdot t \leq 10^{-53}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) \cdot \frac{t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -9.9999999999999998e-67Initial program 91.3%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6492.5
Applied rewrites92.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*l*N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6475.1
Applied rewrites75.1%
if -9.9999999999999998e-67 < (*.f64 z t) < 1.00000000000000003e-53Initial program 97.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
sqrt-prodN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-neg.f6420.9
Applied rewrites20.9%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f6488.4
Applied rewrites88.4%
if 1.00000000000000003e-53 < (*.f64 z t) Initial program 89.4%
Taylor expanded in x around 0
*-commutativeN/A
associate-*r/N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6467.8
Applied rewrites67.8%
Final simplification77.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 (if (<= (- (* x y) (* z t)) 1e+109) (/ (* x y) 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 * y) - (z * t)) <= 1e+109) {
tmp = (x * y) / 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 * y) - (z * t)) <= 1d+109) then
tmp = (x * y) / 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 * y) - (z * t)) <= 1e+109) {
tmp = (x * y) / 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 * y) - (z * t)) <= 1e+109: tmp = (x * y) / 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 (Float64(Float64(x * y) - Float64(z * t)) <= 1e+109) tmp = Float64(Float64(x * y) / 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 * y) - (z * t)) <= 1e+109)
tmp = (x * y) / 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[N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision], 1e+109], N[(N[(x * y), $MachinePrecision] / a), $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 \cdot y - z \cdot t \leq 10^{+109}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < 9.99999999999999982e108Initial program 96.5%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
sqrt-prodN/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-neg.f6428.6
Applied rewrites28.6%
Taylor expanded in y around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f6452.1
Applied rewrites52.1%
if 9.99999999999999982e108 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 84.8%
Taylor expanded in x around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f6444.5
Applied rewrites44.5%
Applied rewrites41.9%
Final simplification49.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 (if (<= x 8.2e-262) (* x (/ y a)) (* (/ x a) y)))
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 <= 8.2e-262) {
tmp = x * (y / a);
} else {
tmp = (x / a) * y;
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
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 <= 8.2d-262) then
tmp = x * (y / a)
else
tmp = (x / a) * y
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 <= 8.2e-262) {
tmp = x * (y / a);
} else {
tmp = (x / a) * y;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if x <= 8.2e-262: tmp = x * (y / a) else: tmp = (x / a) * y 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 <= 8.2e-262) tmp = Float64(x * Float64(y / a)); else tmp = Float64(Float64(x / a) * y); 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 <= 8.2e-262)
tmp = x * (y / a);
else
tmp = (x / a) * y;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[x, 8.2e-262], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(N[(x / a), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.2 \cdot 10^{-262}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{a} \cdot y\\
\end{array}
\end{array}
if x < 8.20000000000000052e-262Initial program 90.1%
Taylor expanded in x around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f6446.8
Applied rewrites46.8%
Applied rewrites48.5%
if 8.20000000000000052e-262 < x Initial program 96.0%
Taylor expanded in x around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f6445.1
Applied rewrites45.1%
Final simplification46.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(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 93.0%
Taylor expanded in x around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f6446.0
Applied rewrites46.0%
Applied rewrites47.3%
Final simplification47.3%
(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 2024320
(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))