
(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 16 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 (if (<= z 7.5e+32) (+ (- (* x 2.0) (* 9.0 (* y (* z t)))) (* a (* 27.0 b))) (fma a (* 27.0 b) (fma 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 <= 7.5e+32) {
tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + (a * (27.0 * b));
} else {
tmp = fma(a, (27.0 * b), fma(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 <= 7.5e+32) tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))) + Float64(a * Float64(27.0 * b))); else tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(t * Float64(Float64(z * 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_] := If[LessEqual[z, 7.5e+32], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(t * N[(N[(z * y), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7.5 \cdot 10^{+32}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, t \cdot \left(\left(z \cdot y\right) \cdot -9\right)\right)\right)\\
\end{array}
\end{array}
if z < 7.49999999999999959e32Initial program 95.9%
sub-neg95.9%
sub-neg95.9%
associate-*l*95.3%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in y around 0 95.4%
*-commutative95.4%
associate-*l*94.8%
*-commutative94.8%
Simplified94.8%
if 7.49999999999999959e32 < z Initial program 85.7%
+-commutative85.7%
associate-+r-85.7%
*-commutative85.7%
cancel-sign-sub-inv85.7%
associate-*r*97.7%
distribute-lft-neg-in97.7%
*-commutative97.7%
cancel-sign-sub-inv97.7%
associate-+r-97.7%
associate-*l*97.7%
fma-def99.8%
cancel-sign-sub-inv99.8%
fma-def99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
*-commutative99.8%
associate-*r*87.8%
distribute-rgt-neg-out87.8%
*-commutative87.8%
associate-*r*87.8%
Simplified87.8%
Final simplification93.5%
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 6.4e+56) (+ (- (* x 2.0) (* 9.0 (* y (* z t)))) (* a (* 27.0 b))) (+ (* z (* -9.0 (* y t))) (* 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 (z <= 6.4e+56) {
tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + (a * (27.0 * b));
} else {
tmp = (z * (-9.0 * (y * t))) + (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 (z <= 6.4d+56) then
tmp = ((x * 2.0d0) - (9.0d0 * (y * (z * t)))) + (a * (27.0d0 * b))
else
tmp = (z * ((-9.0d0) * (y * t))) + (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 (z <= 6.4e+56) {
tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + (a * (27.0 * b));
} else {
tmp = (z * (-9.0 * (y * t))) + (x * 2.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= 6.4e+56: tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + (a * (27.0 * b)) else: tmp = (z * (-9.0 * (y * t))) + (x * 2.0) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 6.4e+56) tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(z * Float64(-9.0 * Float64(y * t))) + 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 (z <= 6.4e+56)
tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + (a * (27.0 * b));
else
tmp = (z * (-9.0 * (y * t))) + (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[z, 6.4e+56], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(-9.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.4 \cdot 10^{+56}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-9 \cdot \left(y \cdot t\right)\right) + x \cdot 2\\
\end{array}
\end{array}
if z < 6.40000000000000007e56Initial program 96.0%
sub-neg96.0%
sub-neg96.0%
associate-*l*95.4%
associate-*l*94.9%
Simplified94.9%
Taylor expanded in y around 0 95.4%
*-commutative95.4%
associate-*l*94.9%
*-commutative94.9%
Simplified94.9%
if 6.40000000000000007e56 < z Initial program 85.0%
sub-neg85.0%
sub-neg85.0%
associate-*l*93.6%
associate-*l*93.6%
Simplified93.6%
Taylor expanded in a around 0 69.1%
expm1-log1p-u43.7%
expm1-udef43.7%
*-commutative43.7%
associate-*r*47.2%
Applied egg-rr47.2%
expm1-def47.3%
expm1-log1p75.5%
*-commutative75.5%
associate-*l*79.4%
Simplified79.4%
sub-neg79.4%
+-commutative79.4%
distribute-lft-neg-in79.4%
metadata-eval79.4%
associate-*r*79.4%
*-commutative79.4%
associate-*l*79.5%
Applied egg-rr79.5%
Final simplification92.2%
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 6.1e+31)
(+ (- (* x 2.0) (* 9.0 (* y (* z t)))) t_1)
(+ t_1 (- (* x 2.0) (* (* z y) (* 9.0 t)))))))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 <= 6.1e+31) {
tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + t_1;
} else {
tmp = t_1 + ((x * 2.0) - ((z * y) * (9.0 * t)));
}
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) :: tmp
t_1 = a * (27.0d0 * b)
if (z <= 6.1d+31) then
tmp = ((x * 2.0d0) - (9.0d0 * (y * (z * t)))) + t_1
else
tmp = t_1 + ((x * 2.0d0) - ((z * y) * (9.0d0 * t)))
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 tmp;
if (z <= 6.1e+31) {
tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + t_1;
} else {
tmp = t_1 + ((x * 2.0) - ((z * y) * (9.0 * t)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = a * (27.0 * b) tmp = 0 if z <= 6.1e+31: tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + t_1 else: tmp = t_1 + ((x * 2.0) - ((z * y) * (9.0 * t))) 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)) tmp = 0.0 if (z <= 6.1e+31) tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))) + t_1); else tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(Float64(z * y) * Float64(9.0 * t)))); 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);
tmp = 0.0;
if (z <= 6.1e+31)
tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + t_1;
else
tmp = t_1 + ((x * 2.0) - ((z * y) * (9.0 * t)));
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]}, If[LessEqual[z, 6.1e+31], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(27 \cdot b\right)\\
\mathbf{if}\;z \leq 6.1 \cdot 10^{+31}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right) + t_1\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - \left(z \cdot y\right) \cdot \left(9 \cdot t\right)\right)\\
\end{array}
\end{array}
if z < 6.10000000000000009e31Initial program 95.9%
sub-neg95.9%
sub-neg95.9%
associate-*l*95.3%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in y around 0 95.4%
*-commutative95.4%
associate-*l*94.8%
*-commutative94.8%
Simplified94.8%
if 6.10000000000000009e31 < z Initial program 85.7%
sub-neg85.7%
sub-neg85.7%
associate-*l*93.9%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in y around 0 85.7%
associate-*r*85.6%
Simplified85.6%
Final simplification93.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 -3e-123) (+ (- (* x 2.0) (* 9.0 (* y (* z t)))) (* a (* 27.0 b))) (+ (- (* x 2.0) (* t (* 9.0 (* z y)))) (* b (* a 27.0)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3e-123) {
tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (t * (9.0 * (z * y)))) + (b * (a * 27.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 <= (-3d-123)) then
tmp = ((x * 2.0d0) - (9.0d0 * (y * (z * t)))) + (a * (27.0d0 * b))
else
tmp = ((x * 2.0d0) - (t * (9.0d0 * (z * y)))) + (b * (a * 27.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 <= -3e-123) {
tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (t * (9.0 * (z * y)))) + (b * (a * 27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -3e-123: tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + (a * (27.0 * b)) else: tmp = ((x * 2.0) - (t * (9.0 * (z * y)))) + (b * (a * 27.0)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3e-123) tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(z * y)))) + Float64(b * Float64(a * 27.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 <= -3e-123)
tmp = ((x * 2.0) - (9.0 * (y * (z * t)))) + (a * (27.0 * b));
else
tmp = ((x * 2.0) - (t * (9.0 * (z * y)))) + (b * (a * 27.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, -3e-123], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{-123}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(9 \cdot \left(z \cdot y\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if z < -2.99999999999999984e-123Initial program 92.5%
sub-neg92.5%
sub-neg92.5%
associate-*l*90.4%
associate-*l*90.4%
Simplified90.4%
Taylor expanded in y around 0 92.4%
*-commutative92.4%
associate-*l*90.3%
*-commutative90.3%
Simplified90.3%
if -2.99999999999999984e-123 < z Initial program 95.0%
Taylor expanded in y around 0 94.9%
Final simplification93.3%
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 -1000.0) (+ (* a (* 27.0 b)) (- (* x 2.0) (* (* 9.0 y) (* z t)))) (+ (- (* x 2.0) (* t (* z (* 9.0 y)))) (* b (* a 27.0)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1000.0) {
tmp = (a * (27.0 * b)) + ((x * 2.0) - ((9.0 * y) * (z * t)));
} else {
tmp = ((x * 2.0) - (t * (z * (9.0 * y)))) + (b * (a * 27.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 <= (-1000.0d0)) then
tmp = (a * (27.0d0 * b)) + ((x * 2.0d0) - ((9.0d0 * y) * (z * t)))
else
tmp = ((x * 2.0d0) - (t * (z * (9.0d0 * y)))) + (b * (a * 27.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 <= -1000.0) {
tmp = (a * (27.0 * b)) + ((x * 2.0) - ((9.0 * y) * (z * t)));
} else {
tmp = ((x * 2.0) - (t * (z * (9.0 * y)))) + (b * (a * 27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -1000.0: tmp = (a * (27.0 * b)) + ((x * 2.0) - ((9.0 * y) * (z * t))) else: tmp = ((x * 2.0) - (t * (z * (9.0 * y)))) + (b * (a * 27.0)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1000.0) tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(Float64(x * 2.0) - Float64(Float64(9.0 * y) * Float64(z * t)))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(9.0 * y)))) + Float64(b * Float64(a * 27.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 <= -1000.0)
tmp = (a * (27.0 * b)) + ((x * 2.0) - ((9.0 * y) * (z * t)));
else
tmp = ((x * 2.0) - (t * (z * (9.0 * y)))) + (b * (a * 27.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, -1000.0], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(9.0 * y), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(9.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1000:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 - \left(9 \cdot y\right) \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(z \cdot \left(9 \cdot y\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if z < -1e3Initial program 89.5%
sub-neg89.5%
sub-neg89.5%
associate-*l*86.5%
associate-*l*86.5%
Simplified86.5%
if -1e3 < z Initial program 95.6%
Final simplification93.3%
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 (* b (* a 27.0))) (t_2 (* -9.0 (* t (* z y)))))
(if (<= z -1.45e-62)
t_2
(if (<= z -2.75e-179)
(* x 2.0)
(if (<= z -1.5e-259)
t_1
(if (<= z 2.25e-191) (* x 2.0) (if (<= z 3.3e-25) t_1 t_2)))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a * 27.0);
double t_2 = -9.0 * (t * (z * y));
double tmp;
if (z <= -1.45e-62) {
tmp = t_2;
} else if (z <= -2.75e-179) {
tmp = x * 2.0;
} else if (z <= -1.5e-259) {
tmp = t_1;
} else if (z <= 2.25e-191) {
tmp = x * 2.0;
} else if (z <= 3.3e-25) {
tmp = t_1;
} 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 = b * (a * 27.0d0)
t_2 = (-9.0d0) * (t * (z * y))
if (z <= (-1.45d-62)) then
tmp = t_2
else if (z <= (-2.75d-179)) then
tmp = x * 2.0d0
else if (z <= (-1.5d-259)) then
tmp = t_1
else if (z <= 2.25d-191) then
tmp = x * 2.0d0
else if (z <= 3.3d-25) then
tmp = t_1
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 = b * (a * 27.0);
double t_2 = -9.0 * (t * (z * y));
double tmp;
if (z <= -1.45e-62) {
tmp = t_2;
} else if (z <= -2.75e-179) {
tmp = x * 2.0;
} else if (z <= -1.5e-259) {
tmp = t_1;
} else if (z <= 2.25e-191) {
tmp = x * 2.0;
} else if (z <= 3.3e-25) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = b * (a * 27.0) t_2 = -9.0 * (t * (z * y)) tmp = 0 if z <= -1.45e-62: tmp = t_2 elif z <= -2.75e-179: tmp = x * 2.0 elif z <= -1.5e-259: tmp = t_1 elif z <= 2.25e-191: tmp = x * 2.0 elif z <= 3.3e-25: tmp = t_1 else: tmp = t_2 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a * 27.0)) t_2 = Float64(-9.0 * Float64(t * Float64(z * y))) tmp = 0.0 if (z <= -1.45e-62) tmp = t_2; elseif (z <= -2.75e-179) tmp = Float64(x * 2.0); elseif (z <= -1.5e-259) tmp = t_1; elseif (z <= 2.25e-191) tmp = Float64(x * 2.0); elseif (z <= 3.3e-25) tmp = t_1; 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 = b * (a * 27.0);
t_2 = -9.0 * (t * (z * y));
tmp = 0.0;
if (z <= -1.45e-62)
tmp = t_2;
elseif (z <= -2.75e-179)
tmp = x * 2.0;
elseif (z <= -1.5e-259)
tmp = t_1;
elseif (z <= 2.25e-191)
tmp = x * 2.0;
elseif (z <= 3.3e-25)
tmp = t_1;
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[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.45e-62], t$95$2, If[LessEqual[z, -2.75e-179], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, -1.5e-259], t$95$1, If[LessEqual[z, 2.25e-191], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 3.3e-25], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
t_2 := -9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{-62}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -2.75 \cdot 10^{-179}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-259}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-191}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-25}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -1.44999999999999993e-62 or 3.2999999999999998e-25 < z Initial program 89.8%
sub-neg89.8%
sub-neg89.8%
associate-*l*91.2%
associate-*l*91.3%
Simplified91.3%
Taylor expanded in y around inf 50.7%
if -1.44999999999999993e-62 < z < -2.7500000000000001e-179 or -1.5000000000000001e-259 < z < 2.25000000000000004e-191Initial program 99.9%
sub-neg99.9%
sub-neg99.9%
associate-*l*99.8%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in x around inf 44.7%
if -2.7500000000000001e-179 < z < -1.5000000000000001e-259 or 2.25000000000000004e-191 < z < 3.2999999999999998e-25Initial program 97.2%
sub-neg97.2%
sub-neg97.2%
associate-*l*98.7%
associate-*l*96.8%
Simplified96.8%
Taylor expanded in y around 0 74.4%
Taylor expanded in x around 0 49.9%
associate-*r*49.9%
*-commutative49.9%
Simplified49.9%
Final simplification48.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 (* b (* a 27.0))))
(if (<= z -3.7e-62)
(* -9.0 (* z (* y t)))
(if (<= z -8.5e-180)
(* x 2.0)
(if (<= z -1.02e-253)
t_1
(if (<= z 9.5e-192)
(* x 2.0)
(if (<= z 7.5e-23) t_1 (* -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 t_1 = b * (a * 27.0);
double tmp;
if (z <= -3.7e-62) {
tmp = -9.0 * (z * (y * t));
} else if (z <= -8.5e-180) {
tmp = x * 2.0;
} else if (z <= -1.02e-253) {
tmp = t_1;
} else if (z <= 9.5e-192) {
tmp = x * 2.0;
} else if (z <= 7.5e-23) {
tmp = t_1;
} else {
tmp = -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) :: t_1
real(8) :: tmp
t_1 = b * (a * 27.0d0)
if (z <= (-3.7d-62)) then
tmp = (-9.0d0) * (z * (y * t))
else if (z <= (-8.5d-180)) then
tmp = x * 2.0d0
else if (z <= (-1.02d-253)) then
tmp = t_1
else if (z <= 9.5d-192) then
tmp = x * 2.0d0
else if (z <= 7.5d-23) then
tmp = t_1
else
tmp = (-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 t_1 = b * (a * 27.0);
double tmp;
if (z <= -3.7e-62) {
tmp = -9.0 * (z * (y * t));
} else if (z <= -8.5e-180) {
tmp = x * 2.0;
} else if (z <= -1.02e-253) {
tmp = t_1;
} else if (z <= 9.5e-192) {
tmp = x * 2.0;
} else if (z <= 7.5e-23) {
tmp = t_1;
} else {
tmp = -9.0 * (t * (z * y));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = b * (a * 27.0) tmp = 0 if z <= -3.7e-62: tmp = -9.0 * (z * (y * t)) elif z <= -8.5e-180: tmp = x * 2.0 elif z <= -1.02e-253: tmp = t_1 elif z <= 9.5e-192: tmp = x * 2.0 elif z <= 7.5e-23: tmp = t_1 else: tmp = -9.0 * (t * (z * y)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a * 27.0)) tmp = 0.0 if (z <= -3.7e-62) tmp = Float64(-9.0 * Float64(z * Float64(y * t))); elseif (z <= -8.5e-180) tmp = Float64(x * 2.0); elseif (z <= -1.02e-253) tmp = t_1; elseif (z <= 9.5e-192) tmp = Float64(x * 2.0); elseif (z <= 7.5e-23) tmp = t_1; else tmp = 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)
t_1 = b * (a * 27.0);
tmp = 0.0;
if (z <= -3.7e-62)
tmp = -9.0 * (z * (y * t));
elseif (z <= -8.5e-180)
tmp = x * 2.0;
elseif (z <= -1.02e-253)
tmp = t_1;
elseif (z <= 9.5e-192)
tmp = x * 2.0;
elseif (z <= 7.5e-23)
tmp = t_1;
else
tmp = -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_] := Block[{t$95$1 = N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.7e-62], N[(-9.0 * N[(z * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -8.5e-180], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, -1.02e-253], t$95$1, If[LessEqual[z, 9.5e-192], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 7.5e-23], t$95$1, N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;z \leq -3.7 \cdot 10^{-62}:\\
\;\;\;\;-9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{-180}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-253}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-192}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-23}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < -3.6999999999999998e-62Initial program 90.9%
Taylor expanded in y around 0 90.9%
Taylor expanded in y around inf 51.3%
*-commutative51.3%
*-commutative51.3%
associate-*l*53.3%
*-commutative53.3%
Simplified53.3%
if -3.6999999999999998e-62 < z < -8.4999999999999993e-180 or -1.02e-253 < z < 9.4999999999999996e-192Initial program 99.9%
sub-neg99.9%
sub-neg99.9%
associate-*l*99.8%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in x around inf 45.5%
if -8.4999999999999993e-180 < z < -1.02e-253 or 9.4999999999999996e-192 < z < 7.4999999999999998e-23Initial program 97.2%
sub-neg97.2%
sub-neg97.2%
associate-*l*98.7%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in y around 0 73.9%
Taylor expanded in x around 0 50.8%
associate-*r*50.8%
*-commutative50.8%
Simplified50.8%
if 7.4999999999999998e-23 < z Initial program 88.4%
sub-neg88.4%
sub-neg88.4%
associate-*l*95.1%
associate-*l*95.0%
Simplified95.0%
Taylor expanded in y around inf 50.0%
Final simplification49.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 (or (<= z -1.56e-62) (not (<= z 1.5e-28))) (+ (* z (* -9.0 (* y t))) (* x 2.0)) (+ (* x 2.0) (* 27.0 (* a b)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.56e-62) || !(z <= 1.5e-28)) {
tmp = (z * (-9.0 * (y * t))) + (x * 2.0);
} else {
tmp = (x * 2.0) + (27.0 * (a * b));
}
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 <= (-1.56d-62)) .or. (.not. (z <= 1.5d-28))) then
tmp = (z * ((-9.0d0) * (y * t))) + (x * 2.0d0)
else
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
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 <= -1.56e-62) || !(z <= 1.5e-28)) {
tmp = (z * (-9.0 * (y * t))) + (x * 2.0);
} else {
tmp = (x * 2.0) + (27.0 * (a * b));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.56e-62) or not (z <= 1.5e-28): tmp = (z * (-9.0 * (y * t))) + (x * 2.0) else: tmp = (x * 2.0) + (27.0 * (a * b)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.56e-62) || !(z <= 1.5e-28)) tmp = Float64(Float64(z * Float64(-9.0 * Float64(y * t))) + Float64(x * 2.0)); else tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); 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 <= -1.56e-62) || ~((z <= 1.5e-28)))
tmp = (z * (-9.0 * (y * t))) + (x * 2.0);
else
tmp = (x * 2.0) + (27.0 * (a * b));
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[Or[LessEqual[z, -1.56e-62], N[Not[LessEqual[z, 1.5e-28]], $MachinePrecision]], N[(N[(z * N[(-9.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.56 \cdot 10^{-62} \lor \neg \left(z \leq 1.5 \cdot 10^{-28}\right):\\
\;\;\;\;z \cdot \left(-9 \cdot \left(y \cdot t\right)\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if z < -1.56000000000000009e-62 or 1.50000000000000001e-28 < z Initial program 89.8%
sub-neg89.8%
sub-neg89.8%
associate-*l*91.2%
associate-*l*91.3%
Simplified91.3%
Taylor expanded in a around 0 74.5%
expm1-log1p-u50.9%
expm1-udef47.2%
*-commutative47.2%
associate-*r*49.1%
Applied egg-rr49.1%
expm1-def52.7%
expm1-log1p75.9%
*-commutative75.9%
associate-*l*79.5%
Simplified79.5%
sub-neg79.5%
+-commutative79.5%
distribute-lft-neg-in79.5%
metadata-eval79.5%
associate-*r*79.5%
*-commutative79.5%
associate-*l*79.6%
Applied egg-rr79.6%
if -1.56000000000000009e-62 < z < 1.50000000000000001e-28Initial program 98.8%
sub-neg98.8%
sub-neg98.8%
associate-*l*99.3%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in y around 0 76.4%
Final simplification78.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 -3e-62)
(+ (* x 2.0) (* z (* t (* y -9.0))))
(if (<= z 1.1e-22)
(+ (* x 2.0) (* 27.0 (* a b)))
(+ (* z (* -9.0 (* y t))) (* 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 (z <= -3e-62) {
tmp = (x * 2.0) + (z * (t * (y * -9.0)));
} else if (z <= 1.1e-22) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (z * (-9.0 * (y * t))) + (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 (z <= (-3d-62)) then
tmp = (x * 2.0d0) + (z * (t * (y * (-9.0d0))))
else if (z <= 1.1d-22) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = (z * ((-9.0d0) * (y * t))) + (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 (z <= -3e-62) {
tmp = (x * 2.0) + (z * (t * (y * -9.0)));
} else if (z <= 1.1e-22) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (z * (-9.0 * (y * t))) + (x * 2.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -3e-62: tmp = (x * 2.0) + (z * (t * (y * -9.0))) elif z <= 1.1e-22: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = (z * (-9.0 * (y * t))) + (x * 2.0) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3e-62) tmp = Float64(Float64(x * 2.0) + Float64(z * Float64(t * Float64(y * -9.0)))); elseif (z <= 1.1e-22) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(Float64(z * Float64(-9.0 * Float64(y * t))) + 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 (z <= -3e-62)
tmp = (x * 2.0) + (z * (t * (y * -9.0)));
elseif (z <= 1.1e-22)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = (z * (-9.0 * (y * t))) + (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[z, -3e-62], N[(N[(x * 2.0), $MachinePrecision] + N[(z * N[(t * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1e-22], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(-9.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{-62}:\\
\;\;\;\;x \cdot 2 + z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-22}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-9 \cdot \left(y \cdot t\right)\right) + x \cdot 2\\
\end{array}
\end{array}
if z < -3.0000000000000001e-62Initial program 90.9%
sub-neg90.9%
sub-neg90.9%
associate-*l*88.4%
associate-*l*88.4%
Simplified88.4%
Taylor expanded in a around 0 74.6%
expm1-log1p-u53.3%
expm1-udef46.9%
*-commutative46.9%
associate-*r*48.1%
Applied egg-rr48.1%
expm1-def54.5%
expm1-log1p73.4%
*-commutative73.4%
associate-*l*78.5%
Simplified78.5%
sub-neg78.5%
+-commutative78.5%
distribute-lft-neg-in78.5%
metadata-eval78.5%
associate-*r*78.4%
*-commutative78.4%
associate-*l*78.5%
Applied egg-rr78.5%
expm1-log1p-u64.9%
expm1-udef50.6%
*-commutative50.6%
associate-*l*50.6%
Applied egg-rr50.6%
expm1-def64.9%
expm1-log1p78.4%
*-commutative78.4%
Simplified78.4%
if -3.0000000000000001e-62 < z < 1.1e-22Initial program 98.8%
sub-neg98.8%
sub-neg98.8%
associate-*l*99.3%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in y around 0 76.4%
if 1.1e-22 < z Initial program 88.4%
sub-neg88.4%
sub-neg88.4%
associate-*l*95.1%
associate-*l*95.0%
Simplified95.0%
Taylor expanded in a around 0 74.3%
expm1-log1p-u47.7%
expm1-udef47.7%
*-commutative47.7%
associate-*r*50.4%
Applied egg-rr50.4%
expm1-def50.4%
expm1-log1p79.3%
*-commutative79.3%
associate-*l*80.9%
Simplified80.9%
sub-neg80.9%
+-commutative80.9%
distribute-lft-neg-in80.9%
metadata-eval80.9%
associate-*r*80.9%
*-commutative80.9%
associate-*l*81.0%
Applied egg-rr81.0%
Final simplification78.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 -1.9e-62)
(+ (* x 2.0) (* z (* t (* y -9.0))))
(if (<= z 3.8e-28)
(+ (* 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 (z <= -1.9e-62) {
tmp = (x * 2.0) + (z * (t * (y * -9.0)));
} else if (z <= 3.8e-28) {
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 (z <= (-1.9d-62)) then
tmp = (x * 2.0d0) + (z * (t * (y * (-9.0d0))))
else if (z <= 3.8d-28) 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 (z <= -1.9e-62) {
tmp = (x * 2.0) + (z * (t * (y * -9.0)));
} else if (z <= 3.8e-28) {
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 z <= -1.9e-62: tmp = (x * 2.0) + (z * (t * (y * -9.0))) elif z <= 3.8e-28: 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 (z <= -1.9e-62) tmp = Float64(Float64(x * 2.0) + Float64(z * Float64(t * Float64(y * -9.0)))); elseif (z <= 3.8e-28) 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 (z <= -1.9e-62)
tmp = (x * 2.0) + (z * (t * (y * -9.0)));
elseif (z <= 3.8e-28)
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[z, -1.9e-62], N[(N[(x * 2.0), $MachinePrecision] + N[(z * N[(t * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e-28], 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}\;z \leq -1.9 \cdot 10^{-62}:\\
\;\;\;\;x \cdot 2 + z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-28}:\\
\;\;\;\;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 z < -1.90000000000000003e-62Initial program 90.9%
sub-neg90.9%
sub-neg90.9%
associate-*l*88.4%
associate-*l*88.4%
Simplified88.4%
Taylor expanded in a around 0 74.6%
expm1-log1p-u53.3%
expm1-udef46.9%
*-commutative46.9%
associate-*r*48.1%
Applied egg-rr48.1%
expm1-def54.5%
expm1-log1p73.4%
*-commutative73.4%
associate-*l*78.5%
Simplified78.5%
sub-neg78.5%
+-commutative78.5%
distribute-lft-neg-in78.5%
metadata-eval78.5%
associate-*r*78.4%
*-commutative78.4%
associate-*l*78.5%
Applied egg-rr78.5%
expm1-log1p-u64.9%
expm1-udef50.6%
*-commutative50.6%
associate-*l*50.6%
Applied egg-rr50.6%
expm1-def64.9%
expm1-log1p78.4%
*-commutative78.4%
Simplified78.4%
if -1.90000000000000003e-62 < z < 3.80000000000000009e-28Initial program 98.8%
sub-neg98.8%
sub-neg98.8%
associate-*l*99.3%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in y around 0 76.4%
if 3.80000000000000009e-28 < z Initial program 88.4%
sub-neg88.4%
sub-neg88.4%
associate-*l*95.1%
associate-*l*95.0%
Simplified95.0%
Taylor expanded in a around 0 74.3%
Final simplification76.5%
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 -1.55e-62)
(+ (* z (* -9.0 (* y t))) (* b (* a 27.0)))
(if (<= z 1.45e-28)
(+ (* 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 (z <= -1.55e-62) {
tmp = (z * (-9.0 * (y * t))) + (b * (a * 27.0));
} else if (z <= 1.45e-28) {
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 (z <= (-1.55d-62)) then
tmp = (z * ((-9.0d0) * (y * t))) + (b * (a * 27.0d0))
else if (z <= 1.45d-28) 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 (z <= -1.55e-62) {
tmp = (z * (-9.0 * (y * t))) + (b * (a * 27.0));
} else if (z <= 1.45e-28) {
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 z <= -1.55e-62: tmp = (z * (-9.0 * (y * t))) + (b * (a * 27.0)) elif z <= 1.45e-28: 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 (z <= -1.55e-62) tmp = Float64(Float64(z * Float64(-9.0 * Float64(y * t))) + Float64(b * Float64(a * 27.0))); elseif (z <= 1.45e-28) 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 (z <= -1.55e-62)
tmp = (z * (-9.0 * (y * t))) + (b * (a * 27.0));
elseif (z <= 1.45e-28)
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[z, -1.55e-62], N[(N[(z * N[(-9.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e-28], 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}\;z \leq -1.55 \cdot 10^{-62}:\\
\;\;\;\;z \cdot \left(-9 \cdot \left(y \cdot t\right)\right) + b \cdot \left(a \cdot 27\right)\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-28}:\\
\;\;\;\;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 z < -1.55e-62Initial program 90.9%
sub-neg90.9%
sub-neg90.9%
associate-*l*88.4%
associate-*l*88.4%
Simplified88.4%
Taylor expanded in x around 0 67.3%
*-commutative67.3%
associate-*r*69.2%
*-commutative69.2%
*-commutative69.2%
sub-neg69.2%
+-commutative69.2%
distribute-lft-neg-in69.2%
metadata-eval69.2%
associate-*r*69.2%
*-commutative69.2%
associate-*l*69.3%
associate-*r*69.3%
*-commutative69.3%
Applied egg-rr69.3%
if -1.55e-62 < z < 1.45000000000000006e-28Initial program 98.8%
sub-neg98.8%
sub-neg98.8%
associate-*l*99.3%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in y around 0 76.4%
if 1.45000000000000006e-28 < z Initial program 88.4%
sub-neg88.4%
sub-neg88.4%
associate-*l*95.1%
associate-*l*95.0%
Simplified95.0%
Taylor expanded in a around 0 74.3%
Final simplification73.8%
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.5e-6) (* y (* t (* z -9.0))) (if (<= z 1.95e-22) (+ (* x 2.0) (* 27.0 (* a b))) (* -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.5e-6) {
tmp = y * (t * (z * -9.0));
} else if (z <= 1.95e-22) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = -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.5d-6)) then
tmp = y * (t * (z * (-9.0d0)))
else if (z <= 1.95d-22) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = (-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.5e-6) {
tmp = y * (t * (z * -9.0));
} else if (z <= 1.95e-22) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = -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.5e-6: tmp = y * (t * (z * -9.0)) elif z <= 1.95e-22: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = -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.5e-6) tmp = Float64(y * Float64(t * Float64(z * -9.0))); elseif (z <= 1.95e-22) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = 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.5e-6)
tmp = y * (t * (z * -9.0));
elseif (z <= 1.95e-22)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = -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.5e-6], N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.95e-22], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{-6}:\\
\;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{-22}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < -4.50000000000000011e-6Initial program 89.5%
Taylor expanded in y around 0 89.4%
Taylor expanded in y around inf 57.9%
*-commutative57.9%
associate-*r*57.9%
*-commutative57.9%
associate-*l*57.9%
associate-*l*56.6%
Simplified56.6%
if -4.50000000000000011e-6 < z < 1.94999999999999999e-22Initial program 98.8%
sub-neg98.8%
sub-neg98.8%
associate-*l*99.4%
associate-*l*98.6%
Simplified98.6%
Taylor expanded in y around 0 78.3%
if 1.94999999999999999e-22 < z Initial program 88.4%
sub-neg88.4%
sub-neg88.4%
associate-*l*95.1%
associate-*l*95.0%
Simplified95.0%
Taylor expanded in y around inf 50.0%
Final simplification66.3%
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 (or (<= b -2.2e-93) (not (<= b 3.7e-9))) (* 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 ((b <= -2.2e-93) || !(b <= 3.7e-9)) {
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 ((b <= (-2.2d-93)) .or. (.not. (b <= 3.7d-9))) 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 ((b <= -2.2e-93) || !(b <= 3.7e-9)) {
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 (b <= -2.2e-93) or not (b <= 3.7e-9): 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 ((b <= -2.2e-93) || !(b <= 3.7e-9)) 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 ((b <= -2.2e-93) || ~((b <= 3.7e-9)))
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[Or[LessEqual[b, -2.2e-93], N[Not[LessEqual[b, 3.7e-9]], $MachinePrecision]], 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}\;b \leq -2.2 \cdot 10^{-93} \lor \neg \left(b \leq 3.7 \cdot 10^{-9}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if b < -2.19999999999999996e-93 or 3.7e-9 < b Initial program 92.9%
sub-neg92.9%
sub-neg92.9%
associate-*l*94.0%
associate-*l*93.4%
Simplified93.4%
Taylor expanded in a around inf 48.4%
if -2.19999999999999996e-93 < b < 3.7e-9Initial program 95.7%
sub-neg95.7%
sub-neg95.7%
associate-*l*96.6%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in x around inf 43.8%
Final simplification46.5%
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 (<= b -1.35e-92) (* 27.0 (* a b)) (if (<= b 3.8e-9) (* x 2.0) (* a (* 27.0 b)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.35e-92) {
tmp = 27.0 * (a * b);
} else if (b <= 3.8e-9) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
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 (b <= (-1.35d-92)) then
tmp = 27.0d0 * (a * b)
else if (b <= 3.8d-9) then
tmp = x * 2.0d0
else
tmp = a * (27.0d0 * b)
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 (b <= -1.35e-92) {
tmp = 27.0 * (a * b);
} else if (b <= 3.8e-9) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if b <= -1.35e-92: tmp = 27.0 * (a * b) elif b <= 3.8e-9: tmp = x * 2.0 else: tmp = a * (27.0 * b) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.35e-92) tmp = Float64(27.0 * Float64(a * b)); elseif (b <= 3.8e-9) tmp = Float64(x * 2.0); else tmp = Float64(a * Float64(27.0 * b)); 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 (b <= -1.35e-92)
tmp = 27.0 * (a * b);
elseif (b <= 3.8e-9)
tmp = x * 2.0;
else
tmp = a * (27.0 * b);
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[b, -1.35e-92], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.8e-9], N[(x * 2.0), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.35 \cdot 10^{-92}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-9}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\end{array}
\end{array}
if b < -1.34999999999999998e-92Initial program 92.5%
sub-neg92.5%
sub-neg92.5%
associate-*l*94.9%
associate-*l*94.9%
Simplified94.9%
Taylor expanded in a around inf 41.0%
if -1.34999999999999998e-92 < b < 3.80000000000000011e-9Initial program 95.7%
sub-neg95.7%
sub-neg95.7%
associate-*l*96.6%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in x around inf 43.8%
if 3.80000000000000011e-9 < b Initial program 93.4%
sub-neg93.4%
sub-neg93.4%
associate-*l*93.1%
associate-*l*91.7%
Simplified91.7%
Taylor expanded in a around inf 56.2%
associate-*r*56.3%
*-commutative56.3%
associate-*r*56.2%
Simplified56.2%
Final simplification46.5%
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 (<= b -1.25e-92) (* b (* a 27.0)) (if (<= b 2e-8) (* x 2.0) (* a (* 27.0 b)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.25e-92) {
tmp = b * (a * 27.0);
} else if (b <= 2e-8) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
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 (b <= (-1.25d-92)) then
tmp = b * (a * 27.0d0)
else if (b <= 2d-8) then
tmp = x * 2.0d0
else
tmp = a * (27.0d0 * b)
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 (b <= -1.25e-92) {
tmp = b * (a * 27.0);
} else if (b <= 2e-8) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if b <= -1.25e-92: tmp = b * (a * 27.0) elif b <= 2e-8: tmp = x * 2.0 else: tmp = a * (27.0 * b) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.25e-92) tmp = Float64(b * Float64(a * 27.0)); elseif (b <= 2e-8) tmp = Float64(x * 2.0); else tmp = Float64(a * Float64(27.0 * b)); 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 (b <= -1.25e-92)
tmp = b * (a * 27.0);
elseif (b <= 2e-8)
tmp = x * 2.0;
else
tmp = a * (27.0 * b);
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[b, -1.25e-92], N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2e-8], N[(x * 2.0), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.25 \cdot 10^{-92}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\mathbf{elif}\;b \leq 2 \cdot 10^{-8}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\end{array}
\end{array}
if b < -1.25000000000000003e-92Initial program 92.5%
sub-neg92.5%
sub-neg92.5%
associate-*l*94.9%
associate-*l*94.9%
Simplified94.9%
Taylor expanded in y around 0 68.3%
Taylor expanded in x around 0 41.0%
associate-*r*41.0%
*-commutative41.0%
Simplified41.0%
if -1.25000000000000003e-92 < b < 2e-8Initial program 95.7%
sub-neg95.7%
sub-neg95.7%
associate-*l*96.6%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in x around inf 43.8%
if 2e-8 < b Initial program 93.4%
sub-neg93.4%
sub-neg93.4%
associate-*l*93.1%
associate-*l*91.7%
Simplified91.7%
Taylor expanded in a around inf 56.2%
associate-*r*56.3%
*-commutative56.3%
associate-*r*56.2%
Simplified56.2%
Final simplification46.5%
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 94.0%
sub-neg94.0%
sub-neg94.0%
associate-*l*95.1%
associate-*l*94.7%
Simplified94.7%
Taylor expanded in x around inf 31.6%
Final simplification31.6%
(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 2023305
(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)))