
(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: z and t 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 (<= t_1 (- INFINITY))
(fma -1.0 (/ t (/ a z)) (/ y (/ a x)))
(if (<= t_1 4e+229) (/ t_1 a) (- (/ x (/ a y)) (/ z (/ a t)))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(-1.0, (t / (a / z)), (y / (a / x)));
} else if (t_1 <= 4e+229) {
tmp = t_1 / a;
} else {
tmp = (x / (a / y)) - (z / (a / t));
}
return tmp;
}
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(-1.0, Float64(t / Float64(a / z)), Float64(y / Float64(a / x))); elseif (t_1 <= 4e+229) tmp = Float64(t_1 / a); else tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); end return tmp end
NOTE: z and t 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[LessEqual[t$95$1, (-Infinity)], N[(-1.0 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision] + N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+229], N[(t$95$1 / a), $MachinePrecision], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{t}{\frac{a}{z}}, \frac{y}{\frac{a}{x}}\right)\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{+229}:\\
\;\;\;\;\frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 55.2%
Taylor expanded in x around 0 46.5%
fma-def46.5%
associate-/l*86.9%
associate-/l*91.1%
Simplified91.1%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4e229Initial program 97.6%
if 4e229 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 84.1%
div-sub84.1%
associate-/l*90.5%
associate-/l*98.2%
Applied egg-rr98.2%
Final simplification97.1%
NOTE: z and t 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 -1e+281) (not (<= t_1 4e+229)))
(- (/ x (/ a y)) (/ z (/ a t)))
(/ t_1 a))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -1e+281) || !(t_1 <= 4e+229)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
NOTE: z and t 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 <= (-1d+281)) .or. (.not. (t_1 <= 4d+229))) then
tmp = (x / (a / y)) - (z / (a / t))
else
tmp = t_1 / a
end if
code = tmp
end function
assert z < t;
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 <= -1e+281) || !(t_1 <= 4e+229)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if (t_1 <= -1e+281) or not (t_1 <= 4e+229): tmp = (x / (a / y)) - (z / (a / t)) else: tmp = t_1 / a return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if ((t_1 <= -1e+281) || !(t_1 <= 4e+229)) tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); else tmp = Float64(t_1 / a); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if ((t_1 <= -1e+281) || ~((t_1 <= 4e+229)))
tmp = (x / (a / y)) - (z / (a / t));
else
tmp = t_1 / a;
end
tmp_2 = tmp;
end
NOTE: z and t 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, -1e+281], N[Not[LessEqual[t$95$1, 4e+229]], $MachinePrecision]], 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}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{+281} \lor \neg \left(t_1 \leq 4 \cdot 10^{+229}\right):\\
\;\;\;\;\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)) < -1e281 or 4e229 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 77.4%
div-sub75.2%
associate-/l*80.6%
associate-/l*95.3%
Applied egg-rr95.3%
if -1e281 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4e229Initial program 97.5%
Final simplification96.7%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ x (/ a y))))
(if (<= (* z t) -5e+51)
(* t (- (/ z a)))
(if (<= (* z t) -5e+26)
t_1
(if (<= (* z t) -5e-12)
(/ (- (* z t)) a)
(if (<= (* z t) 5000000.0) t_1 (- (* (/ t a) z))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = x / (a / y);
double tmp;
if ((z * t) <= -5e+51) {
tmp = t * -(z / a);
} else if ((z * t) <= -5e+26) {
tmp = t_1;
} else if ((z * t) <= -5e-12) {
tmp = -(z * t) / a;
} else if ((z * t) <= 5000000.0) {
tmp = t_1;
} else {
tmp = -((t / a) * z);
}
return tmp;
}
NOTE: z and t 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 / (a / y)
if ((z * t) <= (-5d+51)) then
tmp = t * -(z / a)
else if ((z * t) <= (-5d+26)) then
tmp = t_1
else if ((z * t) <= (-5d-12)) then
tmp = -(z * t) / a
else if ((z * t) <= 5000000.0d0) then
tmp = t_1
else
tmp = -((t / a) * z)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x / (a / y);
double tmp;
if ((z * t) <= -5e+51) {
tmp = t * -(z / a);
} else if ((z * t) <= -5e+26) {
tmp = t_1;
} else if ((z * t) <= -5e-12) {
tmp = -(z * t) / a;
} else if ((z * t) <= 5000000.0) {
tmp = t_1;
} else {
tmp = -((t / a) * z);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = x / (a / y) tmp = 0 if (z * t) <= -5e+51: tmp = t * -(z / a) elif (z * t) <= -5e+26: tmp = t_1 elif (z * t) <= -5e-12: tmp = -(z * t) / a elif (z * t) <= 5000000.0: tmp = t_1 else: tmp = -((t / a) * z) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(x / Float64(a / y)) tmp = 0.0 if (Float64(z * t) <= -5e+51) tmp = Float64(t * Float64(-Float64(z / a))); elseif (Float64(z * t) <= -5e+26) tmp = t_1; elseif (Float64(z * t) <= -5e-12) tmp = Float64(Float64(-Float64(z * t)) / a); elseif (Float64(z * t) <= 5000000.0) tmp = t_1; else tmp = Float64(-Float64(Float64(t / a) * z)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = x / (a / y);
tmp = 0.0;
if ((z * t) <= -5e+51)
tmp = t * -(z / a);
elseif ((z * t) <= -5e+26)
tmp = t_1;
elseif ((z * t) <= -5e-12)
tmp = -(z * t) / a;
elseif ((z * t) <= 5000000.0)
tmp = t_1;
else
tmp = -((t / a) * z);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+51], N[(t * (-N[(z / a), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -5e+26], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -5e-12], N[((-N[(z * t), $MachinePrecision]) / a), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5000000.0], t$95$1, (-N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision])]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x}{\frac{a}{y}}\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+51}:\\
\;\;\;\;t \cdot \left(-\frac{z}{a}\right)\\
\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{+26}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-12}:\\
\;\;\;\;\frac{-z \cdot t}{a}\\
\mathbf{elif}\;z \cdot t \leq 5000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-\frac{t}{a} \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -5e51Initial program 91.6%
Taylor expanded in x around 0 81.3%
associate-*r/81.3%
mul-1-neg81.3%
distribute-rgt-neg-out81.3%
*-commutative81.3%
associate-/l*84.7%
associate-/r/84.2%
Simplified84.2%
if -5e51 < (*.f64 z t) < -5.0000000000000001e26 or -4.9999999999999997e-12 < (*.f64 z t) < 5e6Initial program 93.3%
Taylor expanded in x around inf 78.0%
associate-*r/76.6%
Simplified76.6%
associate-*r/78.0%
*-commutative78.0%
associate-*r/80.1%
clear-num80.0%
un-div-inv80.7%
Applied egg-rr80.7%
if -5.0000000000000001e26 < (*.f64 z t) < -4.9999999999999997e-12Initial program 99.8%
Taylor expanded in x around 0 66.5%
associate-*r/66.5%
associate-*r*66.5%
neg-mul-166.5%
Simplified66.5%
if 5e6 < (*.f64 z t) Initial program 80.3%
div-sub78.4%
*-un-lft-identity78.4%
times-frac74.8%
fma-neg74.8%
associate-/l*90.6%
Applied egg-rr90.6%
Taylor expanded in x around 0 64.7%
mul-1-neg64.7%
associate-*r/78.5%
*-commutative78.5%
associate-*l/64.7%
associate-*r/80.5%
distribute-rgt-neg-out80.5%
distribute-neg-frac80.5%
Simplified80.5%
Final simplification80.6%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* x y) a)))
(if (<= x -3e+84)
t_1
(if (<= x -3.7e-66)
(* t (- (/ z a)))
(if (<= x -1.5e-115)
t_1
(if (<= x 1.22e-116) (- (* (/ t a) z)) (* y (/ x a))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if (x <= -3e+84) {
tmp = t_1;
} else if (x <= -3.7e-66) {
tmp = t * -(z / a);
} else if (x <= -1.5e-115) {
tmp = t_1;
} else if (x <= 1.22e-116) {
tmp = -((t / a) * z);
} else {
tmp = y * (x / a);
}
return tmp;
}
NOTE: z and t 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) / a
if (x <= (-3d+84)) then
tmp = t_1
else if (x <= (-3.7d-66)) then
tmp = t * -(z / a)
else if (x <= (-1.5d-115)) then
tmp = t_1
else if (x <= 1.22d-116) then
tmp = -((t / a) * z)
else
tmp = y * (x / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if (x <= -3e+84) {
tmp = t_1;
} else if (x <= -3.7e-66) {
tmp = t * -(z / a);
} else if (x <= -1.5e-115) {
tmp = t_1;
} else if (x <= 1.22e-116) {
tmp = -((t / a) * z);
} else {
tmp = y * (x / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) / a tmp = 0 if x <= -3e+84: tmp = t_1 elif x <= -3.7e-66: tmp = t * -(z / a) elif x <= -1.5e-115: tmp = t_1 elif x <= 1.22e-116: tmp = -((t / a) * z) else: tmp = y * (x / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / a) tmp = 0.0 if (x <= -3e+84) tmp = t_1; elseif (x <= -3.7e-66) tmp = Float64(t * Float64(-Float64(z / a))); elseif (x <= -1.5e-115) tmp = t_1; elseif (x <= 1.22e-116) tmp = Float64(-Float64(Float64(t / a) * z)); else tmp = Float64(y * Float64(x / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) / a;
tmp = 0.0;
if (x <= -3e+84)
tmp = t_1;
elseif (x <= -3.7e-66)
tmp = t * -(z / a);
elseif (x <= -1.5e-115)
tmp = t_1;
elseif (x <= 1.22e-116)
tmp = -((t / a) * z);
else
tmp = y * (x / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[x, -3e+84], t$95$1, If[LessEqual[x, -3.7e-66], N[(t * (-N[(z / a), $MachinePrecision])), $MachinePrecision], If[LessEqual[x, -1.5e-115], t$95$1, If[LessEqual[x, 1.22e-116], (-N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{a}\\
\mathbf{if}\;x \leq -3 \cdot 10^{+84}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-66}:\\
\;\;\;\;t \cdot \left(-\frac{z}{a}\right)\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-115}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-116}:\\
\;\;\;\;-\frac{t}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if x < -2.99999999999999996e84 or -3.7000000000000002e-66 < x < -1.5000000000000001e-115Initial program 91.7%
Taylor expanded in x around inf 74.4%
if -2.99999999999999996e84 < x < -3.7000000000000002e-66Initial program 93.0%
Taylor expanded in x around 0 57.3%
associate-*r/57.3%
mul-1-neg57.3%
distribute-rgt-neg-out57.3%
*-commutative57.3%
associate-/l*60.4%
associate-/r/60.5%
Simplified60.5%
if -1.5000000000000001e-115 < x < 1.22e-116Initial program 90.7%
div-sub90.7%
*-un-lft-identity90.7%
times-frac83.7%
fma-neg83.7%
associate-/l*86.4%
Applied egg-rr86.4%
Taylor expanded in x around 0 73.0%
mul-1-neg73.0%
associate-*r/72.9%
*-commutative72.9%
associate-*l/73.0%
associate-*r/72.0%
distribute-rgt-neg-out72.0%
distribute-neg-frac72.0%
Simplified72.0%
if 1.22e-116 < x Initial program 89.3%
Taylor expanded in x around inf 61.4%
associate-*r/66.0%
Simplified66.0%
Final simplification68.8%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* x y) a)))
(if (<= x -6.2e+84)
t_1
(if (<= x -6.2e-66)
(* t (- (/ z a)))
(if (<= x -1.6e-115)
t_1
(if (<= x 2e-118) (/ z (- (/ a t))) (* y (/ x a))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if (x <= -6.2e+84) {
tmp = t_1;
} else if (x <= -6.2e-66) {
tmp = t * -(z / a);
} else if (x <= -1.6e-115) {
tmp = t_1;
} else if (x <= 2e-118) {
tmp = z / -(a / t);
} else {
tmp = y * (x / a);
}
return tmp;
}
NOTE: z and t 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) / a
if (x <= (-6.2d+84)) then
tmp = t_1
else if (x <= (-6.2d-66)) then
tmp = t * -(z / a)
else if (x <= (-1.6d-115)) then
tmp = t_1
else if (x <= 2d-118) then
tmp = z / -(a / t)
else
tmp = y * (x / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if (x <= -6.2e+84) {
tmp = t_1;
} else if (x <= -6.2e-66) {
tmp = t * -(z / a);
} else if (x <= -1.6e-115) {
tmp = t_1;
} else if (x <= 2e-118) {
tmp = z / -(a / t);
} else {
tmp = y * (x / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) / a tmp = 0 if x <= -6.2e+84: tmp = t_1 elif x <= -6.2e-66: tmp = t * -(z / a) elif x <= -1.6e-115: tmp = t_1 elif x <= 2e-118: tmp = z / -(a / t) else: tmp = y * (x / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / a) tmp = 0.0 if (x <= -6.2e+84) tmp = t_1; elseif (x <= -6.2e-66) tmp = Float64(t * Float64(-Float64(z / a))); elseif (x <= -1.6e-115) tmp = t_1; elseif (x <= 2e-118) tmp = Float64(z / Float64(-Float64(a / t))); else tmp = Float64(y * Float64(x / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) / a;
tmp = 0.0;
if (x <= -6.2e+84)
tmp = t_1;
elseif (x <= -6.2e-66)
tmp = t * -(z / a);
elseif (x <= -1.6e-115)
tmp = t_1;
elseif (x <= 2e-118)
tmp = z / -(a / t);
else
tmp = y * (x / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[x, -6.2e+84], t$95$1, If[LessEqual[x, -6.2e-66], N[(t * (-N[(z / a), $MachinePrecision])), $MachinePrecision], If[LessEqual[x, -1.6e-115], t$95$1, If[LessEqual[x, 2e-118], N[(z / (-N[(a / t), $MachinePrecision])), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{a}\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{+84}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -6.2 \cdot 10^{-66}:\\
\;\;\;\;t \cdot \left(-\frac{z}{a}\right)\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-115}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-118}:\\
\;\;\;\;\frac{z}{-\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if x < -6.20000000000000006e84 or -6.1999999999999995e-66 < x < -1.6e-115Initial program 91.7%
Taylor expanded in x around inf 74.4%
if -6.20000000000000006e84 < x < -6.1999999999999995e-66Initial program 93.0%
Taylor expanded in x around 0 57.3%
associate-*r/57.3%
mul-1-neg57.3%
distribute-rgt-neg-out57.3%
*-commutative57.3%
associate-/l*60.4%
associate-/r/60.5%
Simplified60.5%
if -1.6e-115 < x < 1.99999999999999997e-118Initial program 90.7%
Taylor expanded in x around 0 73.0%
associate-*r/73.0%
mul-1-neg73.0%
distribute-rgt-neg-out73.0%
*-commutative73.0%
associate-/l*73.8%
associate-/r/72.9%
Simplified72.9%
distribute-frac-neg72.9%
distribute-lft-neg-in72.9%
associate-/r/73.8%
frac-2neg73.8%
distribute-neg-frac73.8%
remove-double-neg73.8%
distribute-neg-frac73.8%
Applied egg-rr73.8%
if 1.99999999999999997e-118 < x Initial program 89.3%
Taylor expanded in x around inf 61.4%
associate-*r/66.0%
Simplified66.0%
Final simplification69.4%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* z t) 4e+254) (/ (- (* x y) (* z t)) a) (- (* (/ t a) z))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= 4e+254) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = -((t / a) * z);
}
return tmp;
}
NOTE: z and t 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) <= 4d+254) then
tmp = ((x * y) - (z * t)) / a
else
tmp = -((t / a) * z)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= 4e+254) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = -((t / a) * z);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= 4e+254: tmp = ((x * y) - (z * t)) / a else: tmp = -((t / a) * z) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= 4e+254) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(-Float64(Float64(t / a) * z)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z * t) <= 4e+254)
tmp = ((x * y) - (z * t)) / a;
else
tmp = -((t / a) * z);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * t), $MachinePrecision], 4e+254], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], (-N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision])]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq 4 \cdot 10^{+254}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;-\frac{t}{a} \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < 3.9999999999999997e254Initial program 94.1%
if 3.9999999999999997e254 < (*.f64 z t) Initial program 53.0%
div-sub48.5%
*-un-lft-identity48.5%
times-frac48.5%
fma-neg48.5%
associate-/l*90.7%
Applied egg-rr90.7%
Taylor expanded in x around 0 53.0%
mul-1-neg53.0%
associate-*r/95.4%
*-commutative95.4%
associate-*l/53.0%
associate-*r/95.3%
distribute-rgt-neg-out95.3%
distribute-neg-frac95.3%
Simplified95.3%
Final simplification94.2%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= y -2.2e-104) (/ (* x y) a) (if (<= y 2.85e+38) (- (* (/ t a) z)) (* x (/ y a)))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.2e-104) {
tmp = (x * y) / a;
} else if (y <= 2.85e+38) {
tmp = -((t / a) * z);
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: z and t 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 <= (-2.2d-104)) then
tmp = (x * y) / a
else if (y <= 2.85d+38) then
tmp = -((t / a) * z)
else
tmp = x * (y / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.2e-104) {
tmp = (x * y) / a;
} else if (y <= 2.85e+38) {
tmp = -((t / a) * z);
} else {
tmp = x * (y / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -2.2e-104: tmp = (x * y) / a elif y <= 2.85e+38: tmp = -((t / a) * z) else: tmp = x * (y / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.2e-104) tmp = Float64(Float64(x * y) / a); elseif (y <= 2.85e+38) tmp = Float64(-Float64(Float64(t / a) * z)); else tmp = Float64(x * Float64(y / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -2.2e-104)
tmp = (x * y) / a;
elseif (y <= 2.85e+38)
tmp = -((t / a) * z);
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.2e-104], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 2.85e+38], (-N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{-104}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;y \leq 2.85 \cdot 10^{+38}:\\
\;\;\;\;-\frac{t}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if y < -2.20000000000000012e-104Initial program 95.0%
Taylor expanded in x around inf 55.8%
if -2.20000000000000012e-104 < y < 2.8499999999999999e38Initial program 92.5%
div-sub92.5%
*-un-lft-identity92.5%
times-frac92.5%
fma-neg92.5%
associate-/l*96.4%
Applied egg-rr96.4%
Taylor expanded in x around 0 65.9%
mul-1-neg65.9%
associate-*r/64.4%
*-commutative64.4%
associate-*l/65.9%
associate-*r/69.0%
distribute-rgt-neg-out69.0%
distribute-neg-frac69.0%
Simplified69.0%
if 2.8499999999999999e38 < y Initial program 81.3%
Taylor expanded in x around inf 66.4%
*-commutative66.4%
associate-*r/77.0%
Applied egg-rr77.0%
Final simplification66.9%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* x (/ y a)))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
NOTE: z and t 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 z < t;
public static double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): return x * (y / a)
z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = x * (y / a);
end
NOTE: z and t 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}
[z, t] = \mathsf{sort}([z, t])\\
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 90.6%
Taylor expanded in x around inf 49.6%
*-commutative49.6%
associate-*r/53.0%
Applied egg-rr53.0%
Final simplification53.0%
(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 2023221
(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))