
(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 and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= a -6.8e+34) (- (* (/ y (pow (cbrt a) 2.0)) (/ x (cbrt a))) (* (/ t a) z)) (/ (- (* y x) (* t z)) a)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6.8e+34) {
tmp = ((y / pow(cbrt(a), 2.0)) * (x / cbrt(a))) - ((t / a) * z);
} else {
tmp = ((y * x) - (t * z)) / a;
}
return tmp;
}
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6.8e+34) {
tmp = ((y / Math.pow(Math.cbrt(a), 2.0)) * (x / Math.cbrt(a))) - ((t / a) * z);
} else {
tmp = ((y * x) - (t * z)) / a;
}
return tmp;
}
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (a <= -6.8e+34) tmp = Float64(Float64(Float64(y / (cbrt(a) ^ 2.0)) * Float64(x / cbrt(a))) - Float64(Float64(t / a) * z)); else tmp = Float64(Float64(Float64(y * x) - Float64(t * z)) / a); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[a, -6.8e+34], N[(N[(N[(y / N[Power[N[Power[a, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(x / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * x), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.8 \cdot 10^{+34}:\\
\;\;\;\;\frac{y}{{\left(\sqrt[3]{a}\right)}^{2}} \cdot \frac{x}{\sqrt[3]{a}} - \frac{t}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x - t \cdot z}{a}\\
\end{array}
\end{array}
if a < -6.7999999999999999e34Initial program 79.9%
div-sub79.9%
*-commutative79.9%
add-cube-cbrt79.3%
times-frac85.1%
fma-neg85.1%
pow285.1%
associate-/l*94.4%
Applied egg-rr94.4%
fma-neg94.4%
associate-/l*85.1%
*-commutative85.1%
associate-/l*94.3%
associate-/r/94.3%
Simplified94.3%
if -6.7999999999999999e34 < a Initial program 97.1%
Final simplification96.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ t a) (- z))) (t_2 (* x (/ y a))))
(if (<= (* y x) -1e+47)
t_2
(if (<= (* y x) 5e-34)
t_1
(if (<= (* y x) 0.05) (/ (* y x) a) (if (<= (* y x) 1e+53) t_1 t_2))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = (t / a) * -z;
double t_2 = x * (y / a);
double tmp;
if ((y * x) <= -1e+47) {
tmp = t_2;
} else if ((y * x) <= 5e-34) {
tmp = t_1;
} else if ((y * x) <= 0.05) {
tmp = (y * x) / a;
} else if ((y * x) <= 1e+53) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (t / a) * -z
t_2 = x * (y / a)
if ((y * x) <= (-1d+47)) then
tmp = t_2
else if ((y * x) <= 5d-34) then
tmp = t_1
else if ((y * x) <= 0.05d0) then
tmp = (y * x) / a
else if ((y * x) <= 1d+53) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t / a) * -z;
double t_2 = x * (y / a);
double tmp;
if ((y * x) <= -1e+47) {
tmp = t_2;
} else if ((y * x) <= 5e-34) {
tmp = t_1;
} else if ((y * x) <= 0.05) {
tmp = (y * x) / a;
} else if ((y * x) <= 1e+53) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = (t / a) * -z t_2 = x * (y / a) tmp = 0 if (y * x) <= -1e+47: tmp = t_2 elif (y * x) <= 5e-34: tmp = t_1 elif (y * x) <= 0.05: tmp = (y * x) / a elif (y * x) <= 1e+53: tmp = t_1 else: tmp = t_2 return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(Float64(t / a) * Float64(-z)) t_2 = Float64(x * Float64(y / a)) tmp = 0.0 if (Float64(y * x) <= -1e+47) tmp = t_2; elseif (Float64(y * x) <= 5e-34) tmp = t_1; elseif (Float64(y * x) <= 0.05) tmp = Float64(Float64(y * x) / a); elseif (Float64(y * x) <= 1e+53) tmp = t_1; else tmp = t_2; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (t / a) * -z;
t_2 = x * (y / a);
tmp = 0.0;
if ((y * x) <= -1e+47)
tmp = t_2;
elseif ((y * x) <= 5e-34)
tmp = t_1;
elseif ((y * x) <= 0.05)
tmp = (y * x) / a;
elseif ((y * x) <= 1e+53)
tmp = t_1;
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / a), $MachinePrecision] * (-z)), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * x), $MachinePrecision], -1e+47], t$95$2, If[LessEqual[N[(y * x), $MachinePrecision], 5e-34], t$95$1, If[LessEqual[N[(y * x), $MachinePrecision], 0.05], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 1e+53], t$95$1, t$95$2]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := \frac{t}{a} \cdot \left(-z\right)\\
t_2 := x \cdot \frac{y}{a}\\
\mathbf{if}\;y \cdot x \leq -1 \cdot 10^{+47}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \cdot x \leq 5 \cdot 10^{-34}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \cdot x \leq 0.05:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{elif}\;y \cdot x \leq 10^{+53}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (*.f64 x y) < -1e47 or 9.9999999999999999e52 < (*.f64 x y) Initial program 88.7%
Taylor expanded in x around inf 78.1%
associate-*r/83.0%
Simplified83.0%
if -1e47 < (*.f64 x y) < 5.0000000000000003e-34 or 0.050000000000000003 < (*.f64 x y) < 9.9999999999999999e52Initial program 94.8%
div-sub94.8%
*-commutative94.8%
add-cube-cbrt94.4%
times-frac91.7%
fma-neg91.7%
pow291.7%
associate-/l*90.4%
Applied egg-rr90.4%
fma-neg90.4%
associate-/l*91.7%
*-commutative91.7%
associate-/l*91.8%
associate-/r/91.1%
Simplified91.1%
Taylor expanded in y around 0 74.5%
neg-mul-174.5%
associate-*l/74.0%
distribute-rgt-neg-in74.0%
Simplified74.0%
if 5.0000000000000003e-34 < (*.f64 x y) < 0.050000000000000003Initial program 99.4%
Taylor expanded in x around inf 76.6%
Final simplification78.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (* y x) (* t z)))) (if (<= t_1 (- INFINITY)) (- (/ x (/ a y)) (/ z (/ a t))) (/ t_1 a))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * x) - (t * z);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * x) - (t * z);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = (y * x) - (t * z) tmp = 0 if t_1 <= -math.inf: tmp = (x / (a / y)) - (z / (a / t)) else: tmp = t_1 / a return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(Float64(y * x) - Float64(t * z)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); else tmp = Float64(t_1 / a); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (y * x) - (t * z);
tmp = 0.0;
if (t_1 <= -Inf)
tmp = (x / (a / y)) - (z / (a / t));
else
tmp = t_1 / a;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * x), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := y \cdot x - t \cdot z\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 67.6%
div-sub64.4%
associate-/l*76.2%
associate-/l*96.7%
Applied egg-rr96.7%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 95.8%
Final simplification95.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= a -1e-28) (- (* x (/ (- y) (- a))) (/ t (/ a z))) (/ (- (* y x) (* t z)) a)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1e-28) {
tmp = (x * (-y / -a)) - (t / (a / z));
} else {
tmp = ((y * x) - (t * z)) / a;
}
return tmp;
}
NOTE: x and y 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 (a <= (-1d-28)) then
tmp = (x * (-y / -a)) - (t / (a / z))
else
tmp = ((y * x) - (t * z)) / a
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1e-28) {
tmp = (x * (-y / -a)) - (t / (a / z));
} else {
tmp = ((y * x) - (t * z)) / a;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if a <= -1e-28: tmp = (x * (-y / -a)) - (t / (a / z)) else: tmp = ((y * x) - (t * z)) / a return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (a <= -1e-28) tmp = Float64(Float64(x * Float64(Float64(-y) / Float64(-a))) - Float64(t / Float64(a / z))); else tmp = Float64(Float64(Float64(y * x) - Float64(t * z)) / a); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (a <= -1e-28)
tmp = (x * (-y / -a)) - (t / (a / z));
else
tmp = ((y * x) - (t * z)) / a;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1e-28], N[(N[(x * N[((-y) / (-a)), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * x), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{-28}:\\
\;\;\;\;x \cdot \frac{-y}{-a} - \frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x - t \cdot z}{a}\\
\end{array}
\end{array}
if a < -9.99999999999999971e-29Initial program 83.3%
div-sub83.3%
*-un-lft-identity83.3%
add-sqr-sqrt0.0%
times-frac0.0%
fma-neg0.0%
associate-/l*0.0%
Applied egg-rr0.0%
fma-neg0.0%
associate-*l/0.0%
*-lft-identity0.0%
associate-/l*0.0%
associate-/r/0.0%
associate-*r/0.0%
associate-/l*0.0%
*-commutative0.0%
associate-/l*0.0%
Simplified0.0%
Taylor expanded in a around -inf 0.0%
*-commutative0.0%
associate-*r/0.0%
neg-mul-10.0%
distribute-rgt-neg-in0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt88.8%
neg-mul-188.8%
associate-/l*94.3%
associate-/r/93.9%
Simplified93.9%
if -9.99999999999999971e-29 < a Initial program 96.9%
Final simplification95.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= (* y x) -1e+47) (not (<= (* y x) 1e+53))) (* x (/ y a)) (* t (/ (- z) a))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((y * x) <= -1e+47) || !((y * x) <= 1e+53)) {
tmp = x * (y / a);
} else {
tmp = t * (-z / a);
}
return tmp;
}
NOTE: x and y 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 (((y * x) <= (-1d+47)) .or. (.not. ((y * x) <= 1d+53))) then
tmp = x * (y / a)
else
tmp = t * (-z / a)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((y * x) <= -1e+47) || !((y * x) <= 1e+53)) {
tmp = x * (y / a);
} else {
tmp = t * (-z / a);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if ((y * x) <= -1e+47) or not ((y * x) <= 1e+53): tmp = x * (y / a) else: tmp = t * (-z / a) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if ((Float64(y * x) <= -1e+47) || !(Float64(y * x) <= 1e+53)) tmp = Float64(x * Float64(y / a)); else tmp = Float64(t * Float64(Float64(-z) / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (((y * x) <= -1e+47) || ~(((y * x) <= 1e+53)))
tmp = x * (y / a);
else
tmp = t * (-z / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(y * x), $MachinePrecision], -1e+47], N[Not[LessEqual[N[(y * x), $MachinePrecision], 1e+53]], $MachinePrecision]], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -1 \cdot 10^{+47} \lor \neg \left(y \cdot x \leq 10^{+53}\right):\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1e47 or 9.9999999999999999e52 < (*.f64 x y) Initial program 88.7%
Taylor expanded in x around inf 78.1%
associate-*r/83.0%
Simplified83.0%
if -1e47 < (*.f64 x y) < 9.9999999999999999e52Initial program 95.0%
Taylor expanded in x around 0 72.0%
mul-1-neg72.0%
*-commutative72.0%
associate-*l/71.9%
*-commutative71.9%
distribute-rgt-neg-in71.9%
distribute-frac-neg71.9%
Simplified71.9%
Final simplification76.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* y x) 2e+246) (/ (- (* y x) (* t z)) a) (* x (/ y a))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y * x) <= 2e+246) {
tmp = ((y * x) - (t * z)) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x and y 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 ((y * x) <= 2d+246) then
tmp = ((y * x) - (t * z)) / a
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y * x) <= 2e+246) {
tmp = ((y * x) - (t * z)) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (y * x) <= 2e+246: tmp = ((y * x) - (t * z)) / a else: tmp = x * (y / a) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(y * x) <= 2e+246) tmp = Float64(Float64(Float64(y * x) - Float64(t * z)) / a); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((y * x) <= 2e+246)
tmp = ((y * x) - (t * z)) / a;
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(y * x), $MachinePrecision], 2e+246], N[(N[(N[(y * x), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq 2 \cdot 10^{+246}:\\
\;\;\;\;\frac{y \cdot x - t \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < 2.00000000000000014e246Initial program 93.6%
if 2.00000000000000014e246 < (*.f64 x y) Initial program 77.4%
Taylor expanded in x around inf 77.6%
associate-*r/99.9%
Simplified99.9%
Final simplification94.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 6.6e-134) (/ (* y x) a) (* x (/ y a))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 6.6e-134) {
tmp = (y * x) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x and y 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 <= 6.6d-134) then
tmp = (y * x) / a
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 6.6e-134) {
tmp = (y * x) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if t <= 6.6e-134: tmp = (y * x) / a else: tmp = x * (y / a) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 6.6e-134) tmp = Float64(Float64(y * x) / a); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= 6.6e-134)
tmp = (y * x) / a;
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 6.6e-134], N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 6.6 \cdot 10^{-134}:\\
\;\;\;\;\frac{y \cdot x}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < 6.60000000000000038e-134Initial program 92.8%
Taylor expanded in x around inf 57.2%
if 6.60000000000000038e-134 < t Initial program 91.3%
Taylor expanded in x around inf 47.7%
associate-*r/49.8%
Simplified49.8%
Final simplification54.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* x (/ y a)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
NOTE: x and y 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;
public static double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return x * (y / a)
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = x * (y / a);
end
NOTE: x and y 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] = \mathsf{sort}([x, y])\\
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 92.3%
Taylor expanded in x around inf 53.9%
associate-*r/53.2%
Simplified53.2%
Final simplification53.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 2023290
(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))