
(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 11 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}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (<= t_1 -1e+298)
(- (* x (/ y a)) (* z (/ t a)))
(if (<= t_1 1e+288)
(/ (fma x y (* z (- t))) a)
(fma y (/ x a) (* z (/ t (- a))))))))
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+298) {
tmp = (x * (y / a)) - (z * (t / a));
} else if (t_1 <= 1e+288) {
tmp = fma(x, y, (z * -t)) / a;
} else {
tmp = fma(y, (x / a), (z * (t / -a)));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= -1e+298) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); elseif (t_1 <= 1e+288) tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a); else tmp = fma(y, Float64(x / a), Float64(z * Float64(t / Float64(-a)))); end return tmp end
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, -1e+298], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+288], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision] + N[(z * N[(t / (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+298}:\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{+288}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{a}, z \cdot \frac{t}{-a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -9.9999999999999996e297Initial program 65.8%
div-sub62.8%
associate-/l*77.1%
associate-/l*96.8%
Applied egg-rr96.8%
if -9.9999999999999996e297 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288Initial program 98.1%
div-sub97.0%
*-commutative97.0%
div-sub98.1%
*-commutative98.1%
fma-neg98.1%
distribute-rgt-neg-out98.1%
Simplified98.1%
if 1e288 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 64.8%
div-sub59.5%
*-commutative59.5%
associate-/l*64.6%
fma-neg69.8%
associate-/l*97.2%
Applied egg-rr97.2%
Final simplification97.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (<= t_1 -1e+298)
(- (* x (/ y a)) (* z (/ t a)))
(if (<= t_1 1e+288)
(/ (fma x y (* z (- t))) a)
(- (* y (/ x a)) (* t (/ z a)))))))
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+298) {
tmp = (x * (y / a)) - (z * (t / a));
} else if (t_1 <= 1e+288) {
tmp = fma(x, y, (z * -t)) / a;
} else {
tmp = (y * (x / a)) - (t * (z / a));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= -1e+298) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); elseif (t_1 <= 1e+288) tmp = Float64(fma(x, y, Float64(z * Float64(-t))) / a); else tmp = Float64(Float64(y * Float64(x / a)) - Float64(t * Float64(z / a))); end return tmp end
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, -1e+298], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+288], N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+298}:\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{+288}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -9.9999999999999996e297Initial program 65.8%
div-sub62.8%
associate-/l*77.1%
associate-/l*96.8%
Applied egg-rr96.8%
if -9.9999999999999996e297 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288Initial program 98.1%
div-sub97.0%
*-commutative97.0%
div-sub98.1%
*-commutative98.1%
fma-neg98.1%
distribute-rgt-neg-out98.1%
Simplified98.1%
if 1e288 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 64.8%
div-sub59.5%
*-un-lft-identity59.5%
add-sqr-sqrt32.2%
times-frac32.2%
fma-neg32.2%
associate-/l*42.2%
Applied egg-rr42.2%
fma-undefine42.2%
distribute-lft-neg-in42.2%
cancel-sign-sub-inv42.2%
associate-*l/42.2%
*-lft-identity42.2%
*-commutative42.2%
associate-/l*44.7%
associate-*r/34.7%
*-commutative34.7%
associate-/l*44.7%
Simplified44.7%
associate-/l*44.7%
*-commutative44.7%
associate-/l/44.7%
add-sqr-sqrt92.0%
Applied egg-rr92.0%
Final simplification97.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (or (<= t_1 -1e+298) (not (<= t_1 1e+288)))
(- (* x (/ y a)) (* z (/ t a)))
(/ t_1 a))))
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+298) || !(t_1 <= 1e+288)) {
tmp = (x * (y / a)) - (z * (t / a));
} else {
tmp = t_1 / a;
}
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 = (x * y) - (z * t)
if ((t_1 <= (-1d+298)) .or. (.not. (t_1 <= 1d+288))) then
tmp = (x * (y / a)) - (z * (t / a))
else
tmp = t_1 / a
end if
code = tmp
end function
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+298) || !(t_1 <= 1e+288)) {
tmp = (x * (y / a)) - (z * (t / a));
} else {
tmp = t_1 / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if (t_1 <= -1e+298) or not (t_1 <= 1e+288): tmp = (x * (y / a)) - (z * (t / a)) else: tmp = t_1 / a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if ((t_1 <= -1e+298) || !(t_1 <= 1e+288)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); else tmp = Float64(t_1 / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x * y) - (z * t); tmp = 0.0; if ((t_1 <= -1e+298) || ~((t_1 <= 1e+288))) tmp = (x * (y / a)) - (z * (t / a)); else tmp = t_1 / a; end tmp_2 = tmp; end
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+298], N[Not[LessEqual[t$95$1, 1e+288]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+298} \lor \neg \left(t\_1 \leq 10^{+288}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -9.9999999999999996e297 or 1e288 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 65.3%
div-sub61.0%
associate-/l*70.4%
associate-/l*94.2%
Applied egg-rr94.2%
if -9.9999999999999996e297 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288Initial program 98.1%
Final simplification97.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (<= t_1 -1e+298)
(- (* x (/ y a)) (* z (/ t a)))
(if (<= t_1 1e+288) (/ t_1 a) (- (* y (/ x a)) (* t (/ z a)))))))
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+298) {
tmp = (x * (y / a)) - (z * (t / a));
} else if (t_1 <= 1e+288) {
tmp = t_1 / a;
} else {
tmp = (y * (x / a)) - (t * (z / a));
}
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 = (x * y) - (z * t)
if (t_1 <= (-1d+298)) then
tmp = (x * (y / a)) - (z * (t / a))
else if (t_1 <= 1d+288) then
tmp = t_1 / a
else
tmp = (y * (x / a)) - (t * (z / a))
end if
code = tmp
end function
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+298) {
tmp = (x * (y / a)) - (z * (t / a));
} else if (t_1 <= 1e+288) {
tmp = t_1 / a;
} else {
tmp = (y * (x / a)) - (t * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= -1e+298: tmp = (x * (y / a)) - (z * (t / a)) elif t_1 <= 1e+288: tmp = t_1 / a else: tmp = (y * (x / a)) - (t * (z / a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= -1e+298) tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / a))); elseif (t_1 <= 1e+288) tmp = Float64(t_1 / a); else tmp = Float64(Float64(y * Float64(x / a)) - Float64(t * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x * y) - (z * t); tmp = 0.0; if (t_1 <= -1e+298) tmp = (x * (y / a)) - (z * (t / a)); elseif (t_1 <= 1e+288) tmp = t_1 / a; else tmp = (y * (x / a)) - (t * (z / a)); end tmp_2 = tmp; end
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, -1e+298], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+288], N[(t$95$1 / a), $MachinePrecision], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+298}:\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{+288}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -9.9999999999999996e297Initial program 65.8%
div-sub62.8%
associate-/l*77.1%
associate-/l*96.8%
Applied egg-rr96.8%
if -9.9999999999999996e297 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288Initial program 98.1%
if 1e288 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 64.8%
div-sub59.5%
*-un-lft-identity59.5%
add-sqr-sqrt32.2%
times-frac32.2%
fma-neg32.2%
associate-/l*42.2%
Applied egg-rr42.2%
fma-undefine42.2%
distribute-lft-neg-in42.2%
cancel-sign-sub-inv42.2%
associate-*l/42.2%
*-lft-identity42.2%
*-commutative42.2%
associate-/l*44.7%
associate-*r/34.7%
*-commutative34.7%
associate-/l*44.7%
Simplified44.7%
associate-/l*44.7%
*-commutative44.7%
associate-/l/44.7%
add-sqr-sqrt92.0%
Applied egg-rr92.0%
Final simplification97.0%
(FPCore (x y z t a) :precision binary64 (if (<= (* z t) -2e+282) (/ z (- (/ a t))) (if (<= (* z t) 1e+305) (/ (- (* x y) (* z t)) a) (/ t (/ a (- z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -2e+282) {
tmp = z / -(a / t);
} else if ((z * t) <= 1e+305) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t / (a / -z);
}
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) :: tmp
if ((z * t) <= (-2d+282)) then
tmp = z / -(a / t)
else if ((z * t) <= 1d+305) then
tmp = ((x * y) - (z * t)) / a
else
tmp = t / (a / -z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -2e+282) {
tmp = z / -(a / t);
} else if ((z * t) <= 1e+305) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t / (a / -z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z * t) <= -2e+282: tmp = z / -(a / t) elif (z * t) <= 1e+305: tmp = ((x * y) - (z * t)) / a else: tmp = t / (a / -z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= -2e+282) tmp = Float64(z / Float64(-Float64(a / t))); elseif (Float64(z * t) <= 1e+305) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(t / Float64(a / Float64(-z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z * t) <= -2e+282) tmp = z / -(a / t); elseif ((z * t) <= 1e+305) tmp = ((x * y) - (z * t)) / a; else tmp = t / (a / -z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+282], N[(z / (-N[(a / t), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+305], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(t / N[(a / (-z)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+282}:\\
\;\;\;\;\frac{z}{-\frac{a}{t}}\\
\mathbf{elif}\;z \cdot t \leq 10^{+305}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a}{-z}}\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000007e282Initial program 63.0%
div-sub56.5%
*-un-lft-identity56.5%
add-sqr-sqrt32.8%
times-frac32.8%
fma-neg32.8%
associate-/l*45.1%
Applied egg-rr45.1%
fma-undefine45.1%
distribute-lft-neg-in45.1%
cancel-sign-sub-inv45.1%
associate-*l/45.1%
*-lft-identity45.1%
*-commutative45.1%
associate-/l*45.1%
associate-*r/32.8%
*-commutative32.8%
associate-/l*45.1%
Simplified45.1%
Taylor expanded in y around 0 66.2%
mul-1-neg66.2%
associate-*r/93.7%
distribute-rgt-neg-in93.7%
distribute-neg-frac93.7%
Simplified93.7%
distribute-frac-neg93.7%
distribute-rgt-neg-in93.7%
*-commutative93.7%
associate-/r/93.6%
distribute-neg-frac293.6%
distribute-neg-frac293.6%
Applied egg-rr93.6%
if -2.00000000000000007e282 < (*.f64 z t) < 9.9999999999999994e304Initial program 95.2%
if 9.9999999999999994e304 < (*.f64 z t) Initial program 53.4%
div-sub53.4%
*-un-lft-identity53.4%
add-sqr-sqrt15.2%
times-frac15.2%
fma-neg15.2%
associate-/l*28.5%
Applied egg-rr28.5%
fma-undefine28.5%
distribute-lft-neg-in28.5%
cancel-sign-sub-inv28.5%
associate-*l/28.5%
*-lft-identity28.5%
*-commutative28.5%
associate-/l*28.5%
associate-*r/15.2%
*-commutative15.2%
associate-/l*28.5%
Simplified28.5%
Taylor expanded in y around 0 53.4%
mul-1-neg53.4%
associate-*r/99.4%
distribute-rgt-neg-in99.4%
distribute-neg-frac99.4%
Simplified99.4%
distribute-frac-neg99.4%
distribute-rgt-neg-in99.4%
distribute-lft-neg-in99.4%
clear-num99.6%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification95.2%
(FPCore (x y z t a) :precision binary64 (if (<= (* x y) -1e-11) (* y (/ x a)) (if (<= (* x y) 5e-108) (* t (/ z (- a))) (/ (* x y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e-11) {
tmp = y * (x / a);
} else if ((x * y) <= 5e-108) {
tmp = t * (z / -a);
} else {
tmp = (x * y) / a;
}
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) :: tmp
if ((x * y) <= (-1d-11)) then
tmp = y * (x / a)
else if ((x * y) <= 5d-108) then
tmp = t * (z / -a)
else
tmp = (x * y) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e-11) {
tmp = y * (x / a);
} else if ((x * y) <= 5e-108) {
tmp = t * (z / -a);
} else {
tmp = (x * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x * y) <= -1e-11: tmp = y * (x / a) elif (x * y) <= 5e-108: tmp = t * (z / -a) else: tmp = (x * y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -1e-11) tmp = Float64(y * Float64(x / a)); elseif (Float64(x * y) <= 5e-108) tmp = Float64(t * Float64(z / Float64(-a))); else tmp = Float64(Float64(x * y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x * y) <= -1e-11) tmp = y * (x / a); elseif ((x * y) <= 5e-108) tmp = t * (z / -a); else tmp = (x * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e-11], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-108], N[(t * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-11}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-108}:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999939e-12Initial program 86.6%
Taylor expanded in x around inf 73.1%
*-commutative73.1%
associate-*r/76.2%
Simplified76.2%
if -9.99999999999999939e-12 < (*.f64 x y) < 5e-108Initial program 90.3%
Taylor expanded in x around 0 80.8%
mul-1-neg80.8%
associate-/l*86.4%
distribute-rgt-neg-in86.4%
Simplified86.4%
if 5e-108 < (*.f64 x y) Initial program 89.7%
Taylor expanded in x around inf 69.2%
Final simplification78.2%
(FPCore (x y z t a) :precision binary64 (if (<= (* x y) -1e-11) (* y (/ x a)) (if (<= (* x y) 5e-108) (/ t (/ a (- z))) (/ (* x y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e-11) {
tmp = y * (x / a);
} else if ((x * y) <= 5e-108) {
tmp = t / (a / -z);
} else {
tmp = (x * y) / a;
}
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) :: tmp
if ((x * y) <= (-1d-11)) then
tmp = y * (x / a)
else if ((x * y) <= 5d-108) then
tmp = t / (a / -z)
else
tmp = (x * y) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e-11) {
tmp = y * (x / a);
} else if ((x * y) <= 5e-108) {
tmp = t / (a / -z);
} else {
tmp = (x * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x * y) <= -1e-11: tmp = y * (x / a) elif (x * y) <= 5e-108: tmp = t / (a / -z) else: tmp = (x * y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -1e-11) tmp = Float64(y * Float64(x / a)); elseif (Float64(x * y) <= 5e-108) tmp = Float64(t / Float64(a / Float64(-z))); else tmp = Float64(Float64(x * y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x * y) <= -1e-11) tmp = y * (x / a); elseif ((x * y) <= 5e-108) tmp = t / (a / -z); else tmp = (x * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e-11], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-108], N[(t / N[(a / (-z)), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-11}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-108}:\\
\;\;\;\;\frac{t}{\frac{a}{-z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999939e-12Initial program 86.6%
Taylor expanded in x around inf 73.1%
*-commutative73.1%
associate-*r/76.2%
Simplified76.2%
if -9.99999999999999939e-12 < (*.f64 x y) < 5e-108Initial program 90.3%
div-sub90.3%
*-un-lft-identity90.3%
add-sqr-sqrt47.5%
times-frac47.5%
fma-neg47.5%
associate-/l*43.1%
Applied egg-rr43.1%
fma-undefine43.1%
distribute-lft-neg-in43.1%
cancel-sign-sub-inv43.1%
associate-*l/43.1%
*-lft-identity43.1%
*-commutative43.1%
associate-/l*44.1%
associate-*r/48.4%
*-commutative48.4%
associate-/l*49.4%
Simplified49.4%
Taylor expanded in y around 0 80.8%
mul-1-neg80.8%
associate-*r/86.4%
distribute-rgt-neg-in86.4%
distribute-neg-frac86.4%
Simplified86.4%
distribute-frac-neg86.4%
distribute-rgt-neg-in86.4%
distribute-lft-neg-in86.4%
clear-num86.5%
un-div-inv86.6%
Applied egg-rr86.6%
if 5e-108 < (*.f64 x y) Initial program 89.7%
Taylor expanded in x around inf 69.2%
Final simplification78.2%
(FPCore (x y z t a) :precision binary64 (if (<= x -3.8e-115) (* y (/ x a)) (* x (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -3.8e-115) {
tmp = y * (x / a);
} else {
tmp = x * (y / a);
}
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) :: tmp
if (x <= (-3.8d-115)) then
tmp = y * (x / a)
else
tmp = x * (y / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -3.8e-115) {
tmp = y * (x / a);
} else {
tmp = x * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -3.8e-115: tmp = y * (x / a) else: tmp = x * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -3.8e-115) tmp = Float64(y * Float64(x / a)); else tmp = Float64(x * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -3.8e-115) tmp = y * (x / a); else tmp = x * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -3.8e-115], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-115}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if x < -3.79999999999999992e-115Initial program 88.2%
Taylor expanded in x around inf 61.4%
*-commutative61.4%
associate-*r/68.3%
Simplified68.3%
if -3.79999999999999992e-115 < x Initial program 89.4%
Taylor expanded in x around inf 47.2%
associate-*r/45.1%
Simplified45.1%
Final simplification52.6%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.75e-245) (* y (/ x a)) (/ x (/ a y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.75e-245) {
tmp = y * (x / a);
} else {
tmp = x / (a / y);
}
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) :: tmp
if (x <= (-1.75d-245)) then
tmp = y * (x / a)
else
tmp = x / (a / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.75e-245) {
tmp = y * (x / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.75e-245: tmp = y * (x / a) else: tmp = x / (a / y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.75e-245) tmp = Float64(y * Float64(x / a)); else tmp = Float64(x / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.75e-245) tmp = y * (x / a); else tmp = x / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.75e-245], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-245}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if x < -1.75000000000000008e-245Initial program 88.3%
Taylor expanded in x around inf 51.5%
*-commutative51.5%
associate-*r/54.8%
Simplified54.8%
if -1.75000000000000008e-245 < x Initial program 89.6%
Taylor expanded in x around inf 52.0%
associate-*r/49.5%
Simplified49.5%
clear-num48.8%
un-div-inv48.6%
Applied egg-rr48.6%
Final simplification51.4%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.35e-127) (* y (/ x a)) (/ (* x y) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.35e-127) {
tmp = y * (x / a);
} else {
tmp = (x * y) / a;
}
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) :: tmp
if (x <= (-1.35d-127)) then
tmp = y * (x / a)
else
tmp = (x * y) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.35e-127) {
tmp = y * (x / a);
} else {
tmp = (x * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.35e-127: tmp = y * (x / a) else: tmp = (x * y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.35e-127) tmp = Float64(y * Float64(x / a)); else tmp = Float64(Float64(x * y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.35e-127) tmp = y * (x / a); else tmp = (x * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.35e-127], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-127}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if x < -1.35e-127Initial program 88.9%
Taylor expanded in x around inf 59.2%
*-commutative59.2%
associate-*r/65.7%
Simplified65.7%
if -1.35e-127 < x Initial program 89.1%
Taylor expanded in x around inf 47.9%
Final simplification54.0%
(FPCore (x y z t a) :precision binary64 (* x (/ y a)))
double code(double x, double y, double z, double t, double a) {
return x * (y / 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 / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
def code(x, y, z, t, a): return x * (y / a)
function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
function tmp = code(x, y, z, t, a) tmp = x * (y / a); end
code[x_, y_, z_, t_, a_] := N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 89.0%
Taylor expanded in x around inf 51.8%
associate-*r/51.5%
Simplified51.5%
Final simplification51.5%
(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 2024043
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(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))