
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* a 27.0) b)))
(if (<= z -5e-36)
(fma x 2.0 (fma z (* y (* t -9.0)) t_1))
(+ t_1 (- (* x 2.0) (* t (* z (* y 9.0))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double tmp;
if (z <= -5e-36) {
tmp = fma(x, 2.0, fma(z, (y * (t * -9.0)), t_1));
} else {
tmp = t_1 + ((x * 2.0) - (t * (z * (y * 9.0))));
}
return tmp;
}
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * 27.0) * b) tmp = 0.0 if (z <= -5e-36) tmp = fma(x, 2.0, fma(z, Float64(y * Float64(t * -9.0)), t_1)); else tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(y * 9.0))))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[z, -5e-36], N[(x * 2.0 + N[(z * N[(y * N[(t * -9.0), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
\mathbf{if}\;z \leq -5 \cdot 10^{-36}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(z, y \cdot \left(t \cdot -9\right), t_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right)\\
\end{array}
\end{array}
if z < -5.00000000000000004e-36Initial program 90.5%
+-commutative90.5%
associate-+r-90.5%
cancel-sign-sub-inv90.5%
*-commutative90.5%
distribute-rgt-neg-out90.5%
associate-*r*95.7%
*-commutative95.7%
distribute-rgt-neg-in95.7%
associate-+r+95.7%
sub-neg95.7%
+-commutative95.7%
associate-+l-95.7%
fma-neg95.7%
associate-*l*89.3%
fma-neg92.1%
*-commutative92.1%
fma-neg89.3%
Simplified98.5%
if -5.00000000000000004e-36 < z Initial program 97.2%
Final simplification97.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 9.0 (* t (* z y)))) (t_2 (- (* x 2.0) t_1)))
(if (<= (* x 2.0) -5e+126)
t_2
(if (<= (* x 2.0) 2e+24)
(- (* 27.0 (* a b)) t_1)
(if (<= (* x 2.0) 5e+126) (+ (* (* a 27.0) b) (* x 2.0)) t_2)))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 9.0 * (t * (z * y));
double t_2 = (x * 2.0) - t_1;
double tmp;
if ((x * 2.0) <= -5e+126) {
tmp = t_2;
} else if ((x * 2.0) <= 2e+24) {
tmp = (27.0 * (a * b)) - t_1;
} else if ((x * 2.0) <= 5e+126) {
tmp = ((a * 27.0) * b) + (x * 2.0);
} else {
tmp = t_2;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 9.0d0 * (t * (z * y))
t_2 = (x * 2.0d0) - t_1
if ((x * 2.0d0) <= (-5d+126)) then
tmp = t_2
else if ((x * 2.0d0) <= 2d+24) then
tmp = (27.0d0 * (a * b)) - t_1
else if ((x * 2.0d0) <= 5d+126) then
tmp = ((a * 27.0d0) * b) + (x * 2.0d0)
else
tmp = t_2
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 9.0 * (t * (z * y));
double t_2 = (x * 2.0) - t_1;
double tmp;
if ((x * 2.0) <= -5e+126) {
tmp = t_2;
} else if ((x * 2.0) <= 2e+24) {
tmp = (27.0 * (a * b)) - t_1;
} else if ((x * 2.0) <= 5e+126) {
tmp = ((a * 27.0) * b) + (x * 2.0);
} else {
tmp = t_2;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = 9.0 * (t * (z * y)) t_2 = (x * 2.0) - t_1 tmp = 0 if (x * 2.0) <= -5e+126: tmp = t_2 elif (x * 2.0) <= 2e+24: tmp = (27.0 * (a * b)) - t_1 elif (x * 2.0) <= 5e+126: tmp = ((a * 27.0) * b) + (x * 2.0) else: tmp = t_2 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(9.0 * Float64(t * Float64(z * y))) t_2 = Float64(Float64(x * 2.0) - t_1) tmp = 0.0 if (Float64(x * 2.0) <= -5e+126) tmp = t_2; elseif (Float64(x * 2.0) <= 2e+24) tmp = Float64(Float64(27.0 * Float64(a * b)) - t_1); elseif (Float64(x * 2.0) <= 5e+126) tmp = Float64(Float64(Float64(a * 27.0) * b) + Float64(x * 2.0)); else tmp = t_2; end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 9.0 * (t * (z * y));
t_2 = (x * 2.0) - t_1;
tmp = 0.0;
if ((x * 2.0) <= -5e+126)
tmp = t_2;
elseif ((x * 2.0) <= 2e+24)
tmp = (27.0 * (a * b)) - t_1;
elseif ((x * 2.0) <= 5e+126)
tmp = ((a * 27.0) * b) + (x * 2.0);
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 2.0), $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[N[(x * 2.0), $MachinePrecision], -5e+126], t$95$2, If[LessEqual[N[(x * 2.0), $MachinePrecision], 2e+24], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[N[(x * 2.0), $MachinePrecision], 5e+126], N[(N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
t_2 := x \cdot 2 - t_1\\
\mathbf{if}\;x \cdot 2 \leq -5 \cdot 10^{+126}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot 2 \leq 2 \cdot 10^{+24}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - t_1\\
\mathbf{elif}\;x \cdot 2 \leq 5 \cdot 10^{+126}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (*.f64 x 2) < -4.99999999999999977e126 or 4.99999999999999977e126 < (*.f64 x 2) Initial program 96.5%
sub-neg96.5%
distribute-lft-neg-in96.5%
associate-*l*96.5%
*-commutative96.5%
*-commutative96.5%
cancel-sign-sub-inv96.5%
*-commutative96.5%
*-commutative96.5%
associate-*l*96.5%
associate-*l*93.1%
associate-*l*93.1%
Simplified93.1%
Taylor expanded in a around 0 86.4%
if -4.99999999999999977e126 < (*.f64 x 2) < 2e24Initial program 94.8%
sub-neg94.8%
distribute-lft-neg-in94.8%
associate-*l*95.4%
*-commutative95.4%
*-commutative95.4%
cancel-sign-sub-inv95.4%
*-commutative95.4%
*-commutative95.4%
associate-*l*94.8%
associate-*l*94.2%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in x around 0 85.2%
if 2e24 < (*.f64 x 2) < 4.99999999999999977e126Initial program 93.1%
sub-neg93.1%
distribute-lft-neg-in93.1%
associate-*l*93.1%
*-commutative93.1%
*-commutative93.1%
cancel-sign-sub-inv93.1%
*-commutative93.1%
*-commutative93.1%
associate-*l*93.1%
associate-*l*99.8%
associate-*l*99.8%
Simplified99.8%
associate-+l-99.8%
associate-*r*93.1%
associate-*r*93.1%
associate-*r*99.8%
associate-*l*99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 93.3%
cancel-sign-sub-inv93.3%
metadata-eval93.3%
associate-*r*93.4%
*-commutative93.4%
*-commutative93.4%
Applied egg-rr93.4%
Final simplification86.1%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 4.3e+101) (+ (- (* x 2.0) (* (* y 9.0) (* z t))) (* a (* 27.0 b))) (- (* x 2.0) (* 9.0 (* t (* z y))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 4.3e+101) {
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
} else {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if (z <= 4.3d+101) then
tmp = ((x * 2.0d0) - ((y * 9.0d0) * (z * t))) + (a * (27.0d0 * b))
else
tmp = (x * 2.0d0) - (9.0d0 * (t * (z * y)))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 4.3e+101) {
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
} else {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= 4.3e+101: tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b)) else: tmp = (x * 2.0) - (9.0 * (t * (z * y))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 4.3e+101) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(z * t))) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(z * y)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= 4.3e+101)
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
else
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 4.3e+101], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.3 \cdot 10^{+101}:\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < 4.3000000000000001e101Initial program 95.2%
sub-neg95.2%
distribute-lft-neg-in95.2%
associate-*l*95.7%
*-commutative95.7%
*-commutative95.7%
cancel-sign-sub-inv95.7%
*-commutative95.7%
*-commutative95.7%
associate-*l*95.2%
associate-*l*95.2%
associate-*l*95.7%
Simplified95.7%
if 4.3000000000000001e101 < z Initial program 95.6%
sub-neg95.6%
distribute-lft-neg-in95.6%
associate-*l*95.5%
*-commutative95.5%
*-commutative95.5%
cancel-sign-sub-inv95.5%
*-commutative95.5%
*-commutative95.5%
associate-*l*95.6%
associate-*l*89.3%
associate-*l*89.4%
Simplified89.4%
Taylor expanded in a around 0 80.6%
Final simplification93.0%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 2e-54) (+ (- (* x 2.0) (* (* y 9.0) (* z t))) (* a (* 27.0 b))) (+ (* (* a 27.0) b) (- (* x 2.0) (* t (* z (* y 9.0)))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2e-54) {
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
} else {
tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (z * (y * 9.0))));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if (z <= 2d-54) then
tmp = ((x * 2.0d0) - ((y * 9.0d0) * (z * t))) + (a * (27.0d0 * b))
else
tmp = ((a * 27.0d0) * b) + ((x * 2.0d0) - (t * (z * (y * 9.0d0))))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2e-54) {
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
} else {
tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (z * (y * 9.0))));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= 2e-54: tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b)) else: tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (z * (y * 9.0)))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 2e-54) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(z * t))) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(a * 27.0) * b) + Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(y * 9.0))))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= 2e-54)
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
else
tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (z * (y * 9.0))));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 2e-54], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{-54}:\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right)\\
\end{array}
\end{array}
if z < 2.0000000000000001e-54Initial program 94.3%
sub-neg94.3%
distribute-lft-neg-in94.3%
associate-*l*94.9%
*-commutative94.9%
*-commutative94.9%
cancel-sign-sub-inv94.9%
*-commutative94.9%
*-commutative94.9%
associate-*l*94.3%
associate-*l*94.4%
associate-*l*94.9%
Simplified94.9%
if 2.0000000000000001e-54 < z Initial program 97.4%
Final simplification95.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (* 27.0 b))) (t_2 (* -9.0 (* t (* z y)))))
(if (<= x -1.4e+95)
(* x 2.0)
(if (<= x -7.5e-158)
(* 27.0 (* a b))
(if (<= x -3e-242)
t_2
(if (<= x 3.25e-229)
t_1
(if (<= x 3e-152) t_2 (if (<= x 1.7e-36) t_1 (* x 2.0)))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double t_2 = -9.0 * (t * (z * y));
double tmp;
if (x <= -1.4e+95) {
tmp = x * 2.0;
} else if (x <= -7.5e-158) {
tmp = 27.0 * (a * b);
} else if (x <= -3e-242) {
tmp = t_2;
} else if (x <= 3.25e-229) {
tmp = t_1;
} else if (x <= 3e-152) {
tmp = t_2;
} else if (x <= 1.7e-36) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = a * (27.0d0 * b)
t_2 = (-9.0d0) * (t * (z * y))
if (x <= (-1.4d+95)) then
tmp = x * 2.0d0
else if (x <= (-7.5d-158)) then
tmp = 27.0d0 * (a * b)
else if (x <= (-3d-242)) then
tmp = t_2
else if (x <= 3.25d-229) then
tmp = t_1
else if (x <= 3d-152) then
tmp = t_2
else if (x <= 1.7d-36) then
tmp = t_1
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double t_2 = -9.0 * (t * (z * y));
double tmp;
if (x <= -1.4e+95) {
tmp = x * 2.0;
} else if (x <= -7.5e-158) {
tmp = 27.0 * (a * b);
} else if (x <= -3e-242) {
tmp = t_2;
} else if (x <= 3.25e-229) {
tmp = t_1;
} else if (x <= 3e-152) {
tmp = t_2;
} else if (x <= 1.7e-36) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = a * (27.0 * b) t_2 = -9.0 * (t * (z * y)) tmp = 0 if x <= -1.4e+95: tmp = x * 2.0 elif x <= -7.5e-158: tmp = 27.0 * (a * b) elif x <= -3e-242: tmp = t_2 elif x <= 3.25e-229: tmp = t_1 elif x <= 3e-152: tmp = t_2 elif x <= 1.7e-36: tmp = t_1 else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(27.0 * b)) t_2 = Float64(-9.0 * Float64(t * Float64(z * y))) tmp = 0.0 if (x <= -1.4e+95) tmp = Float64(x * 2.0); elseif (x <= -7.5e-158) tmp = Float64(27.0 * Float64(a * b)); elseif (x <= -3e-242) tmp = t_2; elseif (x <= 3.25e-229) tmp = t_1; elseif (x <= 3e-152) tmp = t_2; elseif (x <= 1.7e-36) tmp = t_1; else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = a * (27.0 * b);
t_2 = -9.0 * (t * (z * y));
tmp = 0.0;
if (x <= -1.4e+95)
tmp = x * 2.0;
elseif (x <= -7.5e-158)
tmp = 27.0 * (a * b);
elseif (x <= -3e-242)
tmp = t_2;
elseif (x <= 3.25e-229)
tmp = t_1;
elseif (x <= 3e-152)
tmp = t_2;
elseif (x <= 1.7e-36)
tmp = t_1;
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.4e+95], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -7.5e-158], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3e-242], t$95$2, If[LessEqual[x, 3.25e-229], t$95$1, If[LessEqual[x, 3e-152], t$95$2, If[LessEqual[x, 1.7e-36], t$95$1, N[(x * 2.0), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(27 \cdot b\right)\\
t_2 := -9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{if}\;x \leq -1.4 \cdot 10^{+95}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -7.5 \cdot 10^{-158}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;x \leq -3 \cdot 10^{-242}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 3.25 \cdot 10^{-229}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-152}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-36}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -1.3999999999999999e95 or 1.7000000000000001e-36 < x Initial program 95.6%
sub-neg95.6%
distribute-lft-neg-in95.6%
associate-*l*95.6%
*-commutative95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.6%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in x around inf 57.7%
if -1.3999999999999999e95 < x < -7.5e-158Initial program 90.4%
sub-neg90.4%
distribute-lft-neg-in90.4%
associate-*l*92.3%
*-commutative92.3%
*-commutative92.3%
cancel-sign-sub-inv92.3%
*-commutative92.3%
*-commutative92.3%
associate-*l*90.4%
associate-*l*92.4%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in a around inf 53.7%
if -7.5e-158 < x < -3e-242 or 3.25e-229 < x < 3e-152Initial program 97.4%
sub-neg97.4%
distribute-lft-neg-in97.4%
associate-*l*97.2%
*-commutative97.2%
*-commutative97.2%
cancel-sign-sub-inv97.2%
*-commutative97.2%
*-commutative97.2%
associate-*l*97.4%
associate-*l*97.2%
associate-*l*97.2%
Simplified97.2%
Taylor expanded in y around inf 63.0%
if -3e-242 < x < 3.25e-229 or 3e-152 < x < 1.7000000000000001e-36Initial program 97.9%
sub-neg97.9%
distribute-lft-neg-in97.9%
associate-*l*97.9%
*-commutative97.9%
*-commutative97.9%
cancel-sign-sub-inv97.9%
*-commutative97.9%
*-commutative97.9%
associate-*l*97.9%
associate-*l*92.6%
associate-*l*92.5%
Simplified92.5%
associate-+l-92.5%
associate-*r*97.8%
associate-*r*97.9%
associate-*r*92.6%
associate-*l*92.7%
*-commutative92.7%
Applied egg-rr92.7%
Taylor expanded in y around 0 69.7%
Taylor expanded in x around 0 63.5%
associate-*r*63.6%
*-commutative63.6%
associate-*l*63.6%
*-commutative63.6%
Simplified63.6%
Final simplification58.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (* 27.0 b))) (t_2 (* t (* y (* z -9.0)))))
(if (<= x -8.8e+91)
(* x 2.0)
(if (<= x -7.2e-158)
(* 27.0 (* a b))
(if (<= x -1.5e-242)
t_2
(if (<= x 2.65e-229)
t_1
(if (<= x 3.5e-151) t_2 (if (<= x 2.4e-36) t_1 (* x 2.0)))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double t_2 = t * (y * (z * -9.0));
double tmp;
if (x <= -8.8e+91) {
tmp = x * 2.0;
} else if (x <= -7.2e-158) {
tmp = 27.0 * (a * b);
} else if (x <= -1.5e-242) {
tmp = t_2;
} else if (x <= 2.65e-229) {
tmp = t_1;
} else if (x <= 3.5e-151) {
tmp = t_2;
} else if (x <= 2.4e-36) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = a * (27.0d0 * b)
t_2 = t * (y * (z * (-9.0d0)))
if (x <= (-8.8d+91)) then
tmp = x * 2.0d0
else if (x <= (-7.2d-158)) then
tmp = 27.0d0 * (a * b)
else if (x <= (-1.5d-242)) then
tmp = t_2
else if (x <= 2.65d-229) then
tmp = t_1
else if (x <= 3.5d-151) then
tmp = t_2
else if (x <= 2.4d-36) then
tmp = t_1
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double t_2 = t * (y * (z * -9.0));
double tmp;
if (x <= -8.8e+91) {
tmp = x * 2.0;
} else if (x <= -7.2e-158) {
tmp = 27.0 * (a * b);
} else if (x <= -1.5e-242) {
tmp = t_2;
} else if (x <= 2.65e-229) {
tmp = t_1;
} else if (x <= 3.5e-151) {
tmp = t_2;
} else if (x <= 2.4e-36) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = a * (27.0 * b) t_2 = t * (y * (z * -9.0)) tmp = 0 if x <= -8.8e+91: tmp = x * 2.0 elif x <= -7.2e-158: tmp = 27.0 * (a * b) elif x <= -1.5e-242: tmp = t_2 elif x <= 2.65e-229: tmp = t_1 elif x <= 3.5e-151: tmp = t_2 elif x <= 2.4e-36: tmp = t_1 else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(27.0 * b)) t_2 = Float64(t * Float64(y * Float64(z * -9.0))) tmp = 0.0 if (x <= -8.8e+91) tmp = Float64(x * 2.0); elseif (x <= -7.2e-158) tmp = Float64(27.0 * Float64(a * b)); elseif (x <= -1.5e-242) tmp = t_2; elseif (x <= 2.65e-229) tmp = t_1; elseif (x <= 3.5e-151) tmp = t_2; elseif (x <= 2.4e-36) tmp = t_1; else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = a * (27.0 * b);
t_2 = t * (y * (z * -9.0));
tmp = 0.0;
if (x <= -8.8e+91)
tmp = x * 2.0;
elseif (x <= -7.2e-158)
tmp = 27.0 * (a * b);
elseif (x <= -1.5e-242)
tmp = t_2;
elseif (x <= 2.65e-229)
tmp = t_1;
elseif (x <= 3.5e-151)
tmp = t_2;
elseif (x <= 2.4e-36)
tmp = t_1;
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.8e+91], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -7.2e-158], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.5e-242], t$95$2, If[LessEqual[x, 2.65e-229], t$95$1, If[LessEqual[x, 3.5e-151], t$95$2, If[LessEqual[x, 2.4e-36], t$95$1, N[(x * 2.0), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(27 \cdot b\right)\\
t_2 := t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\mathbf{if}\;x \leq -8.8 \cdot 10^{+91}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -7.2 \cdot 10^{-158}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-242}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 2.65 \cdot 10^{-229}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-151}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -8.79999999999999998e91 or 2.4e-36 < x Initial program 95.6%
sub-neg95.6%
distribute-lft-neg-in95.6%
associate-*l*95.6%
*-commutative95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.6%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in x around inf 57.7%
if -8.79999999999999998e91 < x < -7.19999999999999982e-158Initial program 90.4%
sub-neg90.4%
distribute-lft-neg-in90.4%
associate-*l*92.3%
*-commutative92.3%
*-commutative92.3%
cancel-sign-sub-inv92.3%
*-commutative92.3%
*-commutative92.3%
associate-*l*90.4%
associate-*l*92.4%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in a around inf 53.7%
if -7.19999999999999982e-158 < x < -1.5e-242 or 2.64999999999999999e-229 < x < 3.49999999999999995e-151Initial program 97.4%
sub-neg97.4%
distribute-lft-neg-in97.4%
associate-*l*97.2%
*-commutative97.2%
*-commutative97.2%
cancel-sign-sub-inv97.2%
*-commutative97.2%
*-commutative97.2%
associate-*l*97.4%
associate-*l*97.2%
associate-*l*97.2%
Simplified97.2%
Taylor expanded in y around inf 63.0%
*-commutative63.0%
associate-*l*62.9%
Simplified62.9%
Taylor expanded in t around 0 63.0%
*-commutative63.0%
associate-*l*62.9%
associate-*r*62.9%
Simplified62.9%
if -1.5e-242 < x < 2.64999999999999999e-229 or 3.49999999999999995e-151 < x < 2.4e-36Initial program 97.9%
sub-neg97.9%
distribute-lft-neg-in97.9%
associate-*l*97.9%
*-commutative97.9%
*-commutative97.9%
cancel-sign-sub-inv97.9%
*-commutative97.9%
*-commutative97.9%
associate-*l*97.9%
associate-*l*92.6%
associate-*l*92.5%
Simplified92.5%
associate-+l-92.5%
associate-*r*97.8%
associate-*r*97.9%
associate-*r*92.6%
associate-*l*92.7%
*-commutative92.7%
Applied egg-rr92.7%
Taylor expanded in y around 0 69.7%
Taylor expanded in x around 0 63.5%
associate-*r*63.6%
*-commutative63.6%
associate-*l*63.6%
*-commutative63.6%
Simplified63.6%
Final simplification58.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= t 3.9e+133) (+ (* x 2.0) (* 27.0 (* a b))) (- (* x 2.0) (* 9.0 (* t (* z y))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 3.9e+133) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if (t <= 3.9d+133) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = (x * 2.0d0) - (9.0d0 * (t * (z * y)))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 3.9e+133) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if t <= 3.9e+133: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = (x * 2.0) - (9.0 * (t * (z * y))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 3.9e+133) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(z * y)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (t <= 3.9e+133)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 3.9e+133], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.9 \cdot 10^{+133}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if t < 3.90000000000000014e133Initial program 95.0%
sub-neg95.0%
distribute-lft-neg-in95.0%
associate-*l*95.4%
*-commutative95.4%
*-commutative95.4%
cancel-sign-sub-inv95.4%
*-commutative95.4%
*-commutative95.4%
associate-*l*95.0%
associate-*l*95.0%
associate-*l*95.5%
Simplified95.5%
Taylor expanded in y around 0 69.6%
if 3.90000000000000014e133 < t Initial program 96.9%
sub-neg96.9%
distribute-lft-neg-in96.9%
associate-*l*97.0%
*-commutative97.0%
*-commutative97.0%
cancel-sign-sub-inv97.0%
*-commutative97.0%
*-commutative97.0%
associate-*l*96.9%
associate-*l*88.8%
associate-*l*88.7%
Simplified88.7%
Taylor expanded in a around 0 83.1%
Final simplification71.4%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= t 5e+164) (+ (* x 2.0) (* 27.0 (* a b))) (* t (* -9.0 (* z y)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 5e+164) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = t * (-9.0 * (z * y));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if (t <= 5d+164) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = t * ((-9.0d0) * (z * y))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 5e+164) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = t * (-9.0 * (z * y));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if t <= 5e+164: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = t * (-9.0 * (z * y)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 5e+164) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(t * Float64(-9.0 * Float64(z * y))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (t <= 5e+164)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = t * (-9.0 * (z * y));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 5e+164], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(-9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5 \cdot 10^{+164}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-9 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if t < 4.9999999999999995e164Initial program 95.0%
sub-neg95.0%
distribute-lft-neg-in95.0%
associate-*l*95.5%
*-commutative95.5%
*-commutative95.5%
cancel-sign-sub-inv95.5%
*-commutative95.5%
*-commutative95.5%
associate-*l*95.0%
associate-*l*94.2%
associate-*l*94.7%
Simplified94.7%
Taylor expanded in y around 0 69.4%
if 4.9999999999999995e164 < t Initial program 96.8%
sub-neg96.8%
distribute-lft-neg-in96.8%
associate-*l*96.8%
*-commutative96.8%
*-commutative96.8%
cancel-sign-sub-inv96.8%
*-commutative96.8%
*-commutative96.8%
associate-*l*96.8%
associate-*l*93.9%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in y around inf 57.6%
*-commutative57.6%
associate-*l*57.6%
Simplified57.6%
Final simplification67.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= x -3.1e+91) (* x 2.0) (if (<= x 2.4e-36) (* 27.0 (* a b)) (* x 2.0))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -3.1e+91) {
tmp = x * 2.0;
} else if (x <= 2.4e-36) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if (x <= (-3.1d+91)) then
tmp = x * 2.0d0
else if (x <= 2.4d-36) then
tmp = 27.0d0 * (a * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -3.1e+91) {
tmp = x * 2.0;
} else if (x <= 2.4e-36) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if x <= -3.1e+91: tmp = x * 2.0 elif x <= 2.4e-36: tmp = 27.0 * (a * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -3.1e+91) tmp = Float64(x * 2.0); elseif (x <= 2.4e-36) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (x <= -3.1e+91)
tmp = x * 2.0;
elseif (x <= 2.4e-36)
tmp = 27.0 * (a * b);
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -3.1e+91], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, 2.4e-36], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+91}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -3.09999999999999998e91 or 2.4e-36 < x Initial program 95.6%
sub-neg95.6%
distribute-lft-neg-in95.6%
associate-*l*95.6%
*-commutative95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.6%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in x around inf 57.7%
if -3.09999999999999998e91 < x < 2.4e-36Initial program 95.0%
sub-neg95.0%
distribute-lft-neg-in95.0%
associate-*l*95.7%
*-commutative95.7%
*-commutative95.7%
cancel-sign-sub-inv95.7%
*-commutative95.7%
*-commutative95.7%
associate-*l*95.0%
associate-*l*93.8%
associate-*l*94.4%
Simplified94.4%
Taylor expanded in a around inf 51.0%
Final simplification53.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= x -2.1e+91) (* x 2.0) (if (<= x 2.4e-36) (* a (* 27.0 b)) (* x 2.0))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.1e+91) {
tmp = x * 2.0;
} else if (x <= 2.4e-36) {
tmp = a * (27.0 * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if (x <= (-2.1d+91)) then
tmp = x * 2.0d0
else if (x <= 2.4d-36) then
tmp = a * (27.0d0 * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.1e+91) {
tmp = x * 2.0;
} else if (x <= 2.4e-36) {
tmp = a * (27.0 * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if x <= -2.1e+91: tmp = x * 2.0 elif x <= 2.4e-36: tmp = a * (27.0 * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -2.1e+91) tmp = Float64(x * 2.0); elseif (x <= 2.4e-36) tmp = Float64(a * Float64(27.0 * b)); else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (x <= -2.1e+91)
tmp = x * 2.0;
elseif (x <= 2.4e-36)
tmp = a * (27.0 * b);
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.1e+91], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, 2.4e-36], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+91}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -2.10000000000000008e91 or 2.4e-36 < x Initial program 95.6%
sub-neg95.6%
distribute-lft-neg-in95.6%
associate-*l*95.6%
*-commutative95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.6%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in x around inf 57.7%
if -2.10000000000000008e91 < x < 2.4e-36Initial program 95.0%
sub-neg95.0%
distribute-lft-neg-in95.0%
associate-*l*95.7%
*-commutative95.7%
*-commutative95.7%
cancel-sign-sub-inv95.7%
*-commutative95.7%
*-commutative95.7%
associate-*l*95.0%
associate-*l*93.8%
associate-*l*94.4%
Simplified94.4%
associate-+l-94.4%
associate-*r*95.7%
associate-*r*95.0%
associate-*r*93.8%
associate-*l*94.5%
*-commutative94.5%
Applied egg-rr94.5%
Taylor expanded in y around 0 60.0%
Taylor expanded in x around 0 51.0%
associate-*r*50.3%
*-commutative50.3%
associate-*l*51.0%
*-commutative51.0%
Simplified51.0%
Final simplification53.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (* x 2.0))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = x * 2.0d0
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): return x * 2.0
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp = code(x, y, z, t, a, b)
tmp = x * 2.0;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(x * 2.0), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
x \cdot 2
\end{array}
Initial program 95.3%
sub-neg95.3%
distribute-lft-neg-in95.3%
associate-*l*95.6%
*-commutative95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.3%
associate-*l*94.2%
associate-*l*94.6%
Simplified94.6%
Taylor expanded in x around inf 31.4%
Final simplification31.4%
(FPCore (x y z t a b) :precision binary64 (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if (y < 7.590524218811189d-161) then
tmp = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + (a * (27.0d0 * b))
else
tmp = ((x * 2.0d0) - (9.0d0 * (y * (t * z)))) + ((a * 27.0d0) * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y < 7.590524218811189e-161: tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)) else: tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y < 7.590524218811189e-161) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(t * z)))) + Float64(Float64(a * 27.0) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y < 7.590524218811189e-161) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)); else tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Less[y, 7.590524218811189e-161], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
herbie shell --seed 2023279
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b)))
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))