
(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 14 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. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 3e-12) (fma a (* 27.0 b) (- (* x 2.0) (* (* y (* z t)) 9.0))) (fma x 2.0 (fma t (* (* z y) -9.0) (* b (* a 27.0))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 3e-12) {
tmp = fma(a, (27.0 * b), ((x * 2.0) - ((y * (z * t)) * 9.0)));
} else {
tmp = fma(x, 2.0, fma(t, ((z * y) * -9.0), (b * (a * 27.0))));
}
return tmp;
}
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 3e-12) tmp = fma(a, Float64(27.0 * b), Float64(Float64(x * 2.0) - Float64(Float64(y * Float64(z * t)) * 9.0))); else tmp = fma(x, 2.0, fma(t, Float64(Float64(z * y) * -9.0), Float64(b * Float64(a * 27.0)))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 3e-12], N[(a * N[(27.0 * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 2.0 + N[(t * N[(N[(z * y), $MachinePrecision] * -9.0), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - \left(y \cdot \left(z \cdot t\right)\right) \cdot 9\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(t, \left(z \cdot y\right) \cdot -9, b \cdot \left(a \cdot 27\right)\right)\right)\\
\end{array}
\end{array}
if z < 3.0000000000000001e-12Initial program 93.9%
+-commutative93.9%
associate-*l*94.4%
fma-def94.9%
associate-*l*96.0%
*-commutative96.0%
associate-*l*96.0%
Simplified96.0%
if 3.0000000000000001e-12 < z Initial program 89.1%
associate-+l-89.1%
fma-neg89.1%
neg-sub089.1%
associate-+l-89.1%
neg-sub089.1%
*-commutative89.1%
distribute-rgt-neg-in89.1%
fma-def90.7%
*-commutative90.7%
associate-*r*90.7%
distribute-rgt-neg-in90.7%
*-commutative90.7%
metadata-eval90.7%
Simplified90.7%
Final simplification94.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 1e-12) (fma a (* 27.0 b) (- (* x 2.0) (* (* y (* z t)) 9.0))) (- (* x 2.0) (+ (* (* t (* z y)) 9.0) (* a (* b -27.0))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 1e-12) {
tmp = fma(a, (27.0 * b), ((x * 2.0) - ((y * (z * t)) * 9.0)));
} else {
tmp = (x * 2.0) - (((t * (z * y)) * 9.0) + (a * (b * -27.0)));
}
return tmp;
}
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 1e-12) tmp = fma(a, Float64(27.0 * b), Float64(Float64(x * 2.0) - Float64(Float64(y * Float64(z * t)) * 9.0))); else tmp = Float64(Float64(x * 2.0) - Float64(Float64(Float64(t * Float64(z * y)) * 9.0) + Float64(a * Float64(b * -27.0)))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 1e-12], N[(a * N[(27.0 * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision] + N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - \left(y \cdot \left(z \cdot t\right)\right) \cdot 9\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - \left(\left(t \cdot \left(z \cdot y\right)\right) \cdot 9 + a \cdot \left(b \cdot -27\right)\right)\\
\end{array}
\end{array}
if z < 9.9999999999999998e-13Initial program 93.9%
+-commutative93.9%
associate-*l*94.4%
fma-def94.9%
associate-*l*96.0%
*-commutative96.0%
associate-*l*96.0%
Simplified96.0%
if 9.9999999999999998e-13 < z Initial program 89.1%
associate-+l-89.1%
sub-neg89.1%
neg-mul-189.1%
metadata-eval89.1%
metadata-eval89.1%
cancel-sign-sub-inv89.1%
metadata-eval89.1%
*-lft-identity89.1%
associate-*l*87.8%
associate-*l*87.8%
Simplified87.8%
sub-neg87.8%
*-commutative87.8%
associate-*r*87.8%
associate-*r*89.2%
distribute-rgt-neg-in89.2%
*-commutative89.2%
distribute-rgt-neg-in89.2%
metadata-eval89.2%
Applied egg-rr89.2%
Final simplification94.3%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (* y 9.0))))
(if (<= t_1 5e+275)
(+ (* b (* a 27.0)) (- (* x 2.0) (* t t_1)))
(- (* 27.0 (* a b)) (* (* y (* z t)) 9.0)))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * (y * 9.0);
double tmp;
if (t_1 <= 5e+275) {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * t_1));
} else {
tmp = (27.0 * (a * b)) - ((y * (z * t)) * 9.0);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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 = z * (y * 9.0d0)
if (t_1 <= 5d+275) then
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * t_1))
else
tmp = (27.0d0 * (a * b)) - ((y * (z * t)) * 9.0d0)
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * (y * 9.0);
double tmp;
if (t_1 <= 5e+275) {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * t_1));
} else {
tmp = (27.0 * (a * b)) - ((y * (z * t)) * 9.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = z * (y * 9.0) tmp = 0 if t_1 <= 5e+275: tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * t_1)) else: tmp = (27.0 * (a * b)) - ((y * (z * t)) * 9.0) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(y * 9.0)) tmp = 0.0 if (t_1 <= 5e+275) tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * t_1))); else tmp = Float64(Float64(27.0 * Float64(a * b)) - Float64(Float64(y * Float64(z * t)) * 9.0)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = z * (y * 9.0);
tmp = 0.0;
if (t_1 <= 5e+275)
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * t_1));
else
tmp = (27.0 * (a * b)) - ((y * (z * t)) * 9.0);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+275], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] - N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := z \cdot \left(y \cdot 9\right)\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+275}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - \left(y \cdot \left(z \cdot t\right)\right) \cdot 9\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 5.0000000000000003e275Initial program 95.8%
if 5.0000000000000003e275 < (*.f64 (*.f64 y 9) z) Initial program 49.7%
Taylor expanded in x around 0 82.6%
Final simplification94.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= (* z (* y 9.0)) 5e+275) (- (* x 2.0) (+ (* (* t (* z y)) 9.0) (* a (* b -27.0)))) (- (* 27.0 (* a b)) (* (* y (* z t)) 9.0))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z * (y * 9.0)) <= 5e+275) {
tmp = (x * 2.0) - (((t * (z * y)) * 9.0) + (a * (b * -27.0)));
} else {
tmp = (27.0 * (a * b)) - ((y * (z * t)) * 9.0);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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 * (y * 9.0d0)) <= 5d+275) then
tmp = (x * 2.0d0) - (((t * (z * y)) * 9.0d0) + (a * (b * (-27.0d0))))
else
tmp = (27.0d0 * (a * b)) - ((y * (z * t)) * 9.0d0)
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z * (y * 9.0)) <= 5e+275) {
tmp = (x * 2.0) - (((t * (z * y)) * 9.0) + (a * (b * -27.0)));
} else {
tmp = (27.0 * (a * b)) - ((y * (z * t)) * 9.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (z * (y * 9.0)) <= 5e+275: tmp = (x * 2.0) - (((t * (z * y)) * 9.0) + (a * (b * -27.0))) else: tmp = (27.0 * (a * b)) - ((y * (z * t)) * 9.0) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(z * Float64(y * 9.0)) <= 5e+275) tmp = Float64(Float64(x * 2.0) - Float64(Float64(Float64(t * Float64(z * y)) * 9.0) + Float64(a * Float64(b * -27.0)))); else tmp = Float64(Float64(27.0 * Float64(a * b)) - Float64(Float64(y * Float64(z * t)) * 9.0)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((z * (y * 9.0)) <= 5e+275)
tmp = (x * 2.0) - (((t * (z * y)) * 9.0) + (a * (b * -27.0)));
else
tmp = (27.0 * (a * b)) - ((y * (z * t)) * 9.0);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision], 5e+275], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision] + N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] - N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot \left(y \cdot 9\right) \leq 5 \cdot 10^{+275}:\\
\;\;\;\;x \cdot 2 - \left(\left(t \cdot \left(z \cdot y\right)\right) \cdot 9 + a \cdot \left(b \cdot -27\right)\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - \left(y \cdot \left(z \cdot t\right)\right) \cdot 9\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 5.0000000000000003e275Initial program 95.8%
associate-+l-95.8%
sub-neg95.8%
neg-mul-195.8%
metadata-eval95.8%
metadata-eval95.8%
cancel-sign-sub-inv95.8%
metadata-eval95.8%
*-lft-identity95.8%
associate-*l*93.6%
associate-*l*93.6%
Simplified93.6%
sub-neg93.6%
*-commutative93.6%
associate-*r*93.6%
associate-*r*96.2%
distribute-rgt-neg-in96.2%
*-commutative96.2%
distribute-rgt-neg-in96.2%
metadata-eval96.2%
Applied egg-rr96.2%
if 5.0000000000000003e275 < (*.f64 (*.f64 y 9) z) Initial program 49.7%
Taylor expanded in x around 0 82.6%
Final simplification95.3%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 0.0004) (- (* x 2.0) (- (* (* y 9.0) (* z t)) (* a (* 27.0 b)))) (- (* x 2.0) (+ (* (* t (* z y)) 9.0) (* a (* b -27.0))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 0.0004) {
tmp = (x * 2.0) - (((y * 9.0) * (z * t)) - (a * (27.0 * b)));
} else {
tmp = (x * 2.0) - (((t * (z * y)) * 9.0) + (a * (b * -27.0)));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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 <= 0.0004d0) then
tmp = (x * 2.0d0) - (((y * 9.0d0) * (z * t)) - (a * (27.0d0 * b)))
else
tmp = (x * 2.0d0) - (((t * (z * y)) * 9.0d0) + (a * (b * (-27.0d0))))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 0.0004) {
tmp = (x * 2.0) - (((y * 9.0) * (z * t)) - (a * (27.0 * b)));
} else {
tmp = (x * 2.0) - (((t * (z * y)) * 9.0) + (a * (b * -27.0)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= 0.0004: tmp = (x * 2.0) - (((y * 9.0) * (z * t)) - (a * (27.0 * b))) else: tmp = (x * 2.0) - (((t * (z * y)) * 9.0) + (a * (b * -27.0))) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 0.0004) tmp = Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * Float64(z * t)) - Float64(a * Float64(27.0 * b)))); else tmp = Float64(Float64(x * 2.0) - Float64(Float64(Float64(t * Float64(z * y)) * 9.0) + Float64(a * Float64(b * -27.0)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= 0.0004)
tmp = (x * 2.0) - (((y * 9.0) * (z * t)) - (a * (27.0 * b)));
else
tmp = (x * 2.0) - (((t * (z * y)) * 9.0) + (a * (b * -27.0)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 0.0004], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision] + N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.0004:\\
\;\;\;\;x \cdot 2 - \left(\left(y \cdot 9\right) \cdot \left(z \cdot t\right) - a \cdot \left(27 \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - \left(\left(t \cdot \left(z \cdot y\right)\right) \cdot 9 + a \cdot \left(b \cdot -27\right)\right)\\
\end{array}
\end{array}
if z < 4.00000000000000019e-4Initial program 94.0%
associate-+l-94.0%
sub-neg94.0%
neg-mul-194.0%
metadata-eval94.0%
metadata-eval94.0%
cancel-sign-sub-inv94.0%
metadata-eval94.0%
*-lft-identity94.0%
associate-*l*95.6%
associate-*l*95.5%
Simplified95.5%
if 4.00000000000000019e-4 < z Initial program 88.9%
associate-+l-88.9%
sub-neg88.9%
neg-mul-188.9%
metadata-eval88.9%
metadata-eval88.9%
cancel-sign-sub-inv88.9%
metadata-eval88.9%
*-lft-identity88.9%
associate-*l*87.6%
associate-*l*87.6%
Simplified87.6%
sub-neg87.6%
*-commutative87.6%
associate-*r*87.6%
associate-*r*89.0%
distribute-rgt-neg-in89.0%
*-commutative89.0%
distribute-rgt-neg-in89.0%
metadata-eval89.0%
Applied egg-rr89.0%
Final simplification93.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* -9.0 (* y (* z t)))))
(if (<= b -1.08e+18)
(* a (* 27.0 b))
(if (<= b 9e-290)
(* x 2.0)
(if (<= b 1.75e-255)
t_1
(if (<= b 1.35e-227)
(* x 2.0)
(if (<= b 2.5e-171)
t_1
(if (<= b 100000.0) (* x 2.0) (* 27.0 (* a b))))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -9.0 * (y * (z * t));
double tmp;
if (b <= -1.08e+18) {
tmp = a * (27.0 * b);
} else if (b <= 9e-290) {
tmp = x * 2.0;
} else if (b <= 1.75e-255) {
tmp = t_1;
} else if (b <= 1.35e-227) {
tmp = x * 2.0;
} else if (b <= 2.5e-171) {
tmp = t_1;
} else if (b <= 100000.0) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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 = (-9.0d0) * (y * (z * t))
if (b <= (-1.08d+18)) then
tmp = a * (27.0d0 * b)
else if (b <= 9d-290) then
tmp = x * 2.0d0
else if (b <= 1.75d-255) then
tmp = t_1
else if (b <= 1.35d-227) then
tmp = x * 2.0d0
else if (b <= 2.5d-171) then
tmp = t_1
else if (b <= 100000.0d0) then
tmp = x * 2.0d0
else
tmp = 27.0d0 * (a * b)
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -9.0 * (y * (z * t));
double tmp;
if (b <= -1.08e+18) {
tmp = a * (27.0 * b);
} else if (b <= 9e-290) {
tmp = x * 2.0;
} else if (b <= 1.75e-255) {
tmp = t_1;
} else if (b <= 1.35e-227) {
tmp = x * 2.0;
} else if (b <= 2.5e-171) {
tmp = t_1;
} else if (b <= 100000.0) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = -9.0 * (y * (z * t)) tmp = 0 if b <= -1.08e+18: tmp = a * (27.0 * b) elif b <= 9e-290: tmp = x * 2.0 elif b <= 1.75e-255: tmp = t_1 elif b <= 1.35e-227: tmp = x * 2.0 elif b <= 2.5e-171: tmp = t_1 elif b <= 100000.0: tmp = x * 2.0 else: tmp = 27.0 * (a * b) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(-9.0 * Float64(y * Float64(z * t))) tmp = 0.0 if (b <= -1.08e+18) tmp = Float64(a * Float64(27.0 * b)); elseif (b <= 9e-290) tmp = Float64(x * 2.0); elseif (b <= 1.75e-255) tmp = t_1; elseif (b <= 1.35e-227) tmp = Float64(x * 2.0); elseif (b <= 2.5e-171) tmp = t_1; elseif (b <= 100000.0) tmp = Float64(x * 2.0); else tmp = Float64(27.0 * Float64(a * b)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = -9.0 * (y * (z * t));
tmp = 0.0;
if (b <= -1.08e+18)
tmp = a * (27.0 * b);
elseif (b <= 9e-290)
tmp = x * 2.0;
elseif (b <= 1.75e-255)
tmp = t_1;
elseif (b <= 1.35e-227)
tmp = x * 2.0;
elseif (b <= 2.5e-171)
tmp = t_1;
elseif (b <= 100000.0)
tmp = x * 2.0;
else
tmp = 27.0 * (a * b);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.08e+18], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9e-290], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 1.75e-255], t$95$1, If[LessEqual[b, 1.35e-227], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 2.5e-171], t$95$1, If[LessEqual[b, 100000.0], N[(x * 2.0), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{if}\;b \leq -1.08 \cdot 10^{+18}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;b \leq 9 \cdot 10^{-290}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;b \leq 1.75 \cdot 10^{-255}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 1.35 \cdot 10^{-227}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;b \leq 2.5 \cdot 10^{-171}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 100000:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if b < -1.08e18Initial program 92.8%
associate-+l-92.8%
sub-neg92.8%
neg-mul-192.8%
metadata-eval92.8%
metadata-eval92.8%
cancel-sign-sub-inv92.8%
metadata-eval92.8%
*-lft-identity92.8%
associate-*l*86.5%
associate-*l*86.5%
Simplified86.5%
Taylor expanded in y around 0 67.9%
*-commutative67.9%
associate-*r*67.9%
Simplified67.9%
Taylor expanded in x around 0 43.5%
*-commutative43.5%
associate-*l*43.5%
Simplified43.5%
if -1.08e18 < b < 9e-290 or 1.74999999999999989e-255 < b < 1.35e-227 or 2.49999999999999996e-171 < b < 1e5Initial program 93.8%
Taylor expanded in x around inf 55.6%
if 9e-290 < b < 1.74999999999999989e-255 or 1.35e-227 < b < 2.49999999999999996e-171Initial program 89.4%
Taylor expanded in y around inf 59.9%
if 1e5 < b Initial program 91.8%
associate-+l-91.8%
sub-neg91.8%
neg-mul-191.8%
metadata-eval91.8%
metadata-eval91.8%
cancel-sign-sub-inv91.8%
metadata-eval91.8%
*-lft-identity91.8%
associate-*l*98.2%
associate-*l*98.1%
Simplified98.1%
Taylor expanded in y around 0 71.6%
*-commutative71.6%
associate-*r*71.5%
Simplified71.5%
Taylor expanded in x around 0 58.8%
*-commutative58.8%
Simplified58.8%
Final simplification53.3%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= z -3e-37) (not (<= z 6.3e-62))) (+ (* x 2.0) (* z (* -9.0 (* y t)))) (- (* x 2.0) (* a (* b -27.0)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3e-37) || !(z <= 6.3e-62)) {
tmp = (x * 2.0) + (z * (-9.0 * (y * t)));
} else {
tmp = (x * 2.0) - (a * (b * -27.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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-37)) .or. (.not. (z <= 6.3d-62))) then
tmp = (x * 2.0d0) + (z * ((-9.0d0) * (y * t)))
else
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3e-37) || !(z <= 6.3e-62)) {
tmp = (x * 2.0) + (z * (-9.0 * (y * t)));
} else {
tmp = (x * 2.0) - (a * (b * -27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (z <= -3e-37) or not (z <= 6.3e-62): tmp = (x * 2.0) + (z * (-9.0 * (y * t))) else: tmp = (x * 2.0) - (a * (b * -27.0)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3e-37) || !(z <= 6.3e-62)) tmp = Float64(Float64(x * 2.0) + Float64(z * Float64(-9.0 * Float64(y * t)))); else tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((z <= -3e-37) || ~((z <= 6.3e-62)))
tmp = (x * 2.0) + (z * (-9.0 * (y * t)));
else
tmp = (x * 2.0) - (a * (b * -27.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3e-37], N[Not[LessEqual[z, 6.3e-62]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] + N[(z * N[(-9.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{-37} \lor \neg \left(z \leq 6.3 \cdot 10^{-62}\right):\\
\;\;\;\;x \cdot 2 + z \cdot \left(-9 \cdot \left(y \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\end{array}
\end{array}
if z < -3e-37 or 6.2999999999999997e-62 < z Initial program 87.5%
associate-+l-87.5%
sub-neg87.5%
neg-mul-187.5%
metadata-eval87.5%
metadata-eval87.5%
cancel-sign-sub-inv87.5%
metadata-eval87.5%
*-lft-identity87.5%
associate-*l*89.7%
associate-*l*89.7%
Simplified89.7%
sub-neg89.7%
*-commutative89.7%
associate-*r*89.7%
associate-*r*88.2%
distribute-rgt-neg-in88.2%
*-commutative88.2%
distribute-rgt-neg-in88.2%
metadata-eval88.2%
Applied egg-rr88.2%
Taylor expanded in y around inf 70.3%
add-sqr-sqrt41.2%
sqrt-unprod47.2%
swap-sqr47.2%
metadata-eval47.2%
metadata-eval47.2%
swap-sqr47.2%
*-commutative47.2%
*-commutative47.2%
associate-*r*47.2%
associate-*r*47.2%
associate-*r*47.9%
associate-*r*47.9%
sqrt-unprod17.0%
add-sqr-sqrt29.1%
associate-*r*29.1%
associate-*r*28.4%
metadata-eval28.4%
distribute-rgt-neg-in28.4%
*-commutative28.4%
add-log-exp23.2%
Applied egg-rr39.6%
log-rec39.6%
log-pow32.7%
distribute-rgt-neg-in32.7%
log-pow32.7%
rem-log-exp76.5%
Simplified76.5%
sub-neg76.5%
+-commutative76.5%
distribute-rgt-neg-out76.5%
remove-double-neg76.5%
associate-*r*76.5%
Applied egg-rr76.5%
if -3e-37 < z < 6.2999999999999997e-62Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*99.0%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in y around 0 80.0%
*-commutative80.0%
associate-*r*79.9%
Simplified79.9%
Final simplification77.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1.32e-34)
(- (* x 2.0) (* (* y (* z t)) 9.0))
(if (<= z 3.7e-62)
(- (* x 2.0) (* a (* b -27.0)))
(+ (* x 2.0) (* z (* -9.0 (* y t)))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.32e-34) {
tmp = (x * 2.0) - ((y * (z * t)) * 9.0);
} else if (z <= 3.7e-62) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (x * 2.0) + (z * (-9.0 * (y * t)));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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.32d-34)) then
tmp = (x * 2.0d0) - ((y * (z * t)) * 9.0d0)
else if (z <= 3.7d-62) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = (x * 2.0d0) + (z * ((-9.0d0) * (y * t)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.32e-34) {
tmp = (x * 2.0) - ((y * (z * t)) * 9.0);
} else if (z <= 3.7e-62) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (x * 2.0) + (z * (-9.0 * (y * t)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -1.32e-34: tmp = (x * 2.0) - ((y * (z * t)) * 9.0) elif z <= 3.7e-62: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = (x * 2.0) + (z * (-9.0 * (y * t))) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.32e-34) tmp = Float64(Float64(x * 2.0) - Float64(Float64(y * Float64(z * t)) * 9.0)); elseif (z <= 3.7e-62) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(Float64(x * 2.0) + Float64(z * Float64(-9.0 * Float64(y * t)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -1.32e-34)
tmp = (x * 2.0) - ((y * (z * t)) * 9.0);
elseif (z <= 3.7e-62)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = (x * 2.0) + (z * (-9.0 * (y * t)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.32e-34], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.7e-62], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(z * N[(-9.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{-34}:\\
\;\;\;\;x \cdot 2 - \left(y \cdot \left(z \cdot t\right)\right) \cdot 9\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-62}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + z \cdot \left(-9 \cdot \left(y \cdot t\right)\right)\\
\end{array}
\end{array}
if z < -1.32e-34Initial program 84.6%
Taylor expanded in a around 0 69.6%
if -1.32e-34 < z < 3.6999999999999998e-62Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*99.0%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in y around 0 80.2%
*-commutative80.2%
associate-*r*80.1%
Simplified80.1%
if 3.6999999999999998e-62 < z Initial program 90.4%
associate-+l-90.4%
sub-neg90.4%
neg-mul-190.4%
metadata-eval90.4%
metadata-eval90.4%
cancel-sign-sub-inv90.4%
metadata-eval90.4%
*-lft-identity90.4%
associate-*l*89.3%
associate-*l*89.3%
Simplified89.3%
sub-neg89.3%
*-commutative89.3%
associate-*r*89.3%
associate-*r*90.5%
distribute-rgt-neg-in90.5%
*-commutative90.5%
distribute-rgt-neg-in90.5%
metadata-eval90.5%
Applied egg-rr90.5%
Taylor expanded in y around inf 70.6%
add-sqr-sqrt45.3%
sqrt-unprod48.8%
swap-sqr48.8%
metadata-eval48.8%
metadata-eval48.8%
swap-sqr48.8%
*-commutative48.8%
*-commutative48.8%
associate-*r*48.8%
associate-*r*48.8%
associate-*r*50.1%
associate-*r*50.1%
sqrt-unprod14.6%
add-sqr-sqrt26.2%
associate-*r*26.2%
associate-*r*26.0%
metadata-eval26.0%
distribute-rgt-neg-in26.0%
*-commutative26.0%
add-log-exp18.7%
Applied egg-rr41.4%
log-rec41.4%
log-pow35.7%
distribute-rgt-neg-in35.7%
log-pow35.7%
rem-log-exp77.0%
Simplified77.0%
sub-neg77.0%
+-commutative77.0%
distribute-rgt-neg-out77.0%
remove-double-neg77.0%
associate-*r*77.0%
Applied egg-rr77.0%
Final simplification76.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= z -2.35e-35)
(- (* x 2.0) (* (* y (* z t)) 9.0))
(if (<= z 4.5e-62)
(- (* x 2.0) (* a (* b -27.0)))
(+ (* x 2.0) (* (* y t) (* z -9.0))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.35e-35) {
tmp = (x * 2.0) - ((y * (z * t)) * 9.0);
} else if (z <= 4.5e-62) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (x * 2.0) + ((y * t) * (z * -9.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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 <= (-2.35d-35)) then
tmp = (x * 2.0d0) - ((y * (z * t)) * 9.0d0)
else if (z <= 4.5d-62) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = (x * 2.0d0) + ((y * t) * (z * (-9.0d0)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.35e-35) {
tmp = (x * 2.0) - ((y * (z * t)) * 9.0);
} else if (z <= 4.5e-62) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (x * 2.0) + ((y * t) * (z * -9.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -2.35e-35: tmp = (x * 2.0) - ((y * (z * t)) * 9.0) elif z <= 4.5e-62: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = (x * 2.0) + ((y * t) * (z * -9.0)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.35e-35) tmp = Float64(Float64(x * 2.0) - Float64(Float64(y * Float64(z * t)) * 9.0)); elseif (z <= 4.5e-62) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(Float64(x * 2.0) + Float64(Float64(y * t) * Float64(z * -9.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -2.35e-35)
tmp = (x * 2.0) - ((y * (z * t)) * 9.0);
elseif (z <= 4.5e-62)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = (x * 2.0) + ((y * t) * (z * -9.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.35e-35], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e-62], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(y * t), $MachinePrecision] * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{-35}:\\
\;\;\;\;x \cdot 2 - \left(y \cdot \left(z \cdot t\right)\right) \cdot 9\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-62}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + \left(y \cdot t\right) \cdot \left(z \cdot -9\right)\\
\end{array}
\end{array}
if z < -2.35e-35Initial program 84.6%
Taylor expanded in a around 0 69.6%
if -2.35e-35 < z < 4.50000000000000018e-62Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*99.0%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in y around 0 80.2%
*-commutative80.2%
associate-*r*80.1%
Simplified80.1%
if 4.50000000000000018e-62 < z Initial program 90.4%
associate-+l-90.4%
sub-neg90.4%
neg-mul-190.4%
metadata-eval90.4%
metadata-eval90.4%
cancel-sign-sub-inv90.4%
metadata-eval90.4%
*-lft-identity90.4%
associate-*l*89.3%
associate-*l*89.3%
Simplified89.3%
sub-neg89.3%
*-commutative89.3%
associate-*r*89.3%
associate-*r*90.5%
distribute-rgt-neg-in90.5%
*-commutative90.5%
distribute-rgt-neg-in90.5%
metadata-eval90.5%
Applied egg-rr90.5%
Taylor expanded in y around inf 70.6%
add-sqr-sqrt45.3%
sqrt-unprod48.8%
swap-sqr48.8%
metadata-eval48.8%
metadata-eval48.8%
swap-sqr48.8%
*-commutative48.8%
*-commutative48.8%
associate-*r*48.8%
associate-*r*48.8%
associate-*r*50.1%
associate-*r*50.1%
sqrt-unprod14.6%
add-sqr-sqrt26.2%
associate-*r*26.2%
associate-*r*26.0%
metadata-eval26.0%
distribute-rgt-neg-in26.0%
*-commutative26.0%
add-log-exp18.7%
Applied egg-rr41.4%
log-rec41.4%
log-pow35.7%
distribute-rgt-neg-in35.7%
log-pow35.7%
rem-log-exp77.0%
Simplified77.0%
Final simplification76.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= z -3.9e-74)
(- (* 27.0 (* a b)) (* (* y (* z t)) 9.0))
(if (<= z 1.12e-61)
(- (* x 2.0) (* a (* b -27.0)))
(+ (* x 2.0) (* (* y t) (* z -9.0))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.9e-74) {
tmp = (27.0 * (a * b)) - ((y * (z * t)) * 9.0);
} else if (z <= 1.12e-61) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (x * 2.0) + ((y * t) * (z * -9.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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 <= (-3.9d-74)) then
tmp = (27.0d0 * (a * b)) - ((y * (z * t)) * 9.0d0)
else if (z <= 1.12d-61) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = (x * 2.0d0) + ((y * t) * (z * (-9.0d0)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.9e-74) {
tmp = (27.0 * (a * b)) - ((y * (z * t)) * 9.0);
} else if (z <= 1.12e-61) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (x * 2.0) + ((y * t) * (z * -9.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -3.9e-74: tmp = (27.0 * (a * b)) - ((y * (z * t)) * 9.0) elif z <= 1.12e-61: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = (x * 2.0) + ((y * t) * (z * -9.0)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.9e-74) tmp = Float64(Float64(27.0 * Float64(a * b)) - Float64(Float64(y * Float64(z * t)) * 9.0)); elseif (z <= 1.12e-61) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(Float64(x * 2.0) + Float64(Float64(y * t) * Float64(z * -9.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -3.9e-74)
tmp = (27.0 * (a * b)) - ((y * (z * t)) * 9.0);
elseif (z <= 1.12e-61)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = (x * 2.0) + ((y * t) * (z * -9.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.9e-74], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] - N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e-61], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(y * t), $MachinePrecision] * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{-74}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - \left(y \cdot \left(z \cdot t\right)\right) \cdot 9\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{-61}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + \left(y \cdot t\right) \cdot \left(z \cdot -9\right)\\
\end{array}
\end{array}
if z < -3.9000000000000001e-74Initial program 86.4%
Taylor expanded in x around 0 60.8%
if -3.9000000000000001e-74 < z < 1.12000000000000001e-61Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*98.9%
associate-*l*98.8%
Simplified98.8%
Taylor expanded in y around 0 79.9%
*-commutative79.9%
associate-*r*79.8%
Simplified79.8%
if 1.12000000000000001e-61 < z Initial program 90.3%
associate-+l-90.3%
sub-neg90.3%
neg-mul-190.3%
metadata-eval90.3%
metadata-eval90.3%
cancel-sign-sub-inv90.3%
metadata-eval90.3%
*-lft-identity90.3%
associate-*l*89.2%
associate-*l*89.2%
Simplified89.2%
sub-neg89.2%
*-commutative89.2%
associate-*r*89.1%
associate-*r*90.4%
distribute-rgt-neg-in90.4%
*-commutative90.4%
distribute-rgt-neg-in90.4%
metadata-eval90.4%
Applied egg-rr90.4%
Taylor expanded in y around inf 70.1%
add-sqr-sqrt45.9%
sqrt-unprod48.1%
swap-sqr48.0%
metadata-eval48.0%
metadata-eval48.0%
swap-sqr48.1%
*-commutative48.1%
*-commutative48.1%
associate-*r*48.1%
associate-*r*48.1%
associate-*r*49.4%
associate-*r*49.4%
sqrt-unprod13.4%
add-sqr-sqrt25.2%
associate-*r*25.2%
associate-*r*25.0%
metadata-eval25.0%
distribute-rgt-neg-in25.0%
*-commutative25.0%
add-log-exp17.6%
Applied egg-rr40.5%
log-rec40.5%
log-pow34.8%
distribute-rgt-neg-in34.8%
log-pow34.8%
rem-log-exp76.7%
Simplified76.7%
Final simplification72.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= z -3.9e+64)
(* y (* -9.0 (* z t)))
(if (<= z 210000000.0)
(- (* x 2.0) (* (* a b) -27.0))
(* t (* (* z y) -9.0)))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.9e+64) {
tmp = y * (-9.0 * (z * t));
} else if (z <= 210000000.0) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else {
tmp = t * ((z * y) * -9.0);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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 <= (-3.9d+64)) then
tmp = y * ((-9.0d0) * (z * t))
else if (z <= 210000000.0d0) then
tmp = (x * 2.0d0) - ((a * b) * (-27.0d0))
else
tmp = t * ((z * y) * (-9.0d0))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.9e+64) {
tmp = y * (-9.0 * (z * t));
} else if (z <= 210000000.0) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else {
tmp = t * ((z * y) * -9.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -3.9e+64: tmp = y * (-9.0 * (z * t)) elif z <= 210000000.0: tmp = (x * 2.0) - ((a * b) * -27.0) else: tmp = t * ((z * y) * -9.0) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.9e+64) tmp = Float64(y * Float64(-9.0 * Float64(z * t))); elseif (z <= 210000000.0) tmp = Float64(Float64(x * 2.0) - Float64(Float64(a * b) * -27.0)); else tmp = Float64(t * Float64(Float64(z * y) * -9.0)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -3.9e+64)
tmp = y * (-9.0 * (z * t));
elseif (z <= 210000000.0)
tmp = (x * 2.0) - ((a * b) * -27.0);
else
tmp = 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. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.9e+64], N[(y * N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 210000000.0], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(z * y), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+64}:\\
\;\;\;\;y \cdot \left(-9 \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;z \leq 210000000:\\
\;\;\;\;x \cdot 2 - \left(a \cdot b\right) \cdot -27\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(\left(z \cdot y\right) \cdot -9\right)\\
\end{array}
\end{array}
if z < -3.8999999999999998e64Initial program 79.6%
Taylor expanded in y around inf 43.4%
*-commutative43.4%
*-commutative43.4%
associate-*l*43.4%
*-commutative43.4%
*-commutative43.4%
Simplified43.4%
if -3.8999999999999998e64 < z < 2.1e8Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*99.2%
associate-*l*99.1%
Simplified99.1%
Taylor expanded in y around 0 78.2%
if 2.1e8 < z Initial program 88.6%
Taylor expanded in y around inf 50.0%
*-commutative50.0%
*-commutative50.0%
associate-*l*49.9%
*-commutative49.9%
*-commutative49.9%
Simplified49.9%
Taylor expanded in y around 0 50.0%
*-commutative50.0%
associate-*r*53.1%
associate-*r*53.1%
metadata-eval53.1%
distribute-lft-neg-in53.1%
associate-*l*53.1%
*-commutative53.1%
associate-*l*53.1%
distribute-lft-neg-in53.1%
metadata-eval53.1%
Simplified53.1%
Final simplification64.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= b -4.1e+17) (not (<= b 0.0004))) (* a (* 27.0 b)) (* x 2.0)))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -4.1e+17) || !(b <= 0.0004)) {
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.
NOTE: a and b 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 <= (-4.1d+17)) .or. (.not. (b <= 0.0004d0))) then
tmp = a * (27.0d0 * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -4.1e+17) || !(b <= 0.0004)) {
tmp = a * (27.0 * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (b <= -4.1e+17) or not (b <= 0.0004): tmp = a * (27.0 * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -4.1e+17) || !(b <= 0.0004)) 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])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((b <= -4.1e+17) || ~((b <= 0.0004)))
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. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -4.1e+17], N[Not[LessEqual[b, 0.0004]], $MachinePrecision]], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.1 \cdot 10^{+17} \lor \neg \left(b \leq 0.0004\right):\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if b < -4.1e17 or 4.00000000000000019e-4 < b Initial program 92.4%
associate-+l-92.4%
sub-neg92.4%
neg-mul-192.4%
metadata-eval92.4%
metadata-eval92.4%
cancel-sign-sub-inv92.4%
metadata-eval92.4%
*-lft-identity92.4%
associate-*l*91.9%
associate-*l*91.8%
Simplified91.8%
Taylor expanded in y around 0 69.6%
*-commutative69.6%
associate-*r*69.5%
Simplified69.5%
Taylor expanded in x around 0 50.5%
*-commutative50.5%
associate-*l*50.4%
Simplified50.4%
if -4.1e17 < b < 4.00000000000000019e-4Initial program 93.2%
Taylor expanded in x around inf 50.4%
Final simplification50.4%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= b -4e+17) (* a (* 27.0 b)) (if (<= b 0.00115) (* x 2.0) (* 27.0 (* a b)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -4e+17) {
tmp = a * (27.0 * b);
} else if (b <= 0.00115) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b 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 <= (-4d+17)) then
tmp = a * (27.0d0 * b)
else if (b <= 0.00115d0) then
tmp = x * 2.0d0
else
tmp = 27.0d0 * (a * b)
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -4e+17) {
tmp = a * (27.0 * b);
} else if (b <= 0.00115) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if b <= -4e+17: tmp = a * (27.0 * b) elif b <= 0.00115: tmp = x * 2.0 else: tmp = 27.0 * (a * b) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -4e+17) tmp = Float64(a * Float64(27.0 * b)); elseif (b <= 0.00115) tmp = Float64(x * 2.0); else tmp = Float64(27.0 * Float64(a * b)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (b <= -4e+17)
tmp = a * (27.0 * b);
elseif (b <= 0.00115)
tmp = x * 2.0;
else
tmp = 27.0 * (a * b);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -4e+17], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 0.00115], N[(x * 2.0), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{+17}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;b \leq 0.00115:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if b < -4e17Initial program 92.8%
associate-+l-92.8%
sub-neg92.8%
neg-mul-192.8%
metadata-eval92.8%
metadata-eval92.8%
cancel-sign-sub-inv92.8%
metadata-eval92.8%
*-lft-identity92.8%
associate-*l*86.5%
associate-*l*86.5%
Simplified86.5%
Taylor expanded in y around 0 67.9%
*-commutative67.9%
associate-*r*67.9%
Simplified67.9%
Taylor expanded in x around 0 43.5%
*-commutative43.5%
associate-*l*43.5%
Simplified43.5%
if -4e17 < b < 0.00115Initial program 93.2%
Taylor expanded in x around inf 50.4%
if 0.00115 < b Initial program 91.8%
associate-+l-91.8%
sub-neg91.8%
neg-mul-191.8%
metadata-eval91.8%
metadata-eval91.8%
cancel-sign-sub-inv91.8%
metadata-eval91.8%
*-lft-identity91.8%
associate-*l*98.2%
associate-*l*98.1%
Simplified98.1%
Taylor expanded in y around 0 71.6%
*-commutative71.6%
associate-*r*71.5%
Simplified71.5%
Taylor expanded in x around 0 58.8%
*-commutative58.8%
Simplified58.8%
Final simplification50.4%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b 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);
assert(a < b);
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.
NOTE: a and b 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;
assert a < b;
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]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return x * 2.0
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
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. NOTE: a and b 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])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
x \cdot 2
\end{array}
Initial program 92.8%
Taylor expanded in x around inf 35.0%
Final simplification35.0%
(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 2023196
(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)))