
(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 9 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 (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+304)))
(- (/ 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 <= -((double) INFINITY)) || !(t_1 <= 5e+304)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
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 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e+304)) {
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 <= -math.inf) or not (t_1 <= 5e+304): 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 <= Float64(-Inf)) || !(t_1 <= 5e+304)) 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 <= -Inf) || ~((t_1 <= 5e+304)))
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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+304]], $MachinePrecision]], 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 -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{+304}\right):\\
\;\;\;\;\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)) < -inf.0 or 4.9999999999999997e304 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 67.7%
div-sub60.4%
associate-/l*75.5%
associate-/l*90.8%
Applied egg-rr90.8%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.9999999999999997e304Initial program 98.8%
Final simplification97.1%
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+15) (* y (/ x a)) (if (<= (* x y) 2e-20) (/ (- z) (/ a t)) (* x (* y (/ 1.0 a))))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e+15) {
tmp = y * (x / a);
} else if ((x * y) <= 2e-20) {
tmp = -z / (a / t);
} else {
tmp = x * (y * (1.0 / 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+15)) then
tmp = y * (x / a)
else if ((x * y) <= 2d-20) then
tmp = -z / (a / t)
else
tmp = x * (y * (1.0d0 / 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+15) {
tmp = y * (x / a);
} else if ((x * y) <= 2e-20) {
tmp = -z / (a / t);
} else {
tmp = x * (y * (1.0 / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -1e+15: tmp = y * (x / a) elif (x * y) <= 2e-20: tmp = -z / (a / t) else: tmp = x * (y * (1.0 / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -1e+15) tmp = Float64(y * Float64(x / a)); elseif (Float64(x * y) <= 2e-20) tmp = Float64(Float64(-z) / Float64(a / t)); else tmp = Float64(x * Float64(y * Float64(1.0 / 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+15)
tmp = y * (x / a);
elseif ((x * y) <= 2e-20)
tmp = -z / (a / t);
else
tmp = x * (y * (1.0 / 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+15], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-20], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+15}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-20}:\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{1}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1e15Initial program 91.7%
Taylor expanded in x around inf 70.0%
associate-*r/71.8%
Simplified71.8%
if -1e15 < (*.f64 x y) < 1.99999999999999989e-20Initial program 93.3%
Taylor expanded in x around 0 74.1%
associate-*r/74.1%
mul-1-neg74.1%
distribute-rgt-neg-out74.1%
*-commutative74.1%
associate-/l*76.8%
associate-/r/75.5%
Simplified75.5%
*-commutative75.5%
frac-2neg75.5%
remove-double-neg75.5%
associate-*r/74.1%
Applied egg-rr74.1%
associate-/l*75.9%
associate-/r/76.8%
Simplified76.8%
*-commutative76.8%
frac-2neg76.8%
remove-double-neg76.8%
distribute-frac-neg76.8%
distribute-rgt-neg-in76.8%
*-commutative76.8%
clear-num76.7%
associate-/r/76.5%
clear-num76.8%
distribute-neg-frac76.8%
Applied egg-rr76.8%
if 1.99999999999999989e-20 < (*.f64 x y) Initial program 89.6%
Taylor expanded in x around inf 74.7%
associate-/l*77.2%
Simplified77.2%
associate-/l*74.7%
associate-*r/77.4%
*-commutative77.4%
div-inv77.4%
associate-*l*81.7%
Applied egg-rr81.7%
Final simplification77.1%
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 (* t (/ (- z) a))))
(if (<= y -4.6e-119)
(* x (/ y a))
(if (<= y 1.1e-43)
t_1
(if (<= y 29000000000000.0)
(/ (* x y) a)
(if (<= y 5.8e+138) t_1 (/ x (/ a y))))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (-z / a);
double tmp;
if (y <= -4.6e-119) {
tmp = x * (y / a);
} else if (y <= 1.1e-43) {
tmp = t_1;
} else if (y <= 29000000000000.0) {
tmp = (x * y) / a;
} else if (y <= 5.8e+138) {
tmp = t_1;
} else {
tmp = x / (a / y);
}
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 = t * (-z / a)
if (y <= (-4.6d-119)) then
tmp = x * (y / a)
else if (y <= 1.1d-43) then
tmp = t_1
else if (y <= 29000000000000.0d0) then
tmp = (x * y) / a
else if (y <= 5.8d+138) then
tmp = t_1
else
tmp = x / (a / y)
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 = t * (-z / a);
double tmp;
if (y <= -4.6e-119) {
tmp = x * (y / a);
} else if (y <= 1.1e-43) {
tmp = t_1;
} else if (y <= 29000000000000.0) {
tmp = (x * y) / a;
} else if (y <= 5.8e+138) {
tmp = t_1;
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = t * (-z / a) tmp = 0 if y <= -4.6e-119: tmp = x * (y / a) elif y <= 1.1e-43: tmp = t_1 elif y <= 29000000000000.0: tmp = (x * y) / a elif y <= 5.8e+138: tmp = t_1 else: tmp = x / (a / y) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(t * Float64(Float64(-z) / a)) tmp = 0.0 if (y <= -4.6e-119) tmp = Float64(x * Float64(y / a)); elseif (y <= 1.1e-43) tmp = t_1; elseif (y <= 29000000000000.0) tmp = Float64(Float64(x * y) / a); elseif (y <= 5.8e+138) tmp = t_1; else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = t * (-z / a);
tmp = 0.0;
if (y <= -4.6e-119)
tmp = x * (y / a);
elseif (y <= 1.1e-43)
tmp = t_1;
elseif (y <= 29000000000000.0)
tmp = (x * y) / a;
elseif (y <= 5.8e+138)
tmp = t_1;
else
tmp = x / (a / y);
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[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.6e-119], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e-43], t$95$1, If[LessEqual[y, 29000000000000.0], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 5.8e+138], t$95$1, N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := t \cdot \frac{-z}{a}\\
\mathbf{if}\;y \leq -4.6 \cdot 10^{-119}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-43}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 29000000000000:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if y < -4.59999999999999987e-119Initial program 91.7%
Taylor expanded in x around inf 60.3%
associate-/l*60.1%
Simplified60.1%
associate-/r/62.2%
Applied egg-rr62.2%
if -4.59999999999999987e-119 < y < 1.09999999999999999e-43 or 2.9e13 < y < 5.80000000000000019e138Initial program 92.7%
div-sub91.1%
associate-/l*85.8%
associate-/l*89.7%
Applied egg-rr89.7%
Taylor expanded in x around 0 68.1%
mul-1-neg68.1%
associate-*r/71.3%
distribute-rgt-neg-in71.3%
Simplified71.3%
if 1.09999999999999999e-43 < y < 2.9e13Initial program 99.9%
Taylor expanded in x around inf 60.3%
if 5.80000000000000019e138 < y Initial program 87.9%
Taylor expanded in x around inf 62.7%
associate-*r/68.4%
Simplified68.4%
associate-*r/62.7%
*-commutative62.7%
associate-/l*74.3%
Applied egg-rr74.3%
Final simplification67.9%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= y -3.7e-118)
(* x (/ y a))
(if (<= y 0.0255)
(* z (/ t (- a)))
(if (<= y 31000000000000.0)
(/ (* x y) a)
(if (<= y 1.6e+138) (* t (/ (- z) a)) (/ x (/ a y)))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3.7e-118) {
tmp = x * (y / a);
} else if (y <= 0.0255) {
tmp = z * (t / -a);
} else if (y <= 31000000000000.0) {
tmp = (x * y) / a;
} else if (y <= 1.6e+138) {
tmp = t * (-z / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 (y <= (-3.7d-118)) then
tmp = x * (y / a)
else if (y <= 0.0255d0) then
tmp = z * (t / -a)
else if (y <= 31000000000000.0d0) then
tmp = (x * y) / a
else if (y <= 1.6d+138) then
tmp = t * (-z / a)
else
tmp = x / (a / y)
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 (y <= -3.7e-118) {
tmp = x * (y / a);
} else if (y <= 0.0255) {
tmp = z * (t / -a);
} else if (y <= 31000000000000.0) {
tmp = (x * y) / a;
} else if (y <= 1.6e+138) {
tmp = t * (-z / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if y <= -3.7e-118: tmp = x * (y / a) elif y <= 0.0255: tmp = z * (t / -a) elif y <= 31000000000000.0: tmp = (x * y) / a elif y <= 1.6e+138: tmp = t * (-z / a) else: tmp = x / (a / y) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -3.7e-118) tmp = Float64(x * Float64(y / a)); elseif (y <= 0.0255) tmp = Float64(z * Float64(t / Float64(-a))); elseif (y <= 31000000000000.0) tmp = Float64(Float64(x * y) / a); elseif (y <= 1.6e+138) tmp = Float64(t * Float64(Float64(-z) / a)); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -3.7e-118)
tmp = x * (y / a);
elseif (y <= 0.0255)
tmp = z * (t / -a);
elseif (y <= 31000000000000.0)
tmp = (x * y) / a;
elseif (y <= 1.6e+138)
tmp = t * (-z / a);
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -3.7e-118], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.0255], N[(z * N[(t / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 31000000000000.0], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 1.6e+138], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{-118}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;y \leq 0.0255:\\
\;\;\;\;z \cdot \frac{t}{-a}\\
\mathbf{elif}\;y \leq 31000000000000:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+138}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if y < -3.70000000000000014e-118Initial program 91.7%
Taylor expanded in x around inf 60.3%
associate-/l*60.1%
Simplified60.1%
associate-/r/62.2%
Applied egg-rr62.2%
if -3.70000000000000014e-118 < y < 0.0254999999999999984Initial program 92.9%
Taylor expanded in x around 0 68.7%
associate-*r/68.7%
mul-1-neg68.7%
distribute-rgt-neg-out68.7%
*-commutative68.7%
associate-/l*72.1%
associate-/r/70.5%
Simplified70.5%
*-commutative70.5%
frac-2neg70.5%
remove-double-neg70.5%
associate-*r/68.7%
Applied egg-rr68.7%
associate-/l*71.0%
associate-/r/72.2%
Simplified72.2%
if 0.0254999999999999984 < y < 3.1e13Initial program 100.0%
Taylor expanded in x around inf 75.1%
if 3.1e13 < y < 1.6000000000000001e138Initial program 94.4%
div-sub94.4%
associate-/l*89.0%
associate-/l*94.2%
Applied egg-rr94.2%
Taylor expanded in x around 0 57.3%
mul-1-neg57.3%
associate-*r/62.6%
distribute-rgt-neg-in62.6%
Simplified62.6%
if 1.6000000000000001e138 < y Initial program 87.9%
Taylor expanded in x around inf 62.7%
associate-*r/68.4%
Simplified68.4%
associate-*r/62.7%
*-commutative62.7%
associate-/l*74.3%
Applied egg-rr74.3%
Final simplification68.2%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= y -4.8e-89)
(* x (/ y a))
(if (<= y 1.1e-43)
(/ (- z) (/ a t))
(if (<= y 29000000000000.0)
(/ (* x y) a)
(if (<= y 1.95e+138) (* t (/ (- z) a)) (/ x (/ a y)))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -4.8e-89) {
tmp = x * (y / a);
} else if (y <= 1.1e-43) {
tmp = -z / (a / t);
} else if (y <= 29000000000000.0) {
tmp = (x * y) / a;
} else if (y <= 1.95e+138) {
tmp = t * (-z / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 (y <= (-4.8d-89)) then
tmp = x * (y / a)
else if (y <= 1.1d-43) then
tmp = -z / (a / t)
else if (y <= 29000000000000.0d0) then
tmp = (x * y) / a
else if (y <= 1.95d+138) then
tmp = t * (-z / a)
else
tmp = x / (a / y)
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 (y <= -4.8e-89) {
tmp = x * (y / a);
} else if (y <= 1.1e-43) {
tmp = -z / (a / t);
} else if (y <= 29000000000000.0) {
tmp = (x * y) / a;
} else if (y <= 1.95e+138) {
tmp = t * (-z / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if y <= -4.8e-89: tmp = x * (y / a) elif y <= 1.1e-43: tmp = -z / (a / t) elif y <= 29000000000000.0: tmp = (x * y) / a elif y <= 1.95e+138: tmp = t * (-z / a) else: tmp = x / (a / y) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -4.8e-89) tmp = Float64(x * Float64(y / a)); elseif (y <= 1.1e-43) tmp = Float64(Float64(-z) / Float64(a / t)); elseif (y <= 29000000000000.0) tmp = Float64(Float64(x * y) / a); elseif (y <= 1.95e+138) tmp = Float64(t * Float64(Float64(-z) / a)); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -4.8e-89)
tmp = x * (y / a);
elseif (y <= 1.1e-43)
tmp = -z / (a / t);
elseif (y <= 29000000000000.0)
tmp = (x * y) / a;
elseif (y <= 1.95e+138)
tmp = t * (-z / a);
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -4.8e-89], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e-43], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 29000000000000.0], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 1.95e+138], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-89}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-43}:\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\
\mathbf{elif}\;y \leq 29000000000000:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+138}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if y < -4.80000000000000032e-89Initial program 91.3%
Taylor expanded in x around inf 61.4%
associate-/l*61.2%
Simplified61.2%
associate-/r/63.4%
Applied egg-rr63.4%
if -4.80000000000000032e-89 < y < 1.09999999999999999e-43Initial program 92.7%
Taylor expanded in x around 0 69.6%
associate-*r/69.6%
mul-1-neg69.6%
distribute-rgt-neg-out69.6%
*-commutative69.6%
associate-/l*73.1%
associate-/r/72.3%
Simplified72.3%
*-commutative72.3%
frac-2neg72.3%
remove-double-neg72.3%
associate-*r/69.6%
Applied egg-rr69.6%
associate-/l*72.9%
associate-/r/73.1%
Simplified73.1%
*-commutative73.1%
frac-2neg73.1%
remove-double-neg73.1%
distribute-frac-neg73.1%
distribute-rgt-neg-in73.1%
*-commutative73.1%
clear-num73.0%
associate-/r/73.0%
clear-num73.1%
distribute-neg-frac73.1%
Applied egg-rr73.1%
if 1.09999999999999999e-43 < y < 2.9e13Initial program 99.9%
Taylor expanded in x around inf 60.3%
if 2.9e13 < y < 1.9499999999999999e138Initial program 94.4%
div-sub94.4%
associate-/l*89.0%
associate-/l*94.2%
Applied egg-rr94.2%
Taylor expanded in x around 0 57.3%
mul-1-neg57.3%
associate-*r/62.6%
distribute-rgt-neg-in62.6%
Simplified62.6%
if 1.9499999999999999e138 < y Initial program 87.9%
Taylor expanded in x around inf 62.7%
associate-*r/68.4%
Simplified68.4%
associate-*r/62.7%
*-commutative62.7%
associate-/l*74.3%
Applied egg-rr74.3%
Final simplification68.6%
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) 4e+252) (/ (- (* x y) (* z t)) a) (/ (- z) (/ a t))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= 4e+252) {
tmp = ((x * y) - (z * t)) / a;
} 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 * t) <= 4d+252) then
tmp = ((x * y) - (z * t)) / a
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 * t) <= 4e+252) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = -z / (a / t);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= 4e+252: tmp = ((x * y) - (z * t)) / a else: tmp = -z / (a / t) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= 4e+252) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(Float64(-z) / Float64(a / 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 * t) <= 4e+252)
tmp = ((x * y) - (z * t)) / a;
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[N[(z * t), $MachinePrecision], 4e+252], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq 4 \cdot 10^{+252}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\
\end{array}
\end{array}
if (*.f64 z t) < 4.0000000000000004e252Initial program 95.1%
if 4.0000000000000004e252 < (*.f64 z t) Initial program 54.7%
Taylor expanded in x around 0 65.2%
associate-*r/65.2%
mul-1-neg65.2%
distribute-rgt-neg-out65.2%
*-commutative65.2%
associate-/l*100.0%
associate-/r/99.9%
Simplified99.9%
*-commutative99.9%
frac-2neg99.9%
remove-double-neg99.9%
associate-*r/65.2%
Applied egg-rr65.2%
associate-/l*99.9%
associate-/r/99.8%
Simplified99.8%
*-commutative99.8%
frac-2neg99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
distribute-rgt-neg-in99.8%
*-commutative99.8%
clear-num100.0%
associate-/r/99.8%
clear-num100.0%
distribute-neg-frac100.0%
Applied egg-rr100.0%
Final simplification95.5%
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.5e-256) (* x (/ y a)) (* y (/ x a))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e-256) {
tmp = x * (y / a);
} else {
tmp = y * (x / 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 (z <= (-5.5d-256)) then
tmp = x * (y / a)
else
tmp = y * (x / 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 (z <= -5.5e-256) {
tmp = x * (y / a);
} else {
tmp = y * (x / a);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -5.5e-256: tmp = x * (y / a) else: tmp = y * (x / a) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.5e-256) tmp = Float64(x * Float64(y / a)); else tmp = Float64(y * Float64(x / a)); 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.5e-256)
tmp = x * (y / a);
else
tmp = y * (x / 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[z, -5.5e-256], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-256}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if z < -5.4999999999999998e-256Initial program 89.9%
Taylor expanded in x around inf 39.0%
associate-/l*42.8%
Simplified42.8%
associate-/r/43.4%
Applied egg-rr43.4%
if -5.4999999999999998e-256 < z Initial program 94.1%
Taylor expanded in x around inf 57.3%
associate-*r/53.9%
Simplified53.9%
Final simplification48.9%
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.08e-257) (* x (/ y a)) (/ y (/ a x))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.08e-257) {
tmp = x * (y / a);
} 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 <= (-1.08d-257)) then
tmp = x * (y / a)
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 <= -1.08e-257) {
tmp = x * (y / a);
} else {
tmp = y / (a / x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if z <= -1.08e-257: tmp = x * (y / a) else: tmp = y / (a / x) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.08e-257) tmp = Float64(x * Float64(y / a)); 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 <= -1.08e-257)
tmp = x * (y / a);
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[LessEqual[z, -1.08e-257], N[(x * N[(y / a), $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 -1.08 \cdot 10^{-257}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if z < -1.07999999999999998e-257Initial program 89.9%
Taylor expanded in x around inf 39.0%
associate-/l*42.8%
Simplified42.8%
associate-/r/43.4%
Applied egg-rr43.4%
if -1.07999999999999998e-257 < z Initial program 94.1%
Taylor expanded in x around inf 57.3%
associate-/l*54.6%
Simplified54.6%
Final simplification49.3%
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 92.1%
Taylor expanded in x around inf 48.7%
associate-*r/49.4%
Simplified49.4%
Final simplification49.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 2023252
(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))