
(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 10 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 (<= (* (* y 9.0) z) 1e+100) (+ (- (* x 2.0) (* (* 9.0 (* y z)) t)) (* (* a 27.0) b)) (fma a (* 27.0 b) (fma x 2.0 (* y (* t (* z -9.0)))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((y * 9.0) * z) <= 1e+100) {
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
} else {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (y * (t * (z * -9.0)))));
}
return tmp;
}
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(y * 9.0) * z) <= 1e+100) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(9.0 * Float64(y * z)) * t)) + Float64(Float64(a * 27.0) * b)); else tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(y * Float64(t * Float64(z * -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[N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision], 1e+100], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq 10^{+100}:\\
\;\;\;\;\left(x \cdot 2 - \left(9 \cdot \left(y \cdot z\right)\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 1.00000000000000002e100Initial program 97.2%
Taylor expanded in y around 0 97.2%
if 1.00000000000000002e100 < (*.f64 (*.f64 y 9) z) Initial program 83.4%
+-commutative83.4%
associate-+r-83.4%
cancel-sign-sub-inv83.4%
*-commutative83.4%
distribute-rgt-neg-out83.4%
associate-*r*93.6%
*-commutative93.6%
distribute-rgt-neg-in93.6%
associate-+r+93.6%
sub-neg93.6%
associate-*l*93.6%
fma-def97.9%
fma-neg97.9%
associate-*l*99.8%
*-commutative99.8%
associate-*r*99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Final simplification97.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= (* (* y 9.0) z) 1e+100) (+ (- (* x 2.0) (* (* 9.0 (* y z)) t)) (* (* a 27.0) b)) (+ (- (* x 2.0) (* (* y 9.0) (* z t))) (* 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 (((y * 9.0) * z) <= 1e+100) {
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
} else {
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (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 (((y * 9.0d0) * z) <= 1d+100) then
tmp = ((x * 2.0d0) - ((9.0d0 * (y * z)) * t)) + ((a * 27.0d0) * b)
else
tmp = ((x * 2.0d0) - ((y * 9.0d0) * (z * t))) + (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 (((y * 9.0) * z) <= 1e+100) {
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
} else {
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if ((y * 9.0) * z) <= 1e+100: tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b) else: tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (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 (Float64(Float64(y * 9.0) * z) <= 1e+100) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(9.0 * Float64(y * z)) * t)) + Float64(Float64(a * 27.0) * b)); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(z * t))) + 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 (((y * 9.0) * z) <= 1e+100)
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
else
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (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[N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision], 1e+100], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq 10^{+100}:\\
\;\;\;\;\left(x \cdot 2 - \left(9 \cdot \left(y \cdot z\right)\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 1.00000000000000002e100Initial program 97.2%
Taylor expanded in y around 0 97.2%
if 1.00000000000000002e100 < (*.f64 (*.f64 y 9) z) Initial program 83.4%
sub-neg83.4%
distribute-lft-neg-in83.4%
associate-*l*83.4%
*-commutative83.4%
*-commutative83.4%
cancel-sign-sub-inv83.4%
*-commutative83.4%
*-commutative83.4%
associate-*l*83.4%
associate-*l*93.7%
associate-*l*93.7%
Simplified93.7%
Final simplification96.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= b -1.35e+100)
(* 27.0 (* a b))
(if (or (<= b 3.9e+104) (and (not (<= b 7.5e+125)) (<= b 1.15e+169)))
(- (* x 2.0) (* 9.0 (* (* y z) t)))
(* 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+100) {
tmp = 27.0 * (a * b);
} else if ((b <= 3.9e+104) || (!(b <= 7.5e+125) && (b <= 1.15e+169))) {
tmp = (x * 2.0) - (9.0 * ((y * z) * t));
} 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+100)) then
tmp = 27.0d0 * (a * b)
else if ((b <= 3.9d+104) .or. (.not. (b <= 7.5d+125)) .and. (b <= 1.15d+169)) then
tmp = (x * 2.0d0) - (9.0d0 * ((y * z) * t))
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+100) {
tmp = 27.0 * (a * b);
} else if ((b <= 3.9e+104) || (!(b <= 7.5e+125) && (b <= 1.15e+169))) {
tmp = (x * 2.0) - (9.0 * ((y * z) * t));
} 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+100: tmp = 27.0 * (a * b) elif (b <= 3.9e+104) or (not (b <= 7.5e+125) and (b <= 1.15e+169)): tmp = (x * 2.0) - (9.0 * ((y * z) * t)) 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+100) tmp = Float64(27.0 * Float64(a * b)); elseif ((b <= 3.9e+104) || (!(b <= 7.5e+125) && (b <= 1.15e+169))) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(Float64(y * z) * t))); 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+100)
tmp = 27.0 * (a * b);
elseif ((b <= 3.9e+104) || (~((b <= 7.5e+125)) && (b <= 1.15e+169)))
tmp = (x * 2.0) - (9.0 * ((y * z) * t));
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+100], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 3.9e+104], And[N[Not[LessEqual[b, 7.5e+125]], $MachinePrecision], LessEqual[b, 1.15e+169]]], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(N[(y * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $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^{+100}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;b \leq 3.9 \cdot 10^{+104} \lor \neg \left(b \leq 7.5 \cdot 10^{+125}\right) \land b \leq 1.15 \cdot 10^{+169}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(\left(y \cdot z\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\end{array}
\end{array}
if b < -1.34999999999999999e100Initial program 93.4%
sub-neg93.4%
distribute-lft-neg-in93.4%
associate-*l*93.3%
*-commutative93.3%
*-commutative93.3%
cancel-sign-sub-inv93.3%
*-commutative93.3%
*-commutative93.3%
associate-*l*93.4%
associate-*l*95.4%
associate-*l*95.3%
Simplified95.3%
Taylor expanded in a around inf 55.2%
if -1.34999999999999999e100 < b < 3.90000000000000017e104 or 7.5000000000000006e125 < b < 1.15e169Initial program 94.7%
sub-neg94.7%
distribute-lft-neg-in94.7%
associate-*l*94.7%
*-commutative94.7%
*-commutative94.7%
cancel-sign-sub-inv94.7%
*-commutative94.7%
*-commutative94.7%
associate-*l*94.7%
associate-*l*95.4%
associate-*l*95.3%
Simplified95.3%
Taylor expanded in a around 0 76.8%
if 3.90000000000000017e104 < b < 7.5000000000000006e125 or 1.15e169 < b Initial program 96.5%
sub-neg96.5%
distribute-lft-neg-in96.5%
associate-*l*96.5%
*-commutative96.5%
*-commutative96.5%
cancel-sign-sub-inv96.5%
*-commutative96.5%
*-commutative96.5%
associate-*l*96.5%
associate-*l*93.4%
associate-*l*93.4%
Simplified93.4%
Taylor expanded in a around inf 80.7%
expm1-log1p-u37.3%
expm1-udef37.3%
Applied egg-rr37.3%
expm1-def37.3%
expm1-log1p80.7%
*-commutative80.7%
associate-*l*80.8%
Simplified80.8%
Final simplification73.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* 9.0 (* y z)) t)) (* (* a 27.0) b)))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
}
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) - ((9.0d0 * (y * z)) * t)) + ((a * 27.0d0) * b)
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) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): return ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b)
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(9.0 * Float64(y * z)) * t)) + Float64(Float64(a * 27.0) * b)) end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp = code(x, y, z, t, a, b)
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\left(x \cdot 2 - \left(9 \cdot \left(y \cdot z\right)\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
Initial program 94.7%
Taylor expanded in y around 0 94.7%
Final simplification94.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* -9.0 (* (* y z) t))))
(if (<= t -3.6e-180)
t_1
(if (<= t 1.82e-208)
(* a (* 27.0 b))
(if (<= t 3.4e+14) (* x 2.0) (if (<= t 7e+83) (* 27.0 (* a b)) t_1))))))assert(y < z && z < t);
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 (t <= -3.6e-180) {
tmp = t_1;
} else if (t <= 1.82e-208) {
tmp = a * (27.0 * b);
} else if (t <= 3.4e+14) {
tmp = x * 2.0;
} else if (t <= 7e+83) {
tmp = 27.0 * (a * b);
} else {
tmp = t_1;
}
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 = (-9.0d0) * ((y * z) * t)
if (t <= (-3.6d-180)) then
tmp = t_1
else if (t <= 1.82d-208) then
tmp = a * (27.0d0 * b)
else if (t <= 3.4d+14) then
tmp = x * 2.0d0
else if (t <= 7d+83) then
tmp = 27.0d0 * (a * b)
else
tmp = t_1
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -9.0 * ((y * z) * t);
double tmp;
if (t <= -3.6e-180) {
tmp = t_1;
} else if (t <= 1.82e-208) {
tmp = a * (27.0 * b);
} else if (t <= 3.4e+14) {
tmp = x * 2.0;
} else if (t <= 7e+83) {
tmp = 27.0 * (a * b);
} else {
tmp = t_1;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = -9.0 * ((y * z) * t) tmp = 0 if t <= -3.6e-180: tmp = t_1 elif t <= 1.82e-208: tmp = a * (27.0 * b) elif t <= 3.4e+14: tmp = x * 2.0 elif t <= 7e+83: tmp = 27.0 * (a * b) else: tmp = t_1 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(-9.0 * Float64(Float64(y * z) * t)) tmp = 0.0 if (t <= -3.6e-180) tmp = t_1; elseif (t <= 1.82e-208) tmp = Float64(a * Float64(27.0 * b)); elseif (t <= 3.4e+14) tmp = Float64(x * 2.0); elseif (t <= 7e+83) tmp = Float64(27.0 * Float64(a * b)); else tmp = t_1; end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = -9.0 * ((y * z) * t);
tmp = 0.0;
if (t <= -3.6e-180)
tmp = t_1;
elseif (t <= 1.82e-208)
tmp = a * (27.0 * b);
elseif (t <= 3.4e+14)
tmp = x * 2.0;
elseif (t <= 7e+83)
tmp = 27.0 * (a * b);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(-9.0 * N[(N[(y * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.6e-180], t$95$1, If[LessEqual[t, 1.82e-208], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.4e+14], N[(x * 2.0), $MachinePrecision], If[LessEqual[t, 7e+83], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := -9 \cdot \left(\left(y \cdot z\right) \cdot t\right)\\
\mathbf{if}\;t \leq -3.6 \cdot 10^{-180}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.82 \cdot 10^{-208}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+14}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+83}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -3.5999999999999999e-180 or 6.99999999999999954e83 < t Initial program 95.7%
sub-neg95.7%
distribute-lft-neg-in95.7%
associate-*l*95.7%
*-commutative95.7%
*-commutative95.7%
cancel-sign-sub-inv95.7%
*-commutative95.7%
*-commutative95.7%
associate-*l*95.7%
associate-*l*92.9%
associate-*l*92.9%
Simplified92.9%
Taylor expanded in y around inf 47.5%
if -3.5999999999999999e-180 < t < 1.81999999999999994e-208Initial program 89.0%
sub-neg89.0%
distribute-lft-neg-in89.0%
associate-*l*88.9%
*-commutative88.9%
*-commutative88.9%
cancel-sign-sub-inv88.9%
*-commutative88.9%
*-commutative88.9%
associate-*l*89.0%
associate-*l*98.1%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in a around inf 46.6%
expm1-log1p-u31.3%
expm1-udef23.8%
Applied egg-rr23.8%
expm1-def31.3%
expm1-log1p46.6%
*-commutative46.6%
associate-*l*46.6%
Simplified46.6%
if 1.81999999999999994e-208 < t < 3.4e14Initial program 96.3%
sub-neg96.3%
distribute-lft-neg-in96.3%
associate-*l*96.3%
*-commutative96.3%
*-commutative96.3%
cancel-sign-sub-inv96.3%
*-commutative96.3%
*-commutative96.3%
associate-*l*96.3%
associate-*l*96.7%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in x around inf 43.3%
if 3.4e14 < t < 6.99999999999999954e83Initial program 99.9%
sub-neg99.9%
distribute-lft-neg-in99.9%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*99.9%
associate-*l*99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in a around inf 45.2%
Final simplification46.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 (<= t -3.6e-180)
(* -9.0 (* (* y z) t))
(if (<= t 2.25e-207)
(* a (* 27.0 b))
(if (<= t 25000000000000.0)
(* x 2.0)
(if (<= t 6e+83) (* 27.0 (* a b)) (* t (* (* y z) -9.0)))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.6e-180) {
tmp = -9.0 * ((y * z) * t);
} else if (t <= 2.25e-207) {
tmp = a * (27.0 * b);
} else if (t <= 25000000000000.0) {
tmp = x * 2.0;
} else if (t <= 6e+83) {
tmp = 27.0 * (a * b);
} else {
tmp = t * ((y * z) * -9.0);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= (-3.6d-180)) then
tmp = (-9.0d0) * ((y * z) * t)
else if (t <= 2.25d-207) then
tmp = a * (27.0d0 * b)
else if (t <= 25000000000000.0d0) then
tmp = x * 2.0d0
else if (t <= 6d+83) then
tmp = 27.0d0 * (a * b)
else
tmp = t * ((y * z) * (-9.0d0))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.6e-180) {
tmp = -9.0 * ((y * z) * t);
} else if (t <= 2.25e-207) {
tmp = a * (27.0 * b);
} else if (t <= 25000000000000.0) {
tmp = x * 2.0;
} else if (t <= 6e+83) {
tmp = 27.0 * (a * b);
} else {
tmp = t * ((y * z) * -9.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if t <= -3.6e-180: tmp = -9.0 * ((y * z) * t) elif t <= 2.25e-207: tmp = a * (27.0 * b) elif t <= 25000000000000.0: tmp = x * 2.0 elif t <= 6e+83: tmp = 27.0 * (a * b) else: tmp = t * ((y * z) * -9.0) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -3.6e-180) tmp = Float64(-9.0 * Float64(Float64(y * z) * t)); elseif (t <= 2.25e-207) tmp = Float64(a * Float64(27.0 * b)); elseif (t <= 25000000000000.0) tmp = Float64(x * 2.0); elseif (t <= 6e+83) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(t * Float64(Float64(y * z) * -9.0)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (t <= -3.6e-180)
tmp = -9.0 * ((y * z) * t);
elseif (t <= 2.25e-207)
tmp = a * (27.0 * b);
elseif (t <= 25000000000000.0)
tmp = x * 2.0;
elseif (t <= 6e+83)
tmp = 27.0 * (a * b);
else
tmp = t * ((y * z) * -9.0);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.6e-180], N[(-9.0 * N[(N[(y * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.25e-207], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 25000000000000.0], N[(x * 2.0), $MachinePrecision], If[LessEqual[t, 6e+83], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y * z), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{-180}:\\
\;\;\;\;-9 \cdot \left(\left(y \cdot z\right) \cdot t\right)\\
\mathbf{elif}\;t \leq 2.25 \cdot 10^{-207}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;t \leq 25000000000000:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+83}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(\left(y \cdot z\right) \cdot -9\right)\\
\end{array}
\end{array}
if t < -3.5999999999999999e-180Initial program 95.0%
sub-neg95.0%
distribute-lft-neg-in95.0%
associate-*l*95.0%
*-commutative95.0%
*-commutative95.0%
cancel-sign-sub-inv95.0%
*-commutative95.0%
*-commutative95.0%
associate-*l*95.0%
associate-*l*93.0%
associate-*l*92.9%
Simplified92.9%
Taylor expanded in y around inf 37.9%
if -3.5999999999999999e-180 < t < 2.24999999999999996e-207Initial program 89.0%
sub-neg89.0%
distribute-lft-neg-in89.0%
associate-*l*88.9%
*-commutative88.9%
*-commutative88.9%
cancel-sign-sub-inv88.9%
*-commutative88.9%
*-commutative88.9%
associate-*l*89.0%
associate-*l*98.1%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in a around inf 46.6%
expm1-log1p-u31.3%
expm1-udef23.8%
Applied egg-rr23.8%
expm1-def31.3%
expm1-log1p46.6%
*-commutative46.6%
associate-*l*46.6%
Simplified46.6%
if 2.24999999999999996e-207 < t < 2.5e13Initial program 96.3%
sub-neg96.3%
distribute-lft-neg-in96.3%
associate-*l*96.3%
*-commutative96.3%
*-commutative96.3%
cancel-sign-sub-inv96.3%
*-commutative96.3%
*-commutative96.3%
associate-*l*96.3%
associate-*l*96.7%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in x around inf 43.3%
if 2.5e13 < t < 5.9999999999999999e83Initial program 99.9%
sub-neg99.9%
distribute-lft-neg-in99.9%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*99.9%
associate-*l*99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in a around inf 45.2%
if 5.9999999999999999e83 < t Initial program 97.3%
sub-neg97.3%
distribute-lft-neg-in97.3%
associate-*l*97.4%
*-commutative97.4%
*-commutative97.4%
cancel-sign-sub-inv97.4%
*-commutative97.4%
*-commutative97.4%
associate-*l*97.3%
associate-*l*92.8%
associate-*l*92.8%
Simplified92.8%
Taylor expanded in y around inf 70.0%
*-commutative70.0%
associate-*r*69.3%
*-commutative69.3%
associate-*r*69.3%
*-commutative69.3%
associate-*r*70.0%
Simplified70.0%
Taylor expanded in y around 0 70.1%
Final simplification46.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 (<= t -3.6e-180)
(* y (* -9.0 (* z t)))
(if (<= t 1.2e-207)
(* a (* 27.0 b))
(if (<= t 30500000000000.0)
(* x 2.0)
(if (<= t 1.25e+84) (* 27.0 (* a b)) (* t (* (* y z) -9.0)))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.6e-180) {
tmp = y * (-9.0 * (z * t));
} else if (t <= 1.2e-207) {
tmp = a * (27.0 * b);
} else if (t <= 30500000000000.0) {
tmp = x * 2.0;
} else if (t <= 1.25e+84) {
tmp = 27.0 * (a * b);
} else {
tmp = t * ((y * z) * -9.0);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= (-3.6d-180)) then
tmp = y * ((-9.0d0) * (z * t))
else if (t <= 1.2d-207) then
tmp = a * (27.0d0 * b)
else if (t <= 30500000000000.0d0) then
tmp = x * 2.0d0
else if (t <= 1.25d+84) then
tmp = 27.0d0 * (a * b)
else
tmp = t * ((y * z) * (-9.0d0))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.6e-180) {
tmp = y * (-9.0 * (z * t));
} else if (t <= 1.2e-207) {
tmp = a * (27.0 * b);
} else if (t <= 30500000000000.0) {
tmp = x * 2.0;
} else if (t <= 1.25e+84) {
tmp = 27.0 * (a * b);
} else {
tmp = t * ((y * z) * -9.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if t <= -3.6e-180: tmp = y * (-9.0 * (z * t)) elif t <= 1.2e-207: tmp = a * (27.0 * b) elif t <= 30500000000000.0: tmp = x * 2.0 elif t <= 1.25e+84: tmp = 27.0 * (a * b) else: tmp = t * ((y * z) * -9.0) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -3.6e-180) tmp = Float64(y * Float64(-9.0 * Float64(z * t))); elseif (t <= 1.2e-207) tmp = Float64(a * Float64(27.0 * b)); elseif (t <= 30500000000000.0) tmp = Float64(x * 2.0); elseif (t <= 1.25e+84) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(t * Float64(Float64(y * z) * -9.0)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (t <= -3.6e-180)
tmp = y * (-9.0 * (z * t));
elseif (t <= 1.2e-207)
tmp = a * (27.0 * b);
elseif (t <= 30500000000000.0)
tmp = x * 2.0;
elseif (t <= 1.25e+84)
tmp = 27.0 * (a * b);
else
tmp = t * ((y * z) * -9.0);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.6e-180], N[(y * N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.2e-207], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 30500000000000.0], N[(x * 2.0), $MachinePrecision], If[LessEqual[t, 1.25e+84], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y * z), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{-180}:\\
\;\;\;\;y \cdot \left(-9 \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{-207}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;t \leq 30500000000000:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+84}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(\left(y \cdot z\right) \cdot -9\right)\\
\end{array}
\end{array}
if t < -3.5999999999999999e-180Initial program 95.0%
sub-neg95.0%
distribute-lft-neg-in95.0%
associate-*l*95.0%
*-commutative95.0%
*-commutative95.0%
cancel-sign-sub-inv95.0%
*-commutative95.0%
*-commutative95.0%
associate-*l*95.0%
associate-*l*93.0%
associate-*l*92.9%
Simplified92.9%
Taylor expanded in y around inf 37.9%
*-commutative37.9%
associate-*r*38.5%
*-commutative38.5%
associate-*r*38.5%
associate-*l*38.8%
Simplified38.8%
Taylor expanded in t around 0 38.8%
if -3.5999999999999999e-180 < t < 1.19999999999999994e-207Initial program 89.0%
sub-neg89.0%
distribute-lft-neg-in89.0%
associate-*l*88.9%
*-commutative88.9%
*-commutative88.9%
cancel-sign-sub-inv88.9%
*-commutative88.9%
*-commutative88.9%
associate-*l*89.0%
associate-*l*98.1%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in a around inf 46.6%
expm1-log1p-u31.3%
expm1-udef23.8%
Applied egg-rr23.8%
expm1-def31.3%
expm1-log1p46.6%
*-commutative46.6%
associate-*l*46.6%
Simplified46.6%
if 1.19999999999999994e-207 < t < 3.05e13Initial program 96.3%
sub-neg96.3%
distribute-lft-neg-in96.3%
associate-*l*96.3%
*-commutative96.3%
*-commutative96.3%
cancel-sign-sub-inv96.3%
*-commutative96.3%
*-commutative96.3%
associate-*l*96.3%
associate-*l*96.7%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in x around inf 43.3%
if 3.05e13 < t < 1.25e84Initial program 99.9%
sub-neg99.9%
distribute-lft-neg-in99.9%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*99.9%
associate-*l*99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in a around inf 45.2%
if 1.25e84 < t Initial program 97.3%
sub-neg97.3%
distribute-lft-neg-in97.3%
associate-*l*97.4%
*-commutative97.4%
*-commutative97.4%
cancel-sign-sub-inv97.4%
*-commutative97.4%
*-commutative97.4%
associate-*l*97.3%
associate-*l*92.8%
associate-*l*92.8%
Simplified92.8%
Taylor expanded in y around inf 70.0%
*-commutative70.0%
associate-*r*69.3%
*-commutative69.3%
associate-*r*69.3%
*-commutative69.3%
associate-*r*70.0%
Simplified70.0%
Taylor expanded in y around 0 70.1%
Final simplification46.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= a -5.2e+69) (not (<= a 6400000000.0))) (* 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 ((a <= -5.2e+69) || !(a <= 6400000000.0)) {
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 ((a <= (-5.2d+69)) .or. (.not. (a <= 6400000000.0d0))) 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 ((a <= -5.2e+69) || !(a <= 6400000000.0)) {
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 (a <= -5.2e+69) or not (a <= 6400000000.0): 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 ((a <= -5.2e+69) || !(a <= 6400000000.0)) 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 ((a <= -5.2e+69) || ~((a <= 6400000000.0)))
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[a, -5.2e+69], N[Not[LessEqual[a, 6400000000.0]], $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}\;a \leq -5.2 \cdot 10^{+69} \lor \neg \left(a \leq 6400000000\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if a < -5.2000000000000004e69 or 6.4e9 < a Initial program 95.5%
sub-neg95.5%
distribute-lft-neg-in95.5%
associate-*l*95.5%
*-commutative95.5%
*-commutative95.5%
cancel-sign-sub-inv95.5%
*-commutative95.5%
*-commutative95.5%
associate-*l*95.5%
associate-*l*96.2%
associate-*l*96.2%
Simplified96.2%
Taylor expanded in a around inf 53.8%
if -5.2000000000000004e69 < a < 6.4e9Initial program 94.1%
sub-neg94.1%
distribute-lft-neg-in94.1%
associate-*l*94.2%
*-commutative94.2%
*-commutative94.2%
cancel-sign-sub-inv94.2%
*-commutative94.2%
*-commutative94.2%
associate-*l*94.1%
associate-*l*94.3%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in x around inf 44.6%
Final simplification48.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 (<= a -9.2e+67) (* a (* 27.0 b)) (if (<= a 6600000000.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 (a <= -9.2e+67) {
tmp = a * (27.0 * b);
} else if (a <= 6600000000.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.
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 (a <= (-9.2d+67)) then
tmp = a * (27.0d0 * b)
else if (a <= 6600000000.0d0) then
tmp = x * 2.0d0
else
tmp = 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 (a <= -9.2e+67) {
tmp = a * (27.0 * b);
} else if (a <= 6600000000.0) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if a <= -9.2e+67: tmp = a * (27.0 * b) elif a <= 6600000000.0: tmp = x * 2.0 else: tmp = 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 (a <= -9.2e+67) tmp = Float64(a * Float64(27.0 * b)); elseif (a <= 6600000000.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])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (a <= -9.2e+67)
tmp = a * (27.0 * b);
elseif (a <= 6600000000.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. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -9.2e+67], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6600000000.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])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.2 \cdot 10^{+67}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;a \leq 6600000000:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if a < -9.1999999999999994e67Initial program 95.5%
sub-neg95.5%
distribute-lft-neg-in95.5%
associate-*l*95.6%
*-commutative95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.5%
associate-*l*97.8%
associate-*l*97.7%
Simplified97.7%
Taylor expanded in a around inf 58.1%
expm1-log1p-u31.7%
expm1-udef27.2%
Applied egg-rr27.2%
expm1-def31.7%
expm1-log1p58.1%
*-commutative58.1%
associate-*l*58.1%
Simplified58.1%
if -9.1999999999999994e67 < a < 6.6e9Initial program 94.1%
sub-neg94.1%
distribute-lft-neg-in94.1%
associate-*l*94.2%
*-commutative94.2%
*-commutative94.2%
cancel-sign-sub-inv94.2%
*-commutative94.2%
*-commutative94.2%
associate-*l*94.1%
associate-*l*94.3%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in x around inf 44.6%
if 6.6e9 < a Initial program 95.4%
sub-neg95.4%
distribute-lft-neg-in95.4%
associate-*l*95.4%
*-commutative95.4%
*-commutative95.4%
cancel-sign-sub-inv95.4%
*-commutative95.4%
*-commutative95.4%
associate-*l*95.4%
associate-*l*95.2%
associate-*l*95.2%
Simplified95.2%
Taylor expanded in a around inf 50.8%
Final simplification48.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.7%
sub-neg94.7%
distribute-lft-neg-in94.7%
associate-*l*94.7%
*-commutative94.7%
*-commutative94.7%
cancel-sign-sub-inv94.7%
*-commutative94.7%
*-commutative94.7%
associate-*l*94.7%
associate-*l*95.1%
associate-*l*95.1%
Simplified95.1%
Taylor expanded in x around inf 35.5%
Final simplification35.5%
(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 2023287
(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)))