
(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}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (* x y) (* z t)))) (if (<= t_1 (- INFINITY)) (fma x (/ y a) (/ (- z) (/ a t))) (/ t_1 a))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(x, (y / a), (-z / (a / t)));
} else {
tmp = t_1 / a;
}
return tmp;
}
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(x, Float64(y / a), Float64(Float64(-z) / Float64(a / t))); else tmp = Float64(t_1 / a); end return tmp end
NOTE: x and y 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[(x * N[(y / a), $MachinePrecision] + N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{a}, \frac{-z}{\frac{a}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 73.6%
div-sub67.8%
*-un-lft-identity67.8%
times-frac75.6%
fma-neg75.6%
associate-/l*91.2%
Applied egg-rr91.2%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 97.6%
Final simplification96.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -1e+35)
(/ y (/ a x))
(if (<= (* x y) 5e-81)
(/ (* z (- t)) a)
(if (<= (* x y) 6.6e-23)
(/ (* x y) a)
(if (<= (* x y) 500000000000.0)
(/ (- t) (/ a z))
(if (<= (* x y) 1e+32)
(* (* x y) (/ 1.0 a))
(if (<= (* x y) 5e+93) (/ (- z) (/ a t)) (* x (/ y a)))))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e+35) {
tmp = y / (a / x);
} else if ((x * y) <= 5e-81) {
tmp = (z * -t) / a;
} else if ((x * y) <= 6.6e-23) {
tmp = (x * y) / a;
} else if ((x * y) <= 500000000000.0) {
tmp = -t / (a / z);
} else if ((x * y) <= 1e+32) {
tmp = (x * y) * (1.0 / a);
} else if ((x * y) <= 5e+93) {
tmp = -z / (a / t);
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x and y 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) <= (-1d+35)) then
tmp = y / (a / x)
else if ((x * y) <= 5d-81) then
tmp = (z * -t) / a
else if ((x * y) <= 6.6d-23) then
tmp = (x * y) / a
else if ((x * y) <= 500000000000.0d0) then
tmp = -t / (a / z)
else if ((x * y) <= 1d+32) then
tmp = (x * y) * (1.0d0 / a)
else if ((x * y) <= 5d+93) then
tmp = -z / (a / t)
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e+35) {
tmp = y / (a / x);
} else if ((x * y) <= 5e-81) {
tmp = (z * -t) / a;
} else if ((x * y) <= 6.6e-23) {
tmp = (x * y) / a;
} else if ((x * y) <= 500000000000.0) {
tmp = -t / (a / z);
} else if ((x * y) <= 1e+32) {
tmp = (x * y) * (1.0 / a);
} else if ((x * y) <= 5e+93) {
tmp = -z / (a / t);
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -1e+35: tmp = y / (a / x) elif (x * y) <= 5e-81: tmp = (z * -t) / a elif (x * y) <= 6.6e-23: tmp = (x * y) / a elif (x * y) <= 500000000000.0: tmp = -t / (a / z) elif (x * y) <= 1e+32: tmp = (x * y) * (1.0 / a) elif (x * y) <= 5e+93: tmp = -z / (a / t) else: tmp = x * (y / a) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -1e+35) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= 5e-81) tmp = Float64(Float64(z * Float64(-t)) / a); elseif (Float64(x * y) <= 6.6e-23) tmp = Float64(Float64(x * y) / a); elseif (Float64(x * y) <= 500000000000.0) tmp = Float64(Float64(-t) / Float64(a / z)); elseif (Float64(x * y) <= 1e+32) tmp = Float64(Float64(x * y) * Float64(1.0 / a)); elseif (Float64(x * y) <= 5e+93) tmp = Float64(Float64(-z) / Float64(a / t)); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -1e+35)
tmp = y / (a / x);
elseif ((x * y) <= 5e-81)
tmp = (z * -t) / a;
elseif ((x * y) <= 6.6e-23)
tmp = (x * y) / a;
elseif ((x * y) <= 500000000000.0)
tmp = -t / (a / z);
elseif ((x * y) <= 1e+32)
tmp = (x * y) * (1.0 / a);
elseif ((x * y) <= 5e+93)
tmp = -z / (a / t);
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+35], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-81], N[(N[(z * (-t)), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 6.6e-23], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 500000000000.0], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+32], N[(N[(x * y), $MachinePrecision] * N[(1.0 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+93], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+35}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-81}:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\
\mathbf{elif}\;x \cdot y \leq 6.6 \cdot 10^{-23}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 500000000000:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{elif}\;x \cdot y \leq 10^{+32}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+93}:\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -9.9999999999999997e34Initial program 89.3%
Taylor expanded in x around inf 76.4%
associate-/l*80.8%
Simplified80.8%
if -9.9999999999999997e34 < (*.f64 x y) < 4.99999999999999981e-81Initial program 98.2%
Taylor expanded in x around 0 81.9%
associate-*r/81.9%
associate-*r*81.9%
neg-mul-181.9%
Simplified81.9%
if 4.99999999999999981e-81 < (*.f64 x y) < 6.60000000000000041e-23Initial program 99.7%
Taylor expanded in x around inf 80.3%
if 6.60000000000000041e-23 < (*.f64 x y) < 5e11Initial program 91.9%
Taylor expanded in x around 0 65.7%
associate-*r/65.7%
associate-*r*65.7%
neg-mul-165.7%
Simplified65.7%
associate-/l*73.7%
distribute-frac-neg73.7%
Applied egg-rr73.7%
if 5e11 < (*.f64 x y) < 1.00000000000000005e32Initial program 99.4%
Taylor expanded in x around inf 99.4%
clear-num99.1%
associate-/r/99.7%
*-commutative99.7%
Applied egg-rr99.7%
if 1.00000000000000005e32 < (*.f64 x y) < 5.0000000000000001e93Initial program 87.8%
div-inv88.2%
fma-neg88.2%
*-commutative88.2%
distribute-rgt-neg-in88.2%
Applied egg-rr88.2%
Taylor expanded in x around 0 87.8%
associate-*l/75.3%
+-commutative75.3%
mul-1-neg75.3%
associate-*r/87.3%
distribute-lft-neg-in87.3%
cancel-sign-sub-inv87.3%
associate-*l/99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 87.8%
mul-1-neg87.8%
*-commutative87.8%
associate-/l*88.0%
Simplified88.0%
if 5.0000000000000001e93 < (*.f64 x y) Initial program 89.9%
Taylor expanded in x around inf 79.8%
associate-/l*89.7%
associate-/r/87.3%
Applied egg-rr87.3%
Final simplification82.6%
NOTE: x and y 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 -1.5e+267) (- (/ x (/ a y)) (/ z (/ a t))) (/ t_1 a))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -1.5e+267) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) - (z * t)
if (t_1 <= (-1.5d+267)) then
tmp = (x / (a / y)) - (z / (a / t))
else
tmp = t_1 / a
end if
code = tmp
end function
assert x < y;
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 <= -1.5e+267) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= -1.5e+267: tmp = (x / (a / y)) - (z / (a / t)) else: tmp = t_1 / a return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= -1.5e+267) tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); else tmp = Float64(t_1 / a); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= -1.5e+267)
tmp = (x / (a / y)) - (z / (a / t));
else
tmp = t_1 / a;
end
tmp_2 = tmp;
end
NOTE: x and y 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, -1.5e+267], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -1.5 \cdot 10^{+267}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -1.5e267Initial program 76.8%
div-sub71.8%
associate-/l*78.7%
associate-/l*92.3%
Applied egg-rr92.3%
if -1.5e267 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 97.5%
Final simplification96.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* z t) 1e+262) (/ (- (* x y) (* z t)) a) (/ (- t) (/ a z))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= 1e+262) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = -t / (a / z);
}
return tmp;
}
NOTE: x and y 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+262) then
tmp = ((x * y) - (z * t)) / a
else
tmp = -t / (a / z)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= 1e+262) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = -t / (a / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= 1e+262: tmp = ((x * y) - (z * t)) / a else: tmp = -t / (a / z) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= 1e+262) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(Float64(-t) / Float64(a / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z * t) <= 1e+262)
tmp = ((x * y) - (z * t)) / a;
else
tmp = -t / (a / z);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * t), $MachinePrecision], 1e+262], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq 10^{+262}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\end{array}
\end{array}
if (*.f64 z t) < 1e262Initial program 96.1%
if 1e262 < (*.f64 z t) Initial program 76.2%
Taylor expanded in x around 0 76.2%
associate-*r/76.2%
associate-*r*76.2%
neg-mul-176.2%
Simplified76.2%
associate-/l*99.8%
distribute-frac-neg99.8%
Applied egg-rr99.8%
Final simplification96.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= a -11000000000000.0) (- (* y (/ x a)) (* t (/ z a))) (/ (- (* x y) (* z t)) a)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -11000000000000.0) {
tmp = (y * (x / a)) - (t * (z / a));
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
NOTE: x and y 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 <= (-11000000000000.0d0)) then
tmp = (y * (x / a)) - (t * (z / a))
else
tmp = ((x * y) - (z * t)) / a
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -11000000000000.0) {
tmp = (y * (x / a)) - (t * (z / a));
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if a <= -11000000000000.0: tmp = (y * (x / a)) - (t * (z / a)) else: tmp = ((x * y) - (z * t)) / a return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (a <= -11000000000000.0) tmp = Float64(Float64(y * Float64(x / a)) - Float64(t * Float64(z / a))); else tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (a <= -11000000000000.0)
tmp = (y * (x / a)) - (t * (z / a));
else
tmp = ((x * y) - (z * t)) / a;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[a, -11000000000000.0], N[(N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision] - N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -11000000000000:\\
\;\;\;\;y \cdot \frac{x}{a} - t \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if a < -1.1e13Initial program 86.6%
div-inv86.5%
fma-neg86.5%
*-commutative86.5%
distribute-rgt-neg-in86.5%
Applied egg-rr86.5%
Taylor expanded in x around 0 86.6%
associate-*l/93.2%
+-commutative93.2%
mul-1-neg93.2%
associate-*r/93.2%
distribute-lft-neg-in93.2%
cancel-sign-sub-inv93.2%
associate-*l/86.6%
associate-*r/95.4%
Simplified95.4%
if -1.1e13 < a Initial program 96.9%
Final simplification96.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= z -31500000000000.0) (not (<= z 6e-127))) (/ (- t) (/ a z)) (/ y (/ a x))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -31500000000000.0) || !(z <= 6e-127)) {
tmp = -t / (a / z);
} else {
tmp = y / (a / x);
}
return tmp;
}
NOTE: x and y 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 <= (-31500000000000.0d0)) .or. (.not. (z <= 6d-127))) then
tmp = -t / (a / z)
else
tmp = y / (a / x)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -31500000000000.0) || !(z <= 6e-127)) {
tmp = -t / (a / z);
} else {
tmp = y / (a / x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (z <= -31500000000000.0) or not (z <= 6e-127): tmp = -t / (a / z) else: tmp = y / (a / x) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if ((z <= -31500000000000.0) || !(z <= 6e-127)) tmp = Float64(Float64(-t) / Float64(a / z)); else tmp = Float64(y / Float64(a / x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z <= -31500000000000.0) || ~((z <= 6e-127)))
tmp = -t / (a / z);
else
tmp = y / (a / x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -31500000000000.0], N[Not[LessEqual[z, 6e-127]], $MachinePrecision]], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -31500000000000 \lor \neg \left(z \leq 6 \cdot 10^{-127}\right):\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if z < -3.15e13 or 6.00000000000000017e-127 < z Initial program 92.9%
Taylor expanded in x around 0 64.2%
associate-*r/64.2%
associate-*r*64.2%
neg-mul-164.2%
Simplified64.2%
associate-/l*64.0%
distribute-frac-neg64.0%
Applied egg-rr64.0%
if -3.15e13 < z < 6.00000000000000017e-127Initial program 96.7%
Taylor expanded in x around inf 74.6%
associate-/l*72.5%
Simplified72.5%
Final simplification67.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -5.2e+16) (/ (- t) (/ a z)) (if (<= z 6e-127) (/ y (/ a x)) (* (/ z a) (- t)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.2e+16) {
tmp = -t / (a / z);
} else if (z <= 6e-127) {
tmp = y / (a / x);
} else {
tmp = (z / a) * -t;
}
return tmp;
}
NOTE: x and y 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 <= (-5.2d+16)) then
tmp = -t / (a / z)
else if (z <= 6d-127) then
tmp = y / (a / x)
else
tmp = (z / a) * -t
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.2e+16) {
tmp = -t / (a / z);
} else if (z <= 6e-127) {
tmp = y / (a / x);
} else {
tmp = (z / a) * -t;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -5.2e+16: tmp = -t / (a / z) elif z <= 6e-127: tmp = y / (a / x) else: tmp = (z / a) * -t return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.2e+16) tmp = Float64(Float64(-t) / Float64(a / z)); elseif (z <= 6e-127) tmp = Float64(y / Float64(a / x)); else tmp = Float64(Float64(z / a) * Float64(-t)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -5.2e+16)
tmp = -t / (a / z);
elseif (z <= 6e-127)
tmp = y / (a / x);
else
tmp = (z / a) * -t;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.2e+16], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e-127], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * (-t)), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+16}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-127}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{a} \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -5.2e16Initial program 95.3%
Taylor expanded in x around 0 70.4%
associate-*r/70.4%
associate-*r*70.4%
neg-mul-170.4%
Simplified70.4%
associate-/l*68.5%
distribute-frac-neg68.5%
Applied egg-rr68.5%
if -5.2e16 < z < 6.00000000000000017e-127Initial program 96.7%
Taylor expanded in x around inf 74.6%
associate-/l*72.5%
Simplified72.5%
if 6.00000000000000017e-127 < z Initial program 91.4%
Taylor expanded in x around 0 60.3%
associate-*r/60.3%
mul-1-neg60.3%
distribute-rgt-neg-out60.3%
*-commutative60.3%
associate-/l*61.9%
associate-/r/61.3%
Simplified61.3%
Final simplification67.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= z -1.48e+26) (/ (* z (- t)) a) (if (<= z 4.2e-127) (/ y (/ a x)) (* (/ z a) (- t)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.48e+26) {
tmp = (z * -t) / a;
} else if (z <= 4.2e-127) {
tmp = y / (a / x);
} else {
tmp = (z / a) * -t;
}
return tmp;
}
NOTE: x and y 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 <= (-1.48d+26)) then
tmp = (z * -t) / a
else if (z <= 4.2d-127) then
tmp = y / (a / x)
else
tmp = (z / a) * -t
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.48e+26) {
tmp = (z * -t) / a;
} else if (z <= 4.2e-127) {
tmp = y / (a / x);
} else {
tmp = (z / a) * -t;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -1.48e+26: tmp = (z * -t) / a elif z <= 4.2e-127: tmp = y / (a / x) else: tmp = (z / a) * -t return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.48e+26) tmp = Float64(Float64(z * Float64(-t)) / a); elseif (z <= 4.2e-127) tmp = Float64(y / Float64(a / x)); else tmp = Float64(Float64(z / a) * Float64(-t)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -1.48e+26)
tmp = (z * -t) / a;
elseif (z <= 4.2e-127)
tmp = y / (a / x);
else
tmp = (z / a) * -t;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.48e+26], N[(N[(z * (-t)), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 4.2e-127], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * (-t)), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.48 \cdot 10^{+26}:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-127}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{a} \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1.48e26Initial program 95.1%
Taylor expanded in x around 0 72.2%
associate-*r/72.2%
associate-*r*72.2%
neg-mul-172.2%
Simplified72.2%
if -1.48e26 < z < 4.2000000000000002e-127Initial program 96.8%
Taylor expanded in x around inf 74.5%
associate-/l*72.4%
Simplified72.4%
if 4.2000000000000002e-127 < z Initial program 91.4%
Taylor expanded in x around 0 60.3%
associate-*r/60.3%
mul-1-neg60.3%
distribute-rgt-neg-out60.3%
*-commutative60.3%
associate-/l*61.9%
associate-/r/61.3%
Simplified61.3%
Final simplification68.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* y (/ x a)))
assert(x < y);
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.
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;
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return y * (x / a)
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
x, y = num2cell(sort([x, y])){:}
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. code[x_, y_, z_, t_, a_] := N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 94.3%
Taylor expanded in x around inf 49.0%
associate-*r/50.5%
Simplified50.5%
Final simplification50.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (/ y (/ a x)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return y / (a / x);
}
NOTE: x and y 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 / (a / x)
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
return y / (a / x);
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return y / (a / x)
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(y / Float64(a / x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = y / (a / x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{\frac{a}{x}}
\end{array}
Initial program 94.3%
Taylor expanded in x around inf 49.0%
associate-/l*50.4%
Simplified50.4%
Final simplification50.4%
(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 2023230
(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))