
(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))
(* (* y (- (/ x t) (/ z y))) (/ t a))
(if (<= t_1 4e+288) (/ t_1 a) (fma -1.0 (/ 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) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (y * ((x / t) - (z / y))) * (t / a);
} else if (t_1 <= 4e+288) {
tmp = t_1 / a;
} else {
tmp = fma(-1.0, (t / (a / z)), (y * (x / 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 <= Float64(-Inf)) tmp = Float64(Float64(y * Float64(Float64(x / t) - Float64(z / y))) * Float64(t / a)); elseif (t_1 <= 4e+288) tmp = Float64(t_1 / a); else tmp = fma(-1.0, Float64(t / Float64(a / z)), Float64(y * Float64(x / a))); 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[(N[(y * N[(N[(x / t), $MachinePrecision] - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+288], N[(t$95$1 / a), $MachinePrecision], N[(-1.0 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision] + N[(y * N[(x / a), $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:\\
\;\;\;\;\left(y \cdot \left(\frac{x}{t} - \frac{z}{y}\right)\right) \cdot \frac{t}{a}\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{+288}:\\
\;\;\;\;\frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{t}{\frac{a}{z}}, y \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 71.8%
div-sub56.4%
associate-/l*60.0%
associate-/l*84.4%
Applied egg-rr84.4%
sub-neg84.4%
frac-2neg84.4%
associate-/r/84.4%
distribute-rgt-neg-out84.4%
add-sqr-sqrt30.6%
sqrt-unprod58.5%
sqr-neg58.5%
sqrt-unprod38.5%
add-sqr-sqrt42.4%
associate-/r/46.2%
frac-2neg46.2%
frac-add38.5%
Applied egg-rr77.8%
distribute-rgt-neg-out77.8%
sub-neg77.8%
sub-neg77.8%
distribute-lft-neg-out77.8%
distribute-neg-out77.8%
associate-*r/81.6%
distribute-frac-neg81.6%
cancel-sign-sub-inv81.6%
*-commutative81.6%
Simplified81.4%
Taylor expanded in a around -inf 71.8%
*-commutative71.8%
*-lft-identity71.8%
times-frac89.0%
associate-*l/89.0%
/-rgt-identity89.0%
Simplified89.0%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4e288Initial program 99.7%
if 4e288 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 79.5%
Taylor expanded in x around 0 79.5%
associate-/l*90.9%
fma-def90.9%
associate-/l*96.7%
associate-/r/99.9%
Simplified99.9%
Final simplification98.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 (* (/ t a) (- z))) (t_2 (/ (* x y) a)))
(if (<= (* x y) -400000000.0)
t_2
(if (<= (* x y) -1e-33)
t_1
(if (<= (* x y) -4e-84)
t_2
(if (<= (* x y) 2e-60) t_1 (* x (/ y a))))))))assert(z < t);
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 ((x * y) <= -400000000.0) {
tmp = t_2;
} else if ((x * y) <= -1e-33) {
tmp = t_1;
} else if ((x * y) <= -4e-84) {
tmp = t_2;
} else if ((x * y) <= 2e-60) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (t / a) * -z
t_2 = (x * y) / a
if ((x * y) <= (-400000000.0d0)) then
tmp = t_2
else if ((x * y) <= (-1d-33)) then
tmp = t_1
else if ((x * y) <= (-4d-84)) then
tmp = t_2
else if ((x * y) <= 2d-60) then
tmp = t_1
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 t_1 = (t / a) * -z;
double t_2 = (x * y) / a;
double tmp;
if ((x * y) <= -400000000.0) {
tmp = t_2;
} else if ((x * y) <= -1e-33) {
tmp = t_1;
} else if ((x * y) <= -4e-84) {
tmp = t_2;
} else if ((x * y) <= 2e-60) {
tmp = t_1;
} else {
tmp = x * (y / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (t / a) * -z t_2 = (x * y) / a tmp = 0 if (x * y) <= -400000000.0: tmp = t_2 elif (x * y) <= -1e-33: tmp = t_1 elif (x * y) <= -4e-84: tmp = t_2 elif (x * y) <= 2e-60: tmp = t_1 else: tmp = x * (y / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(t / a) * Float64(-z)) t_2 = Float64(Float64(x * y) / a) tmp = 0.0 if (Float64(x * y) <= -400000000.0) tmp = t_2; elseif (Float64(x * y) <= -1e-33) tmp = t_1; elseif (Float64(x * y) <= -4e-84) tmp = t_2; elseif (Float64(x * y) <= 2e-60) tmp = t_1; 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)
t_1 = (t / a) * -z;
t_2 = (x * y) / a;
tmp = 0.0;
if ((x * y) <= -400000000.0)
tmp = t_2;
elseif ((x * y) <= -1e-33)
tmp = t_1;
elseif ((x * y) <= -4e-84)
tmp = t_2;
elseif ((x * y) <= 2e-60)
tmp = t_1;
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_] := Block[{t$95$1 = N[(N[(t / a), $MachinePrecision] * (-z)), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -400000000.0], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -1e-33], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -4e-84], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 2e-60], t$95$1, N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{t}{a} \cdot \left(-z\right)\\
t_2 := \frac{x \cdot y}{a}\\
\mathbf{if}\;x \cdot y \leq -400000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-33}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{-84}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-60}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -4e8 or -1.0000000000000001e-33 < (*.f64 x y) < -4.0000000000000001e-84Initial program 93.2%
Taylor expanded in x around inf 73.9%
if -4e8 < (*.f64 x y) < -1.0000000000000001e-33 or -4.0000000000000001e-84 < (*.f64 x y) < 1.9999999999999999e-60Initial program 97.4%
div-inv97.2%
fma-neg97.2%
*-commutative97.2%
distribute-rgt-neg-in97.2%
Applied egg-rr97.2%
Taylor expanded in x around 0 86.8%
mul-1-neg86.8%
associate-*l/77.6%
distribute-rgt-neg-in77.6%
Simplified77.6%
if 1.9999999999999999e-60 < (*.f64 x y) Initial program 90.3%
Taylor expanded in x around inf 66.9%
associate-*r/71.0%
Simplified71.0%
Final simplification74.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 y) -400000000.0)
t_1
(if (<= (* x y) -1e-33)
(/ (- z) (/ a t))
(if (<= (* x y) -4e-84)
t_1
(if (<= (* x y) 2e-60) (* (/ t a) (- z)) (* x (/ y 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 * y) <= -400000000.0) {
tmp = t_1;
} else if ((x * y) <= -1e-33) {
tmp = -z / (a / t);
} else if ((x * y) <= -4e-84) {
tmp = t_1;
} else if ((x * y) <= 2e-60) {
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) :: t_1
real(8) :: tmp
t_1 = (x * y) / a
if ((x * y) <= (-400000000.0d0)) then
tmp = t_1
else if ((x * y) <= (-1d-33)) then
tmp = -z / (a / t)
else if ((x * y) <= (-4d-84)) then
tmp = t_1
else if ((x * y) <= 2d-60) 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 t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -400000000.0) {
tmp = t_1;
} else if ((x * y) <= -1e-33) {
tmp = -z / (a / t);
} else if ((x * y) <= -4e-84) {
tmp = t_1;
} else if ((x * y) <= 2e-60) {
tmp = (t / a) * -z;
} else {
tmp = x * (y / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) / a tmp = 0 if (x * y) <= -400000000.0: tmp = t_1 elif (x * y) <= -1e-33: tmp = -z / (a / t) elif (x * y) <= -4e-84: tmp = t_1 elif (x * y) <= 2e-60: tmp = (t / a) * -z else: tmp = x * (y / 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 (Float64(x * y) <= -400000000.0) tmp = t_1; elseif (Float64(x * y) <= -1e-33) tmp = Float64(Float64(-z) / Float64(a / t)); elseif (Float64(x * y) <= -4e-84) tmp = t_1; elseif (Float64(x * y) <= 2e-60) tmp = Float64(Float64(t / a) * Float64(-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)
t_1 = (x * y) / a;
tmp = 0.0;
if ((x * y) <= -400000000.0)
tmp = t_1;
elseif ((x * y) <= -1e-33)
tmp = -z / (a / t);
elseif ((x * y) <= -4e-84)
tmp = t_1;
elseif ((x * y) <= 2e-60)
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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -400000000.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -1e-33], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -4e-84], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e-60], 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}
t_1 := \frac{x \cdot y}{a}\\
\mathbf{if}\;x \cdot y \leq -400000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-33}:\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\
\mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{-84}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-60}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -4e8 or -1.0000000000000001e-33 < (*.f64 x y) < -4.0000000000000001e-84Initial program 93.2%
Taylor expanded in x around inf 73.9%
if -4e8 < (*.f64 x y) < -1.0000000000000001e-33Initial program 86.9%
Taylor expanded in x around 0 73.9%
associate-*r/73.9%
associate-*r*73.9%
neg-mul-173.9%
Simplified73.9%
associate-/l*73.2%
add-sqr-sqrt29.7%
sqrt-unprod30.0%
sqr-neg30.0%
sqrt-unprod0.6%
add-sqr-sqrt2.0%
associate-/r/1.8%
Applied egg-rr1.8%
associate-*l/1.8%
associate-*r/1.8%
add-sqr-sqrt0.4%
sqrt-unprod30.1%
sqr-neg30.1%
sqrt-unprod29.7%
add-sqr-sqrt82.5%
distribute-lft-neg-in82.5%
*-commutative82.5%
associate-/r/86.8%
distribute-neg-frac86.8%
Applied egg-rr86.8%
if -4.0000000000000001e-84 < (*.f64 x y) < 1.9999999999999999e-60Initial program 98.0%
div-inv97.9%
fma-neg97.9%
*-commutative97.9%
distribute-rgt-neg-in97.9%
Applied egg-rr97.9%
Taylor expanded in x around 0 87.7%
mul-1-neg87.7%
associate-*l/77.0%
distribute-rgt-neg-in77.0%
Simplified77.0%
if 1.9999999999999999e-60 < (*.f64 x y) Initial program 90.3%
Taylor expanded in x around inf 66.9%
associate-*r/71.0%
Simplified71.0%
Final simplification74.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 y) -400000000.0)
t_1
(if (<= (* x y) -1e-33)
(/ (- z) (/ a t))
(if (<= (* x y) -4e-84)
t_1
(if (<= (* x y) 1e+26) (/ (* t (- z)) a) (* x (/ y 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 * y) <= -400000000.0) {
tmp = t_1;
} else if ((x * y) <= -1e-33) {
tmp = -z / (a / t);
} else if ((x * y) <= -4e-84) {
tmp = t_1;
} else if ((x * y) <= 1e+26) {
tmp = (t * -z) / a;
} 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) :: t_1
real(8) :: tmp
t_1 = (x * y) / a
if ((x * y) <= (-400000000.0d0)) then
tmp = t_1
else if ((x * y) <= (-1d-33)) then
tmp = -z / (a / t)
else if ((x * y) <= (-4d-84)) then
tmp = t_1
else if ((x * y) <= 1d+26) then
tmp = (t * -z) / a
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 t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -400000000.0) {
tmp = t_1;
} else if ((x * y) <= -1e-33) {
tmp = -z / (a / t);
} else if ((x * y) <= -4e-84) {
tmp = t_1;
} else if ((x * y) <= 1e+26) {
tmp = (t * -z) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) / a tmp = 0 if (x * y) <= -400000000.0: tmp = t_1 elif (x * y) <= -1e-33: tmp = -z / (a / t) elif (x * y) <= -4e-84: tmp = t_1 elif (x * y) <= 1e+26: tmp = (t * -z) / a else: tmp = x * (y / 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 (Float64(x * y) <= -400000000.0) tmp = t_1; elseif (Float64(x * y) <= -1e-33) tmp = Float64(Float64(-z) / Float64(a / t)); elseif (Float64(x * y) <= -4e-84) tmp = t_1; elseif (Float64(x * y) <= 1e+26) tmp = Float64(Float64(t * Float64(-z)) / a); 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)
t_1 = (x * y) / a;
tmp = 0.0;
if ((x * y) <= -400000000.0)
tmp = t_1;
elseif ((x * y) <= -1e-33)
tmp = -z / (a / t);
elseif ((x * y) <= -4e-84)
tmp = t_1;
elseif ((x * y) <= 1e+26)
tmp = (t * -z) / a;
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_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -400000000.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -1e-33], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -4e-84], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e+26], N[(N[(t * (-z)), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y / 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 \cdot y \leq -400000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-33}:\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\
\mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{-84}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 10^{+26}:\\
\;\;\;\;\frac{t \cdot \left(-z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -4e8 or -1.0000000000000001e-33 < (*.f64 x y) < -4.0000000000000001e-84Initial program 93.2%
Taylor expanded in x around inf 73.9%
if -4e8 < (*.f64 x y) < -1.0000000000000001e-33Initial program 86.9%
Taylor expanded in x around 0 73.9%
associate-*r/73.9%
associate-*r*73.9%
neg-mul-173.9%
Simplified73.9%
associate-/l*73.2%
add-sqr-sqrt29.7%
sqrt-unprod30.0%
sqr-neg30.0%
sqrt-unprod0.6%
add-sqr-sqrt2.0%
associate-/r/1.8%
Applied egg-rr1.8%
associate-*l/1.8%
associate-*r/1.8%
add-sqr-sqrt0.4%
sqrt-unprod30.1%
sqr-neg30.1%
sqrt-unprod29.7%
add-sqr-sqrt82.5%
distribute-lft-neg-in82.5%
*-commutative82.5%
associate-/r/86.8%
distribute-neg-frac86.8%
Applied egg-rr86.8%
if -4.0000000000000001e-84 < (*.f64 x y) < 1.00000000000000005e26Initial program 98.2%
Taylor expanded in x around 0 84.2%
associate-*r/84.2%
associate-*r*84.2%
neg-mul-184.2%
Simplified84.2%
if 1.00000000000000005e26 < (*.f64 x y) Initial program 88.1%
Taylor expanded in x around inf 71.3%
associate-*r/78.0%
Simplified78.0%
Final simplification80.0%
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) 1e+307) (/ (- (* x y) (* z t)) a) (/ (- z) (/ a t))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= 1e+307) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = -z / (a / t);
}
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) <= 1d+307) then
tmp = ((x * y) - (z * t)) / a
else
tmp = -z / (a / t)
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) <= 1e+307) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = -z / (a / t);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= 1e+307: tmp = ((x * y) - (z * t)) / a else: tmp = -z / (a / t) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= 1e+307) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(Float64(-z) / Float64(a / t)); 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) <= 1e+307)
tmp = ((x * y) - (z * t)) / a;
else
tmp = -z / (a / t);
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], 1e+307], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq 10^{+307}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\
\end{array}
\end{array}
if (*.f64 z t) < 9.99999999999999986e306Initial program 96.6%
if 9.99999999999999986e306 < (*.f64 z t) Initial program 54.3%
Taylor expanded in x around 0 54.3%
associate-*r/54.3%
associate-*r*54.3%
neg-mul-154.3%
Simplified54.3%
associate-/l*99.9%
add-sqr-sqrt49.7%
sqrt-unprod37.1%
sqr-neg37.1%
sqrt-unprod0.0%
add-sqr-sqrt0.1%
associate-/r/0.1%
Applied egg-rr0.1%
associate-*l/0.0%
associate-*r/0.1%
add-sqr-sqrt0.0%
sqrt-unprod37.1%
sqr-neg37.1%
sqrt-unprod49.7%
add-sqr-sqrt99.7%
distribute-lft-neg-in99.7%
*-commutative99.7%
associate-/r/99.7%
distribute-neg-frac99.7%
Applied egg-rr99.7%
Final simplification96.8%
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+89) (/ (* x y) a) (* y (/ x a))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 2e+89) {
tmp = (x * y) / a;
} 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) :: tmp
if ((x * y) <= 2d+89) then
tmp = (x * y) / a
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 tmp;
if ((x * y) <= 2e+89) {
tmp = (x * y) / a;
} else {
tmp = y * (x / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= 2e+89: tmp = (x * y) / a else: tmp = y * (x / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= 2e+89) tmp = Float64(Float64(x * y) / a); 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)
tmp = 0.0;
if ((x * y) <= 2e+89)
tmp = (x * y) / a;
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_] := If[LessEqual[N[(x * y), $MachinePrecision], 2e+89], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 2 \cdot 10^{+89}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < 1.99999999999999999e89Initial program 95.8%
Taylor expanded in x around inf 41.0%
if 1.99999999999999999e89 < (*.f64 x y) Initial program 87.4%
Taylor expanded in x around inf 72.5%
associate-*l/84.9%
Simplified84.9%
Final simplification48.7%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= a 6.2e-189) (* x (/ y a)) (* y (/ x a))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 6.2e-189) {
tmp = x * (y / a);
} 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) :: tmp
if (a <= 6.2d-189) then
tmp = x * (y / a)
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 tmp;
if (a <= 6.2e-189) {
tmp = x * (y / a);
} else {
tmp = y * (x / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if a <= 6.2e-189: tmp = x * (y / a) else: tmp = y * (x / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (a <= 6.2e-189) tmp = Float64(x * Float64(y / a)); 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)
tmp = 0.0;
if (a <= 6.2e-189)
tmp = x * (y / a);
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_] := If[LessEqual[a, 6.2e-189], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq 6.2 \cdot 10^{-189}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if a < 6.2000000000000001e-189Initial program 96.0%
Taylor expanded in x around inf 52.1%
associate-*r/50.7%
Simplified50.7%
if 6.2000000000000001e-189 < a Initial program 91.8%
Taylor expanded in x around inf 38.5%
associate-*l/39.9%
Simplified39.9%
Final simplification46.3%
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 94.3%
Taylor expanded in x around inf 46.6%
associate-*r/45.3%
Simplified45.3%
Final simplification45.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 2023308
(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))