
(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 7 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.
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))
(- (/ x (/ a y)) (/ z (/ a t)))
(if (<= t_1 1e+252) (/ t_1 a) (fma -1.0 (/ t (/ a z)) (/ y (/ a x)))))))assert(x < y);
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 = (x / (a / y)) - (z / (a / t));
} else if (t_1 <= 1e+252) {
tmp = t_1 / a;
} else {
tmp = fma(-1.0, (t / (a / z)), (y / (a / x)));
}
return tmp;
}
x, y = sort([x, y]) 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 = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); elseif (t_1 <= 1e+252) tmp = Float64(t_1 / a); else tmp = fma(-1.0, Float64(t / Float64(a / z)), Float64(y / Float64(a / x))); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function.
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[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+252], N[(t$95$1 / a), $MachinePrecision], N[(-1.0 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision] + N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\mathbf{elif}\;t_1 \leq 10^{+252}:\\
\;\;\;\;\frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{t}{\frac{a}{z}}, \frac{y}{\frac{a}{x}}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 75.8%
div-sub67.2%
associate-/l*80.5%
associate-/l*88.5%
Applied egg-rr88.5%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.0000000000000001e252Initial program 98.7%
if 1.0000000000000001e252 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 68.7%
Taylor expanded in x around 0 63.1%
fma-def63.1%
associate-/l*75.9%
associate-/l*83.2%
Simplified83.2%
Final simplification95.1%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -4e+131)
(/ y (/ a x))
(if (<= (* x y) -1.5e+24)
(* z (/ (- t) a))
(if (or (<= (* x y) -1e-29) (not (<= (* x y) 2000.0)))
(/ x (/ a y))
(/ (* z (- t)) a)))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -4e+131) {
tmp = y / (a / x);
} else if ((x * y) <= -1.5e+24) {
tmp = z * (-t / a);
} else if (((x * y) <= -1e-29) || !((x * y) <= 2000.0)) {
tmp = x / (a / y);
} else {
tmp = (z * -t) / a;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 ((x * y) <= (-4d+131)) then
tmp = y / (a / x)
else if ((x * y) <= (-1.5d+24)) then
tmp = z * (-t / a)
else if (((x * y) <= (-1d-29)) .or. (.not. ((x * y) <= 2000.0d0))) then
tmp = x / (a / y)
else
tmp = (z * -t) / a
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -4e+131) {
tmp = y / (a / x);
} else if ((x * y) <= -1.5e+24) {
tmp = z * (-t / a);
} else if (((x * y) <= -1e-29) || !((x * y) <= 2000.0)) {
tmp = x / (a / y);
} else {
tmp = (z * -t) / a;
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -4e+131: tmp = y / (a / x) elif (x * y) <= -1.5e+24: tmp = z * (-t / a) elif ((x * y) <= -1e-29) or not ((x * y) <= 2000.0): tmp = x / (a / y) else: tmp = (z * -t) / a return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -4e+131) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= -1.5e+24) tmp = Float64(z * Float64(Float64(-t) / a)); elseif ((Float64(x * y) <= -1e-29) || !(Float64(x * y) <= 2000.0)) tmp = Float64(x / Float64(a / y)); else tmp = Float64(Float64(z * Float64(-t)) / a); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -4e+131)
tmp = y / (a / x);
elseif ((x * y) <= -1.5e+24)
tmp = z * (-t / a);
elseif (((x * y) <= -1e-29) || ~(((x * y) <= 2000.0)))
tmp = x / (a / y);
else
tmp = (z * -t) / a;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -4e+131], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -1.5e+24], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e-29], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2000.0]], $MachinePrecision]], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], N[(N[(z * (-t)), $MachinePrecision] / a), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+131}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq -1.5 \cdot 10^{+24}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-29} \lor \neg \left(x \cdot y \leq 2000\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -3.9999999999999996e131Initial program 89.7%
Taylor expanded in x around inf 80.6%
associate-/l*86.5%
Simplified86.5%
if -3.9999999999999996e131 < (*.f64 x y) < -1.49999999999999997e24Initial program 86.2%
div-sub86.2%
associate-/l*77.5%
associate-/l*86.3%
Applied egg-rr86.3%
Taylor expanded in x around 0 51.6%
mul-1-neg51.6%
associate-*l/65.0%
distribute-lft-neg-out65.0%
*-commutative65.0%
distribute-neg-frac65.0%
Simplified65.0%
if -1.49999999999999997e24 < (*.f64 x y) < -9.99999999999999943e-30 or 2e3 < (*.f64 x y) Initial program 84.9%
Taylor expanded in x around inf 73.1%
associate-*r/80.2%
Simplified80.2%
associate-*r/73.1%
*-commutative73.1%
associate-/l*77.1%
Applied egg-rr77.1%
if -9.99999999999999943e-30 < (*.f64 x y) < 2e3Initial program 96.1%
Taylor expanded in x around 0 81.7%
associate-*r/81.7%
associate-*r*81.7%
neg-mul-181.7%
Simplified81.7%
Final simplification80.1%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -2e+279)
(* y (/ x a))
(if (<= (* x y) 2e+47)
(/ (- (* x y) (* z t)) a)
(- (/ x (/ a y)) (/ z (/ a t))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+279) {
tmp = y * (x / a);
} else if ((x * y) <= 2e+47) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = (x / (a / y)) - (z / (a / t));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 ((x * y) <= (-2d+279)) then
tmp = y * (x / a)
else if ((x * y) <= 2d+47) then
tmp = ((x * y) - (z * t)) / a
else
tmp = (x / (a / y)) - (z / (a / t))
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+279) {
tmp = y * (x / a);
} else if ((x * y) <= 2e+47) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = (x / (a / y)) - (z / (a / t));
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e+279: tmp = y * (x / a) elif (x * y) <= 2e+47: tmp = ((x * y) - (z * t)) / a else: tmp = (x / (a / y)) - (z / (a / t)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e+279) tmp = Float64(y * Float64(x / a)); elseif (Float64(x * y) <= 2e+47) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e+279)
tmp = y * (x / a);
elseif ((x * y) <= 2e+47)
tmp = ((x * y) - (z * t)) / a;
else
tmp = (x / (a / y)) - (z / (a / t));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+279], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+47], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+279}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+47}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000012e279Initial program 78.7%
Taylor expanded in x around inf 78.7%
associate-*r/100.0%
Simplified100.0%
if -2.00000000000000012e279 < (*.f64 x y) < 2.0000000000000001e47Initial program 95.8%
if 2.0000000000000001e47 < (*.f64 x y) Initial program 79.4%
div-sub79.4%
associate-/l*85.2%
associate-/l*91.2%
Applied egg-rr91.2%
Final simplification95.3%
NOTE: x and y should be sorted in increasing order before calling this function. 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) (- INFINITY)) (* z (/ (- t) a)) (if (<= (* z t) 2e+274) (/ (- (* x y) (* z t)) a) (* t (- (/ z a))))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -((double) INFINITY)) {
tmp = z * (-t / a);
} else if ((z * t) <= 2e+274) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t * -(z / a);
}
return tmp;
}
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -Double.POSITIVE_INFINITY) {
tmp = z * (-t / a);
} else if ((z * t) <= 2e+274) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t * -(z / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= -math.inf: tmp = z * (-t / a) elif (z * t) <= 2e+274: tmp = ((x * y) - (z * t)) / a else: tmp = t * -(z / a) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= Float64(-Inf)) tmp = Float64(z * Float64(Float64(-t) / a)); elseif (Float64(z * t) <= 2e+274) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(t * Float64(-Float64(z / a))); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z * t) <= -Inf)
tmp = z * (-t / a);
elseif ((z * t) <= 2e+274)
tmp = ((x * y) - (z * t)) / 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. 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], (-Infinity)], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+274], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(t * (-N[(z / a), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+274}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-\frac{z}{a}\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 70.3%
div-sub59.8%
associate-/l*59.8%
associate-/l*89.4%
Applied egg-rr89.4%
Taylor expanded in x around 0 70.3%
mul-1-neg70.3%
associate-*l/100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-neg-frac100.0%
Simplified100.0%
if -inf.0 < (*.f64 z t) < 1.99999999999999984e274Initial program 94.6%
if 1.99999999999999984e274 < (*.f64 z t) Initial program 75.9%
Taylor expanded in x around 0 80.9%
associate-*r/80.9%
mul-1-neg80.9%
distribute-rgt-neg-out80.9%
*-commutative80.9%
associate-/l*99.8%
associate-/r/99.9%
Simplified99.9%
Final simplification95.4%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= x -1.46e+54) (/ y (/ a x)) (if (<= x 1.9e-74) (* z (/ (- t) a)) (/ x (/ a y)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.46e+54) {
tmp = y / (a / x);
} else if (x <= 1.9e-74) {
tmp = z * (-t / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 (x <= (-1.46d+54)) then
tmp = y / (a / x)
else if (x <= 1.9d-74) then
tmp = z * (-t / a)
else
tmp = x / (a / y)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.46e+54) {
tmp = y / (a / x);
} else if (x <= 1.9e-74) {
tmp = z * (-t / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if x <= -1.46e+54: tmp = y / (a / x) elif x <= 1.9e-74: tmp = z * (-t / a) else: tmp = x / (a / y) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.46e+54) tmp = Float64(y / Float64(a / x)); elseif (x <= 1.9e-74) tmp = Float64(z * Float64(Float64(-t) / a)); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (x <= -1.46e+54)
tmp = y / (a / x);
elseif (x <= 1.9e-74)
tmp = z * (-t / a);
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.46e+54], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e-74], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.46 \cdot 10^{+54}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-74}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if x < -1.46000000000000003e54Initial program 88.0%
Taylor expanded in x around inf 71.7%
associate-/l*81.8%
Simplified81.8%
if -1.46000000000000003e54 < x < 1.8999999999999998e-74Initial program 94.1%
div-sub93.2%
associate-/l*87.4%
associate-/l*83.6%
Applied egg-rr83.6%
Taylor expanded in x around 0 70.9%
mul-1-neg70.9%
associate-*l/69.2%
distribute-lft-neg-out69.2%
*-commutative69.2%
distribute-neg-frac69.2%
Simplified69.2%
if 1.8999999999999998e-74 < x Initial program 89.8%
Taylor expanded in x around inf 53.5%
associate-*r/56.6%
Simplified56.6%
associate-*r/53.5%
*-commutative53.5%
associate-/l*55.6%
Applied egg-rr55.6%
Final simplification67.4%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= x -7e+54) (/ y (/ a x)) (if (<= x 1.5e-74) (* t (- (/ z a))) (/ x (/ a y)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -7e+54) {
tmp = y / (a / x);
} else if (x <= 1.5e-74) {
tmp = t * -(z / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 (x <= (-7d+54)) then
tmp = y / (a / x)
else if (x <= 1.5d-74) then
tmp = t * -(z / a)
else
tmp = x / (a / y)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -7e+54) {
tmp = y / (a / x);
} else if (x <= 1.5e-74) {
tmp = t * -(z / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if x <= -7e+54: tmp = y / (a / x) elif x <= 1.5e-74: tmp = t * -(z / a) else: tmp = x / (a / y) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (x <= -7e+54) tmp = Float64(y / Float64(a / x)); elseif (x <= 1.5e-74) tmp = Float64(t * Float64(-Float64(z / a))); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (x <= -7e+54)
tmp = y / (a / x);
elseif (x <= 1.5e-74)
tmp = t * -(z / a);
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[x, -7e+54], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.5e-74], N[(t * (-N[(z / a), $MachinePrecision])), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{+54}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-74}:\\
\;\;\;\;t \cdot \left(-\frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if x < -7.0000000000000002e54Initial program 88.0%
Taylor expanded in x around inf 71.7%
associate-/l*81.8%
Simplified81.8%
if -7.0000000000000002e54 < x < 1.50000000000000003e-74Initial program 94.1%
Taylor expanded in x around 0 70.9%
associate-*r/70.9%
mul-1-neg70.9%
distribute-rgt-neg-out70.9%
*-commutative70.9%
associate-/l*69.1%
associate-/r/68.7%
Simplified68.7%
if 1.50000000000000003e-74 < x Initial program 89.8%
Taylor expanded in x around inf 53.5%
associate-*r/56.6%
Simplified56.6%
associate-*r/53.5%
*-commutative53.5%
associate-/l*55.6%
Applied egg-rr55.6%
Final simplification67.2%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* y (/ x a)))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 = y * (x / a)
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): return y * (x / a)
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = y * (x / a);
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 91.4%
Taylor expanded in x around inf 50.0%
associate-*r/52.9%
Simplified52.9%
Final simplification52.9%
(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 2023242
(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))