
(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 10 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) (* t z))))
(if (<= t_1 -1e+301)
(- (* x (/ y a)) (* (/ t a) z))
(if (<= t_1 5e+305) (/ t_1 a) (/ (* x (- y (* t (/ z x)))) a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (t * z);
double tmp;
if (t_1 <= -1e+301) {
tmp = (x * (y / a)) - ((t / a) * z);
} else if (t_1 <= 5e+305) {
tmp = t_1 / a;
} else {
tmp = (x * (y - (t * (z / x)))) / 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) - (t * z)
if (t_1 <= (-1d+301)) then
tmp = (x * (y / a)) - ((t / a) * z)
else if (t_1 <= 5d+305) then
tmp = t_1 / a
else
tmp = (x * (y - (t * (z / x)))) / 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) - (t * z);
double tmp;
if (t_1 <= -1e+301) {
tmp = (x * (y / a)) - ((t / a) * z);
} else if (t_1 <= 5e+305) {
tmp = t_1 / a;
} else {
tmp = (x * (y - (t * (z / x)))) / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x * y) - (t * z) tmp = 0 if t_1 <= -1e+301: tmp = (x * (y / a)) - ((t / a) * z) elif t_1 <= 5e+305: tmp = t_1 / a else: tmp = (x * (y - (t * (z / x)))) / a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(t * z)) tmp = 0.0 if (t_1 <= -1e+301) tmp = Float64(Float64(x * Float64(y / a)) - Float64(Float64(t / a) * z)); elseif (t_1 <= 5e+305) tmp = Float64(t_1 / a); else tmp = Float64(Float64(x * Float64(y - Float64(t * Float64(z / x)))) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x * y) - (t * z); tmp = 0.0; if (t_1 <= -1e+301) tmp = (x * (y / a)) - ((t / a) * z); elseif (t_1 <= 5e+305) tmp = t_1 / a; else tmp = (x * (y - (t * (z / x)))) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+301], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+305], N[(t$95$1 / a), $MachinePrecision], N[(N[(x * N[(y - N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y - t \cdot z\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+301}:\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{a} \cdot z\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y - t \cdot \frac{z}{x}\right)}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -1.00000000000000005e301Initial program 61.5%
div-sub52.7%
associate-/l*79.9%
associate-/l*91.1%
Applied egg-rr91.1%
if -1.00000000000000005e301 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.00000000000000009e305Initial program 99.4%
if 5.00000000000000009e305 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 66.2%
Taylor expanded in x around inf 74.4%
mul-1-neg74.4%
unsub-neg74.4%
associate-/l*79.8%
Simplified79.8%
Final simplification95.5%
(FPCore (x y z t a) :precision binary64 (if (<= (* x y) (- INFINITY)) (* y (- (/ x a) (* (/ t a) (/ z y)))) (/ (fma x y (* t (- z))) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = y * ((x / a) - ((t / a) * (z / y)));
} else {
tmp = fma(x, y, (t * -z)) / a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(y * Float64(Float64(x / a) - Float64(Float64(t / a) * Float64(z / y)))); else tmp = Float64(fma(x, y, Float64(t * Float64(-z))) / a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(y * N[(N[(x / a), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(t * (-z)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - \frac{t}{a} \cdot \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right)}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 35.2%
Taylor expanded in y around inf 77.1%
+-commutative77.1%
mul-1-neg77.1%
unsub-neg77.1%
times-frac95.3%
Simplified95.3%
if -inf.0 < (*.f64 x y) Initial program 94.7%
div-sub91.3%
*-commutative91.3%
div-sub94.7%
*-commutative94.7%
fmm-def95.1%
distribute-rgt-neg-out95.1%
Simplified95.1%
Final simplification95.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= (* x y) -5e-40) (not (<= (* x y) 2e-20))) (* y (/ x a)) (/ (* t z) (- a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) <= -5e-40) || !((x * y) <= 2e-20)) {
tmp = y * (x / a);
} else {
tmp = (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) :: tmp
if (((x * y) <= (-5d-40)) .or. (.not. ((x * y) <= 2d-20))) then
tmp = y * (x / a)
else
tmp = (t * z) / -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) <= -5e-40) || !((x * y) <= 2e-20)) {
tmp = y * (x / a);
} else {
tmp = (t * z) / -a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((x * y) <= -5e-40) or not ((x * y) <= 2e-20): tmp = y * (x / a) else: tmp = (t * z) / -a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(x * y) <= -5e-40) || !(Float64(x * y) <= 2e-20)) tmp = Float64(y * Float64(x / a)); else tmp = Float64(Float64(t * z) / Float64(-a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((x * y) <= -5e-40) || ~(((x * y) <= 2e-20))) tmp = y * (x / a); else tmp = (t * z) / -a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -5e-40], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e-20]], $MachinePrecision]], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(N[(t * z), $MachinePrecision] / (-a)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-40} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{-20}\right):\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot z}{-a}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999965e-40 or 1.99999999999999989e-20 < (*.f64 x y) Initial program 85.1%
Taylor expanded in y around inf 78.7%
+-commutative78.7%
mul-1-neg78.7%
unsub-neg78.7%
times-frac75.4%
Simplified75.4%
Taylor expanded in x around inf 65.1%
if -4.99999999999999965e-40 < (*.f64 x y) < 1.99999999999999989e-20Initial program 95.1%
Taylor expanded in x around 0 80.7%
mul-1-neg80.7%
*-commutative80.7%
distribute-rgt-neg-in80.7%
Simplified80.7%
Final simplification72.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= (* x y) -2e+90) (not (<= (* x y) 2e-20))) (* y (/ x a)) (* (/ t a) (- z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) <= -2e+90) || !((x * y) <= 2e-20)) {
tmp = y * (x / 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 (((x * y) <= (-2d+90)) .or. (.not. ((x * y) <= 2d-20))) then
tmp = y * (x / 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 (((x * y) <= -2e+90) || !((x * y) <= 2e-20)) {
tmp = y * (x / a);
} else {
tmp = (t / a) * -z;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((x * y) <= -2e+90) or not ((x * y) <= 2e-20): tmp = y * (x / a) else: tmp = (t / a) * -z return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(x * y) <= -2e+90) || !(Float64(x * y) <= 2e-20)) tmp = Float64(y * Float64(x / a)); else tmp = Float64(Float64(t / a) * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((x * y) <= -2e+90) || ~(((x * y) <= 2e-20))) tmp = y * (x / a); else tmp = (t / a) * -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2e+90], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e-20]], $MachinePrecision]], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+90} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{-20}\right):\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot \left(-z\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999993e90 or 1.99999999999999989e-20 < (*.f64 x y) Initial program 82.0%
Taylor expanded in y around inf 82.4%
+-commutative82.4%
mul-1-neg82.4%
unsub-neg82.4%
times-frac79.7%
Simplified79.7%
Taylor expanded in x around inf 75.2%
if -1.99999999999999993e90 < (*.f64 x y) < 1.99999999999999989e-20Initial program 95.0%
Taylor expanded in x around 0 72.6%
mul-1-neg72.6%
*-commutative72.6%
associate-*r/73.6%
distribute-rgt-neg-in73.6%
distribute-frac-neg73.6%
Simplified73.6%
Final simplification74.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= (* x y) -5e-40) (not (<= (* x y) 2e-20))) (* y (/ x a)) (* t (/ z (- a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) <= -5e-40) || !((x * y) <= 2e-20)) {
tmp = y * (x / a);
} else {
tmp = 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) :: tmp
if (((x * y) <= (-5d-40)) .or. (.not. ((x * y) <= 2d-20))) then
tmp = y * (x / a)
else
tmp = t * (z / -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) <= -5e-40) || !((x * y) <= 2e-20)) {
tmp = y * (x / a);
} else {
tmp = t * (z / -a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((x * y) <= -5e-40) or not ((x * y) <= 2e-20): tmp = y * (x / a) else: tmp = t * (z / -a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(x * y) <= -5e-40) || !(Float64(x * y) <= 2e-20)) tmp = Float64(y * Float64(x / a)); else tmp = Float64(t * Float64(z / Float64(-a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((x * y) <= -5e-40) || ~(((x * y) <= 2e-20))) tmp = y * (x / a); else tmp = t * (z / -a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -5e-40], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e-20]], $MachinePrecision]], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(t * N[(z / (-a)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-40} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{-20}\right):\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999965e-40 or 1.99999999999999989e-20 < (*.f64 x y) Initial program 85.1%
Taylor expanded in y around inf 78.7%
+-commutative78.7%
mul-1-neg78.7%
unsub-neg78.7%
times-frac75.4%
Simplified75.4%
Taylor expanded in x around inf 65.1%
if -4.99999999999999965e-40 < (*.f64 x y) < 1.99999999999999989e-20Initial program 95.1%
Taylor expanded in x around 0 80.7%
mul-1-neg80.7%
associate-/l*76.9%
distribute-rgt-neg-in76.9%
distribute-neg-frac276.9%
Simplified76.9%
Final simplification70.4%
(FPCore (x y z t a) :precision binary64 (if (<= (* x y) (- INFINITY)) (* y (- (/ x a) (* (/ t a) (/ z y)))) (/ (- (* x y) (* t z)) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = y * ((x / a) - ((t / a) * (z / y)));
} else {
tmp = ((x * y) - (t * z)) / a;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = y * ((x / a) - ((t / a) * (z / y)));
} else {
tmp = ((x * y) - (t * z)) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x * y) <= -math.inf: tmp = y * ((x / a) - ((t / a) * (z / y))) else: tmp = ((x * y) - (t * z)) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(y * Float64(Float64(x / a) - Float64(Float64(t / a) * Float64(z / y)))); else tmp = Float64(Float64(Float64(x * y) - Float64(t * z)) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x * y) <= -Inf) tmp = y * ((x / a) - ((t / a) * (z / y))); else tmp = ((x * y) - (t * z)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(y * N[(N[(x / a), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - \frac{t}{a} \cdot \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - t \cdot z}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 35.2%
Taylor expanded in y around inf 77.1%
+-commutative77.1%
mul-1-neg77.1%
unsub-neg77.1%
times-frac95.3%
Simplified95.3%
if -inf.0 < (*.f64 x y) Initial program 94.7%
Final simplification94.7%
(FPCore (x y z t a) :precision binary64 (if (<= (* x y) (- INFINITY)) (* y (/ x a)) (/ (- (* x y) (* t z)) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = y * (x / a);
} else {
tmp = ((x * y) - (t * z)) / a;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = y * (x / a);
} else {
tmp = ((x * y) - (t * z)) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x * y) <= -math.inf: tmp = y * (x / a) else: tmp = ((x * y) - (t * z)) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(y * Float64(x / a)); else tmp = Float64(Float64(Float64(x * y) - Float64(t * z)) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x * y) <= -Inf) tmp = y * (x / a); else tmp = ((x * y) - (t * z)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - t \cdot z}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 35.2%
Taylor expanded in y around inf 77.1%
+-commutative77.1%
mul-1-neg77.1%
unsub-neg77.1%
times-frac95.3%
Simplified95.3%
Taylor expanded in x around inf 84.7%
if -inf.0 < (*.f64 x y) Initial program 94.7%
Final simplification93.8%
(FPCore (x y z t a) :precision binary64 (if (<= x -8.2e+106) (* y (/ x a)) (/ (* x y) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8.2e+106) {
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 <= (-8.2d+106)) 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 <= -8.2e+106) {
tmp = y * (x / a);
} else {
tmp = (x * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -8.2e+106: tmp = y * (x / a) else: tmp = (x * y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -8.2e+106) 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 <= -8.2e+106) tmp = y * (x / a); else tmp = (x * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -8.2e+106], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{+106}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if x < -8.2000000000000005e106Initial program 80.6%
Taylor expanded in y around inf 80.0%
+-commutative80.0%
mul-1-neg80.0%
unsub-neg80.0%
times-frac77.5%
Simplified77.5%
Taylor expanded in x around inf 77.0%
if -8.2000000000000005e106 < x Initial program 91.2%
Taylor expanded in x around inf 46.5%
(FPCore (x y z t a) :precision binary64 (* y (/ x a)))
double code(double x, double y, double z, double t, double a) {
return y * (x / 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 = y * (x / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
def code(x, y, z, t, a): return y * (x / a)
function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
function tmp = code(x, y, z, t, a) tmp = y * (x / a); end
code[x_, y_, z_, t_, a_] := N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 89.6%
Taylor expanded in y around inf 78.2%
+-commutative78.2%
mul-1-neg78.2%
unsub-neg78.2%
times-frac77.0%
Simplified77.0%
Taylor expanded in x around inf 49.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.6%
Taylor expanded in x around inf 48.7%
associate-*r/51.7%
Simplified51.7%
(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 2024163
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(! :herbie-platform default (if (< z -246868496869954800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6309831121978371/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z)))))
(/ (- (* x y) (* z t)) a))