
(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 7 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 (if (<= (* x y) -5e+265) (- (/ x (/ a y)) (/ z (/ a t))) (/ (- (* x y) (* z t)) a)))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e+265) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = ((x * y) - (z * t)) / 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) <= (-5d+265)) then
tmp = (x / (a / y)) - (z / (a / t))
else
tmp = ((x * y) - (z * t)) / 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) <= -5e+265) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -5e+265: tmp = (x / (a / y)) - (z / (a / t)) else: tmp = ((x * y) - (z * t)) / a return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -5e+265) tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); else tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / 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) <= -5e+265)
tmp = (x / (a / y)) - (z / (a / t));
else
tmp = ((x * y) - (z * t)) / 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], -5e+265], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+265}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.0000000000000002e265Initial program 69.2%
div-sub69.2%
associate-/l*96.9%
associate-/l*96.7%
Applied egg-rr96.7%
if -5.0000000000000002e265 < (*.f64 x y) Initial program 96.5%
Final simplification96.5%
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 (* t (/ (- z) a))) (t_2 (* y (/ x a))))
(if (<= (* x y) -2e+195)
t_2
(if (<= (* x y) -100.0)
(/ (* x y) a)
(if (<= (* x y) -1e-60)
(* z (- (/ t a)))
(if (<= (* x y) -2e-112)
(/ x (/ a y))
(if (<= (* x y) 5e-100)
t_1
(if (<= (* x y) 5e+14)
t_2
(if (<= (* x y) 5e+127) t_1 (* x (/ y a)))))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (-z / a);
double t_2 = y * (x / a);
double tmp;
if ((x * y) <= -2e+195) {
tmp = t_2;
} else if ((x * y) <= -100.0) {
tmp = (x * y) / a;
} else if ((x * y) <= -1e-60) {
tmp = z * -(t / a);
} else if ((x * y) <= -2e-112) {
tmp = x / (a / y);
} else if ((x * y) <= 5e-100) {
tmp = t_1;
} else if ((x * y) <= 5e+14) {
tmp = t_2;
} else if ((x * y) <= 5e+127) {
tmp = t_1;
} 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) :: t_2
real(8) :: tmp
t_1 = t * (-z / a)
t_2 = y * (x / a)
if ((x * y) <= (-2d+195)) then
tmp = t_2
else if ((x * y) <= (-100.0d0)) then
tmp = (x * y) / a
else if ((x * y) <= (-1d-60)) then
tmp = z * -(t / a)
else if ((x * y) <= (-2d-112)) then
tmp = x / (a / y)
else if ((x * y) <= 5d-100) then
tmp = t_1
else if ((x * y) <= 5d+14) then
tmp = t_2
else if ((x * y) <= 5d+127) then
tmp = t_1
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 = t * (-z / a);
double t_2 = y * (x / a);
double tmp;
if ((x * y) <= -2e+195) {
tmp = t_2;
} else if ((x * y) <= -100.0) {
tmp = (x * y) / a;
} else if ((x * y) <= -1e-60) {
tmp = z * -(t / a);
} else if ((x * y) <= -2e-112) {
tmp = x / (a / y);
} else if ((x * y) <= 5e-100) {
tmp = t_1;
} else if ((x * y) <= 5e+14) {
tmp = t_2;
} else if ((x * y) <= 5e+127) {
tmp = t_1;
} else {
tmp = x * (y / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = t * (-z / a) t_2 = y * (x / a) tmp = 0 if (x * y) <= -2e+195: tmp = t_2 elif (x * y) <= -100.0: tmp = (x * y) / a elif (x * y) <= -1e-60: tmp = z * -(t / a) elif (x * y) <= -2e-112: tmp = x / (a / y) elif (x * y) <= 5e-100: tmp = t_1 elif (x * y) <= 5e+14: tmp = t_2 elif (x * y) <= 5e+127: tmp = t_1 else: tmp = x * (y / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(t * Float64(Float64(-z) / a)) t_2 = Float64(y * Float64(x / a)) tmp = 0.0 if (Float64(x * y) <= -2e+195) tmp = t_2; elseif (Float64(x * y) <= -100.0) tmp = Float64(Float64(x * y) / a); elseif (Float64(x * y) <= -1e-60) tmp = Float64(z * Float64(-Float64(t / a))); elseif (Float64(x * y) <= -2e-112) tmp = Float64(x / Float64(a / y)); elseif (Float64(x * y) <= 5e-100) tmp = t_1; elseif (Float64(x * y) <= 5e+14) tmp = t_2; elseif (Float64(x * y) <= 5e+127) tmp = t_1; 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 = t * (-z / a);
t_2 = y * (x / a);
tmp = 0.0;
if ((x * y) <= -2e+195)
tmp = t_2;
elseif ((x * y) <= -100.0)
tmp = (x * y) / a;
elseif ((x * y) <= -1e-60)
tmp = z * -(t / a);
elseif ((x * y) <= -2e-112)
tmp = x / (a / y);
elseif ((x * y) <= 5e-100)
tmp = t_1;
elseif ((x * y) <= 5e+14)
tmp = t_2;
elseif ((x * y) <= 5e+127)
tmp = t_1;
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[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+195], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -100.0], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -1e-60], N[(z * (-N[(t / a), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e-112], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-100], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e+14], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 5e+127], t$95$1, N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := t \cdot \frac{-z}{a}\\
t_2 := y \cdot \frac{x}{a}\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+195}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot y \leq -100:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-60}:\\
\;\;\;\;z \cdot \left(-\frac{t}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-112}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-100}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+14}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+127}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999995e195 or 5.0000000000000001e-100 < (*.f64 x y) < 5e14Initial program 83.1%
Taylor expanded in x around inf 74.8%
associate-*l/85.6%
Simplified85.6%
if -1.99999999999999995e195 < (*.f64 x y) < -100Initial program 99.8%
Taylor expanded in x around inf 86.1%
if -100 < (*.f64 x y) < -9.9999999999999997e-61Initial program 99.9%
div-sub99.9%
associate-/l*87.5%
associate-/l*75.0%
Applied egg-rr75.0%
Taylor expanded in x around 0 68.0%
mul-1-neg68.0%
associate-*l/55.4%
distribute-rgt-neg-in55.4%
Simplified55.4%
if -9.9999999999999997e-61 < (*.f64 x y) < -1.9999999999999999e-112Initial program 99.7%
Taylor expanded in x around inf 80.4%
associate-*r/69.1%
Simplified69.1%
associate-*r/80.4%
associate-/l*62.8%
Applied egg-rr62.8%
if -1.9999999999999999e-112 < (*.f64 x y) < 5.0000000000000001e-100 or 5e14 < (*.f64 x y) < 5.0000000000000004e127Initial program 96.7%
Taylor expanded in x around 0 87.3%
mul-1-neg87.3%
*-commutative87.3%
associate-*l/81.4%
*-commutative81.4%
distribute-rgt-neg-in81.4%
distribute-frac-neg81.4%
Simplified81.4%
if 5.0000000000000004e127 < (*.f64 x y) Initial program 88.3%
Taylor expanded in x around inf 79.7%
associate-*r/91.3%
Simplified91.3%
Final simplification82.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 (* t (/ (- z) a))) (t_2 (* y (/ x a))))
(if (<= (* x y) -2e+195)
t_2
(if (<= (* x y) -2e-112)
(/ (* x y) a)
(if (<= (* x y) 5e-100)
t_1
(if (<= (* x y) 5e+14)
t_2
(if (<= (* x y) 5e+127) t_1 (* x (/ y a)))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (-z / a);
double t_2 = y * (x / a);
double tmp;
if ((x * y) <= -2e+195) {
tmp = t_2;
} else if ((x * y) <= -2e-112) {
tmp = (x * y) / a;
} else if ((x * y) <= 5e-100) {
tmp = t_1;
} else if ((x * y) <= 5e+14) {
tmp = t_2;
} else if ((x * y) <= 5e+127) {
tmp = t_1;
} 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) :: t_2
real(8) :: tmp
t_1 = t * (-z / a)
t_2 = y * (x / a)
if ((x * y) <= (-2d+195)) then
tmp = t_2
else if ((x * y) <= (-2d-112)) then
tmp = (x * y) / a
else if ((x * y) <= 5d-100) then
tmp = t_1
else if ((x * y) <= 5d+14) then
tmp = t_2
else if ((x * y) <= 5d+127) then
tmp = t_1
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 = t * (-z / a);
double t_2 = y * (x / a);
double tmp;
if ((x * y) <= -2e+195) {
tmp = t_2;
} else if ((x * y) <= -2e-112) {
tmp = (x * y) / a;
} else if ((x * y) <= 5e-100) {
tmp = t_1;
} else if ((x * y) <= 5e+14) {
tmp = t_2;
} else if ((x * y) <= 5e+127) {
tmp = t_1;
} else {
tmp = x * (y / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = t * (-z / a) t_2 = y * (x / a) tmp = 0 if (x * y) <= -2e+195: tmp = t_2 elif (x * y) <= -2e-112: tmp = (x * y) / a elif (x * y) <= 5e-100: tmp = t_1 elif (x * y) <= 5e+14: tmp = t_2 elif (x * y) <= 5e+127: tmp = t_1 else: tmp = x * (y / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(t * Float64(Float64(-z) / a)) t_2 = Float64(y * Float64(x / a)) tmp = 0.0 if (Float64(x * y) <= -2e+195) tmp = t_2; elseif (Float64(x * y) <= -2e-112) tmp = Float64(Float64(x * y) / a); elseif (Float64(x * y) <= 5e-100) tmp = t_1; elseif (Float64(x * y) <= 5e+14) tmp = t_2; elseif (Float64(x * y) <= 5e+127) tmp = t_1; 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 = t * (-z / a);
t_2 = y * (x / a);
tmp = 0.0;
if ((x * y) <= -2e+195)
tmp = t_2;
elseif ((x * y) <= -2e-112)
tmp = (x * y) / a;
elseif ((x * y) <= 5e-100)
tmp = t_1;
elseif ((x * y) <= 5e+14)
tmp = t_2;
elseif ((x * y) <= 5e+127)
tmp = t_1;
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[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+195], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -2e-112], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-100], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e+14], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 5e+127], t$95$1, N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := t \cdot \frac{-z}{a}\\
t_2 := y \cdot \frac{x}{a}\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+195}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-112}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-100}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+14}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+127}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999995e195 or 5.0000000000000001e-100 < (*.f64 x y) < 5e14Initial program 83.1%
Taylor expanded in x around inf 74.8%
associate-*l/85.6%
Simplified85.6%
if -1.99999999999999995e195 < (*.f64 x y) < -1.9999999999999999e-112Initial program 99.8%
Taylor expanded in x around inf 67.9%
if -1.9999999999999999e-112 < (*.f64 x y) < 5.0000000000000001e-100 or 5e14 < (*.f64 x y) < 5.0000000000000004e127Initial program 96.7%
Taylor expanded in x around 0 87.3%
mul-1-neg87.3%
*-commutative87.3%
associate-*l/81.4%
*-commutative81.4%
distribute-rgt-neg-in81.4%
distribute-frac-neg81.4%
Simplified81.4%
if 5.0000000000000004e127 < (*.f64 x y) Initial program 88.3%
Taylor expanded in x around inf 79.7%
associate-*r/91.3%
Simplified91.3%
Final simplification81.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 (* y (/ x a))))
(if (<= (* x y) -2e+195)
t_1
(if (<= (* x y) -100.0)
(/ (* x y) a)
(if (<= (* x y) 5e-100)
(/ (* t (- z)) a)
(if (<= (* x y) 5e+14)
t_1
(if (<= (* x y) 5e+127) (* t (/ (- z) a)) (* x (/ y a)))))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (x / a);
double tmp;
if ((x * y) <= -2e+195) {
tmp = t_1;
} else if ((x * y) <= -100.0) {
tmp = (x * y) / a;
} else if ((x * y) <= 5e-100) {
tmp = (t * -z) / a;
} else if ((x * y) <= 5e+14) {
tmp = t_1;
} else if ((x * y) <= 5e+127) {
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) :: t_1
real(8) :: tmp
t_1 = y * (x / a)
if ((x * y) <= (-2d+195)) then
tmp = t_1
else if ((x * y) <= (-100.0d0)) then
tmp = (x * y) / a
else if ((x * y) <= 5d-100) then
tmp = (t * -z) / a
else if ((x * y) <= 5d+14) then
tmp = t_1
else if ((x * y) <= 5d+127) 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 t_1 = y * (x / a);
double tmp;
if ((x * y) <= -2e+195) {
tmp = t_1;
} else if ((x * y) <= -100.0) {
tmp = (x * y) / a;
} else if ((x * y) <= 5e-100) {
tmp = (t * -z) / a;
} else if ((x * y) <= 5e+14) {
tmp = t_1;
} else if ((x * y) <= 5e+127) {
tmp = t * (-z / a);
} else {
tmp = x * (y / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = y * (x / a) tmp = 0 if (x * y) <= -2e+195: tmp = t_1 elif (x * y) <= -100.0: tmp = (x * y) / a elif (x * y) <= 5e-100: tmp = (t * -z) / a elif (x * y) <= 5e+14: tmp = t_1 elif (x * y) <= 5e+127: tmp = t * (-z / a) else: tmp = x * (y / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(y * Float64(x / a)) tmp = 0.0 if (Float64(x * y) <= -2e+195) tmp = t_1; elseif (Float64(x * y) <= -100.0) tmp = Float64(Float64(x * y) / a); elseif (Float64(x * y) <= 5e-100) tmp = Float64(Float64(t * Float64(-z)) / a); elseif (Float64(x * y) <= 5e+14) tmp = t_1; elseif (Float64(x * y) <= 5e+127) tmp = Float64(t * Float64(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)
t_1 = y * (x / a);
tmp = 0.0;
if ((x * y) <= -2e+195)
tmp = t_1;
elseif ((x * y) <= -100.0)
tmp = (x * y) / a;
elseif ((x * y) <= 5e-100)
tmp = (t * -z) / a;
elseif ((x * y) <= 5e+14)
tmp = t_1;
elseif ((x * y) <= 5e+127)
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_] := Block[{t$95$1 = N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+195], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -100.0], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-100], N[(N[(t * (-z)), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+14], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e+127], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := y \cdot \frac{x}{a}\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+195}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq -100:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-100}:\\
\;\;\;\;\frac{t \cdot \left(-z\right)}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+14}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+127}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999995e195 or 5.0000000000000001e-100 < (*.f64 x y) < 5e14Initial program 83.1%
Taylor expanded in x around inf 74.8%
associate-*l/85.6%
Simplified85.6%
if -1.99999999999999995e195 < (*.f64 x y) < -100Initial program 99.8%
Taylor expanded in x around inf 86.1%
if -100 < (*.f64 x y) < 5.0000000000000001e-100Initial program 96.9%
Taylor expanded in x around 0 84.8%
associate-*r/84.8%
mul-1-neg84.8%
distribute-rgt-neg-in84.8%
Simplified84.8%
if 5e14 < (*.f64 x y) < 5.0000000000000004e127Initial program 99.7%
Taylor expanded in x around 0 67.5%
mul-1-neg67.5%
*-commutative67.5%
associate-*l/67.8%
*-commutative67.8%
distribute-rgt-neg-in67.8%
distribute-frac-neg67.8%
Simplified67.8%
if 5.0000000000000004e127 < (*.f64 x y) Initial program 88.3%
Taylor expanded in x around inf 79.7%
associate-*r/91.3%
Simplified91.3%
Final simplification85.0%
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) (- INFINITY)) (* x (/ y a)) (/ (- (* x y) (* z t)) a)))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = x * (y / a);
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = x * (y / a);
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -math.inf: tmp = x * (y / a) else: tmp = ((x * y) - (z * t)) / a return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(x * Float64(y / a)); else tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / 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) <= -Inf)
tmp = x * (y / a);
else
tmp = ((x * y) - (z * t)) / 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], (-Infinity)], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 64.7%
Taylor expanded in x around inf 64.7%
associate-*r/96.3%
Simplified96.3%
if -inf.0 < (*.f64 x y) Initial program 96.5%
Final simplification96.5%
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.2%
Taylor expanded in x around inf 52.9%
associate-*r/55.7%
Simplified55.7%
Final simplification55.7%
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.2%
Taylor expanded in x around inf 52.9%
associate-*l/54.1%
Simplified54.1%
Final simplification54.1%
(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 2023279
(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))