
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (let* ((t_1 (- (* x y) (* z t)))) (if (<= t_1 1e+272) (/ t_1 a) (- (/ x (/ a y)) (/ z (/ a t))))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= 1e+272) {
tmp = t_1 / a;
} else {
tmp = (x / (a / y)) - (z / (a / t));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) - (z * t)
if (t_1 <= 1d+272) then
tmp = t_1 / a
else
tmp = (x / (a / y)) - (z / (a / t))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= 1e+272) {
tmp = t_1 / a;
} else {
tmp = (x / (a / y)) - (z / (a / t));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= 1e+272: tmp = t_1 / a else: tmp = (x / (a / y)) - (z / (a / t)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= 1e+272) tmp = Float64(t_1 / a); else tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= 1e+272)
tmp = t_1 / a;
else
tmp = (x / (a / y)) - (z / (a / t));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+272], N[(t$95$1 / a), $MachinePrecision], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq 10^{+272}:\\
\;\;\;\;\frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < 1.0000000000000001e272Initial program 97.6%
if 1.0000000000000001e272 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 72.5%
div-sub72.5%
associate-/l*84.8%
associate-/l*94.6%
Applied egg-rr94.6%
Final simplification97.2%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* x y) a)))
(if (<= (* x y) -2000000000.0)
t_1
(if (<= (* x y) 5e-19)
(* z (- (/ t a)))
(if (<= (* x y) 5e+79)
t_1
(if (<= (* x y) 2e+90) (- (/ t (/ a z))) (* x (/ y a))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -2000000000.0) {
tmp = t_1;
} else if ((x * y) <= 5e-19) {
tmp = z * -(t / a);
} else if ((x * y) <= 5e+79) {
tmp = t_1;
} else if ((x * y) <= 2e+90) {
tmp = -(t / (a / z));
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) / a
if ((x * y) <= (-2000000000.0d0)) then
tmp = t_1
else if ((x * y) <= 5d-19) then
tmp = z * -(t / a)
else if ((x * y) <= 5d+79) then
tmp = t_1
else if ((x * y) <= 2d+90) then
tmp = -(t / (a / z))
else
tmp = x * (y / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -2000000000.0) {
tmp = t_1;
} else if ((x * y) <= 5e-19) {
tmp = z * -(t / a);
} else if ((x * y) <= 5e+79) {
tmp = t_1;
} else if ((x * y) <= 2e+90) {
tmp = -(t / (a / z));
} else {
tmp = x * (y / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) / a tmp = 0 if (x * y) <= -2000000000.0: tmp = t_1 elif (x * y) <= 5e-19: tmp = z * -(t / a) elif (x * y) <= 5e+79: tmp = t_1 elif (x * y) <= 2e+90: tmp = -(t / (a / z)) else: tmp = x * (y / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / a) tmp = 0.0 if (Float64(x * y) <= -2000000000.0) tmp = t_1; elseif (Float64(x * y) <= 5e-19) tmp = Float64(z * Float64(-Float64(t / a))); elseif (Float64(x * y) <= 5e+79) tmp = t_1; elseif (Float64(x * y) <= 2e+90) tmp = Float64(-Float64(t / Float64(a / z))); else tmp = Float64(x * Float64(y / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) / a;
tmp = 0.0;
if ((x * y) <= -2000000000.0)
tmp = t_1;
elseif ((x * y) <= 5e-19)
tmp = z * -(t / a);
elseif ((x * y) <= 5e+79)
tmp = t_1;
elseif ((x * y) <= 2e+90)
tmp = -(t / (a / z));
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2000000000.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-19], N[(z * (-N[(t / a), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+79], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e+90], (-N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{a}\\
\mathbf{if}\;x \cdot y \leq -2000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-19}:\\
\;\;\;\;z \cdot \left(-\frac{t}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+79}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+90}:\\
\;\;\;\;-\frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -2e9 or 5.0000000000000004e-19 < (*.f64 x y) < 5e79Initial program 94.7%
Taylor expanded in x around inf 77.0%
if -2e9 < (*.f64 x y) < 5.0000000000000004e-19Initial program 96.9%
div-sub96.9%
associate-/l*94.6%
associate-/l*94.0%
Applied egg-rr94.0%
Taylor expanded in x around 0 78.9%
mul-1-neg78.9%
associate-*l/77.5%
distribute-lft-neg-in77.5%
*-commutative77.5%
Simplified77.5%
if 5e79 < (*.f64 x y) < 1.99999999999999993e90Initial program 76.5%
Taylor expanded in x around 0 76.5%
mul-1-neg76.5%
associate-/l*100.0%
Simplified100.0%
if 1.99999999999999993e90 < (*.f64 x y) Initial program 84.9%
Taylor expanded in x around inf 80.3%
associate-*l/86.8%
Simplified86.8%
associate-/r/90.8%
Applied egg-rr90.8%
clear-num90.9%
associate-/r/90.7%
clear-num90.8%
Applied egg-rr90.8%
Final simplification80.0%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* x y) a)))
(if (<= (* x y) -2000000000.0)
t_1
(if (<= (* x y) 5e-19)
(/ z (/ (- a) t))
(if (<= (* x y) 5e+79)
t_1
(if (<= (* x y) 2e+90) (- (/ t (/ a z))) (* x (/ y a))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -2000000000.0) {
tmp = t_1;
} else if ((x * y) <= 5e-19) {
tmp = z / (-a / t);
} else if ((x * y) <= 5e+79) {
tmp = t_1;
} else if ((x * y) <= 2e+90) {
tmp = -(t / (a / z));
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) / a
if ((x * y) <= (-2000000000.0d0)) then
tmp = t_1
else if ((x * y) <= 5d-19) then
tmp = z / (-a / t)
else if ((x * y) <= 5d+79) then
tmp = t_1
else if ((x * y) <= 2d+90) then
tmp = -(t / (a / z))
else
tmp = x * (y / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -2000000000.0) {
tmp = t_1;
} else if ((x * y) <= 5e-19) {
tmp = z / (-a / t);
} else if ((x * y) <= 5e+79) {
tmp = t_1;
} else if ((x * y) <= 2e+90) {
tmp = -(t / (a / z));
} else {
tmp = x * (y / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) / a tmp = 0 if (x * y) <= -2000000000.0: tmp = t_1 elif (x * y) <= 5e-19: tmp = z / (-a / t) elif (x * y) <= 5e+79: tmp = t_1 elif (x * y) <= 2e+90: tmp = -(t / (a / z)) else: tmp = x * (y / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / a) tmp = 0.0 if (Float64(x * y) <= -2000000000.0) tmp = t_1; elseif (Float64(x * y) <= 5e-19) tmp = Float64(z / Float64(Float64(-a) / t)); elseif (Float64(x * y) <= 5e+79) tmp = t_1; elseif (Float64(x * y) <= 2e+90) tmp = Float64(-Float64(t / Float64(a / z))); else tmp = Float64(x * Float64(y / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) / a;
tmp = 0.0;
if ((x * y) <= -2000000000.0)
tmp = t_1;
elseif ((x * y) <= 5e-19)
tmp = z / (-a / t);
elseif ((x * y) <= 5e+79)
tmp = t_1;
elseif ((x * y) <= 2e+90)
tmp = -(t / (a / z));
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2000000000.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-19], N[(z / N[((-a) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+79], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e+90], (-N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{a}\\
\mathbf{if}\;x \cdot y \leq -2000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\frac{z}{\frac{-a}{t}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+79}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+90}:\\
\;\;\;\;-\frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -2e9 or 5.0000000000000004e-19 < (*.f64 x y) < 5e79Initial program 94.7%
Taylor expanded in x around inf 77.0%
if -2e9 < (*.f64 x y) < 5.0000000000000004e-19Initial program 96.9%
Taylor expanded in x around 0 78.9%
*-commutative78.9%
associate-*l/72.6%
associate-*r*72.6%
neg-mul-172.6%
distribute-frac-neg72.6%
Simplified72.6%
frac-2neg72.6%
remove-double-neg72.6%
associate-*l/78.9%
Applied egg-rr78.9%
associate-/l*78.2%
Simplified78.2%
if 5e79 < (*.f64 x y) < 1.99999999999999993e90Initial program 76.5%
Taylor expanded in x around 0 76.5%
mul-1-neg76.5%
associate-/l*100.0%
Simplified100.0%
if 1.99999999999999993e90 < (*.f64 x y) Initial program 84.9%
Taylor expanded in x around inf 80.3%
associate-*l/86.8%
Simplified86.8%
associate-/r/90.8%
Applied egg-rr90.8%
clear-num90.9%
associate-/r/90.7%
clear-num90.8%
Applied egg-rr90.8%
Final simplification80.3%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -2000000000.0) (/ (* x y) a) (if (<= (* x y) 2e+90) (- (/ t (/ a z))) (* x (/ y a)))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2000000000.0) {
tmp = (x * y) / a;
} else if ((x * y) <= 2e+90) {
tmp = -(t / (a / z));
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= (-2000000000.0d0)) then
tmp = (x * y) / a
else if ((x * y) <= 2d+90) then
tmp = -(t / (a / z))
else
tmp = x * (y / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2000000000.0) {
tmp = (x * y) / a;
} else if ((x * y) <= 2e+90) {
tmp = -(t / (a / z));
} else {
tmp = x * (y / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2000000000.0: tmp = (x * y) / a elif (x * y) <= 2e+90: tmp = -(t / (a / z)) else: tmp = x * (y / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2000000000.0) tmp = Float64(Float64(x * y) / a); elseif (Float64(x * y) <= 2e+90) tmp = Float64(-Float64(t / Float64(a / z))); else tmp = Float64(x * Float64(y / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2000000000.0)
tmp = (x * y) / a;
elseif ((x * y) <= 2e+90)
tmp = -(t / (a / z));
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2000000000.0], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+90], (-N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2000000000:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+90}:\\
\;\;\;\;-\frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -2e9Initial program 93.9%
Taylor expanded in x around inf 78.9%
if -2e9 < (*.f64 x y) < 1.99999999999999993e90Initial program 96.5%
Taylor expanded in x around 0 75.2%
mul-1-neg75.2%
associate-/l*70.2%
Simplified70.2%
if 1.99999999999999993e90 < (*.f64 x y) Initial program 84.9%
Taylor expanded in x around inf 80.3%
associate-*l/86.8%
Simplified86.8%
associate-/r/90.8%
Applied egg-rr90.8%
clear-num90.9%
associate-/r/90.7%
clear-num90.8%
Applied egg-rr90.8%
Final simplification75.9%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -2000000000.0) (/ (* x y) a) (if (<= (* x y) 5e-19) (/ (* t (- z)) a) (* x (/ y a)))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2000000000.0) {
tmp = (x * y) / a;
} else if ((x * y) <= 5e-19) {
tmp = (t * -z) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= (-2000000000.0d0)) then
tmp = (x * y) / a
else if ((x * y) <= 5d-19) then
tmp = (t * -z) / a
else
tmp = x * (y / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2000000000.0) {
tmp = (x * y) / a;
} else if ((x * y) <= 5e-19) {
tmp = (t * -z) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2000000000.0: tmp = (x * y) / a elif (x * y) <= 5e-19: tmp = (t * -z) / a else: tmp = x * (y / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2000000000.0) tmp = Float64(Float64(x * y) / a); elseif (Float64(x * y) <= 5e-19) tmp = Float64(Float64(t * Float64(-z)) / a); else tmp = Float64(x * Float64(y / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2000000000.0)
tmp = (x * y) / a;
elseif ((x * y) <= 5e-19)
tmp = (t * -z) / a;
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2000000000.0], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-19], N[(N[(t * (-z)), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2000000000:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\frac{t \cdot \left(-z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -2e9Initial program 93.9%
Taylor expanded in x around inf 78.9%
if -2e9 < (*.f64 x y) < 5.0000000000000004e-19Initial program 96.9%
Taylor expanded in x around 0 78.9%
mul-1-neg78.9%
distribute-rgt-neg-in78.9%
Simplified78.9%
if 5.0000000000000004e-19 < (*.f64 x y) Initial program 87.0%
Taylor expanded in x around inf 72.3%
associate-*l/74.1%
Simplified74.1%
associate-/r/80.2%
Applied egg-rr80.2%
clear-num80.2%
associate-/r/80.1%
clear-num80.1%
Applied egg-rr80.1%
Final simplification79.2%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) 1e+262) (/ (- (* x y) (* z t)) a) (* x (/ y a))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 1e+262) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= 1d+262) then
tmp = ((x * y) - (z * t)) / a
else
tmp = x * (y / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 1e+262) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= 1e+262: tmp = ((x * y) - (z * t)) / a else: tmp = x * (y / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= 1e+262) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(x * Float64(y / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= 1e+262)
tmp = ((x * y) - (z * t)) / a;
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], 1e+262], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 10^{+262}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < 1e262Initial program 95.7%
if 1e262 < (*.f64 x y) Initial program 74.3%
Taylor expanded in x around inf 74.3%
associate-*l/100.0%
Simplified100.0%
associate-/r/99.9%
Applied egg-rr99.9%
clear-num99.9%
associate-/r/99.8%
clear-num99.8%
Applied egg-rr99.8%
Final simplification96.1%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* y (/ x a)))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = y * (x / a)
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): return y * (x / a)
z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = y * (x / a);
end
NOTE: z and t 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}
[z, t] = \mathsf{sort}([z, t])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 93.9%
Taylor expanded in x around inf 50.9%
associate-*l/50.7%
Simplified50.7%
Final simplification50.7%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* x (/ y a)))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x * (y / a)
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): return x * (y / a)
z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = x * (y / a);
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 93.9%
Taylor expanded in x around inf 50.9%
associate-*l/50.7%
Simplified50.7%
associate-/r/51.9%
Applied egg-rr51.9%
clear-num51.9%
associate-/r/51.8%
clear-num51.9%
Applied egg-rr51.9%
Final simplification51.9%
(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 2023320
(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))