
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 3.0 a))))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (((a * a) * (1.0d0 - a)) + ((b * b) * (3.0d0 + a))))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 - a)) + Float64(Float64(b * b) * Float64(3.0 + a))))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0; end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(3.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 3.0 a))))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (((a * a) * (1.0d0 - a)) + ((b * b) * (3.0d0 + a))))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 - a)) + Float64(Float64(b * b) * Float64(3.0 + a))))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0; end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(3.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1
\end{array}
(FPCore (a b)
:precision binary64
(if (<=
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ a 3.0)))))
INFINITY)
(+
(* (hypot a b) (* (hypot a b) (pow (hypot a b) 2.0)))
(+ (* 4.0 (fma (* a a) (- 1.0 a) (* b (* b (+ a 3.0))))) -1.0))
(* (pow a 3.0) (- a 4.0))))
double code(double a, double b) {
double tmp;
if ((pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))))) <= ((double) INFINITY)) {
tmp = (hypot(a, b) * (hypot(a, b) * pow(hypot(a, b), 2.0))) + ((4.0 * fma((a * a), (1.0 - a), (b * (b * (a + 3.0))))) + -1.0);
} else {
tmp = pow(a, 3.0) * (a - 4.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 - a)) + Float64(Float64(b * b) * Float64(a + 3.0))))) <= Inf) tmp = Float64(Float64(hypot(a, b) * Float64(hypot(a, b) * (hypot(a, b) ^ 2.0))) + Float64(Float64(4.0 * fma(Float64(a * a), Float64(1.0 - a), Float64(b * Float64(b * Float64(a + 3.0))))) + -1.0)); else tmp = Float64((a ^ 3.0) * Float64(a - 4.0)); end return tmp end
code[a_, b_] := If[LessEqual[N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision] * N[(N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision] * N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(4.0 * N[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision] + N[(b * N[(b * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 3.0], $MachinePrecision] * N[(a - 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) \leq \infty:\\
\;\;\;\;\mathsf{hypot}\left(a, b\right) \cdot \left(\mathsf{hypot}\left(a, b\right) \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, b \cdot \left(b \cdot \left(a + 3\right)\right)\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{3} \cdot \left(a - 4\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) < +inf.0Initial program 99.8%
associate--l+99.8%
fma-define99.8%
distribute-rgt-in99.8%
sqr-neg99.8%
distribute-rgt-in99.8%
Simplified99.8%
fma-define99.8%
unpow299.8%
fma-define99.8%
add-sqr-sqrt99.8%
associate-*l*99.8%
fma-define99.8%
hypot-define99.8%
fma-define99.8%
hypot-define99.8%
fma-define99.9%
add-sqr-sqrt99.8%
pow299.8%
fma-define99.8%
hypot-define99.8%
Applied egg-rr99.8%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) Initial program 0.0%
associate--l+0.0%
fma-define0.0%
distribute-rgt-in0.0%
sqr-neg0.0%
distribute-rgt-in0.0%
Simplified5.3%
Taylor expanded in a around inf 95.0%
associate-*r/95.0%
metadata-eval95.0%
Simplified95.0%
Taylor expanded in a around 0 95.0%
Final simplification98.8%
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ a 3.0)))))))
(if (<= t_0 INFINITY) (+ t_0 -1.0) (* (pow a 3.0) (- a 4.0)))))
double code(double a, double b) {
double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 + -1.0;
} else {
tmp = pow(a, 3.0) * (a - 4.0);
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 + -1.0;
} else {
tmp = Math.pow(a, 3.0) * (a - 4.0);
}
return tmp;
}
def code(a, b): t_0 = math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0)))) tmp = 0 if t_0 <= math.inf: tmp = t_0 + -1.0 else: tmp = math.pow(a, 3.0) * (a - 4.0) return tmp
function code(a, b) t_0 = Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 - a)) + Float64(Float64(b * b) * Float64(a + 3.0))))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 + -1.0); else tmp = Float64((a ^ 3.0) * Float64(a - 4.0)); end return tmp end
function tmp_2 = code(a, b) t_0 = (((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0)))); tmp = 0.0; if (t_0 <= Inf) tmp = t_0 + -1.0; else tmp = (a ^ 3.0) * (a - 4.0); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 + -1.0), $MachinePrecision], N[(N[Power[a, 3.0], $MachinePrecision] * N[(a - 4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{3} \cdot \left(a - 4\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) < +inf.0Initial program 99.8%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) Initial program 0.0%
associate--l+0.0%
fma-define0.0%
distribute-rgt-in0.0%
sqr-neg0.0%
distribute-rgt-in0.0%
Simplified5.3%
Taylor expanded in a around inf 95.0%
associate-*r/95.0%
metadata-eval95.0%
Simplified95.0%
Taylor expanded in a around 0 95.0%
Final simplification98.7%
(FPCore (a b)
:precision binary64
(if (<= (* b b) 2e+141)
(+
(+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* a a) (* (* b b) (+ a 3.0)))))
-1.0)
(pow b 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+141) {
tmp = (pow(((a * a) + (b * b)), 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0;
} else {
tmp = pow(b, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 2d+141) then
tmp = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * ((a * a) + ((b * b) * (a + 3.0d0))))) + (-1.0d0)
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+141) {
tmp = (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0;
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e+141: tmp = (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0 else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+141) tmp = Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(a * a) + Float64(Float64(b * b) * Float64(a + 3.0))))) + -1.0); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e+141) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+141], N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+141}:\\
\;\;\;\;\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(a \cdot a + \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 2.00000000000000003e141Initial program 86.4%
Taylor expanded in a around 0 97.2%
if 2.00000000000000003e141 < (*.f64 b b) Initial program 62.0%
associate--l+62.0%
fma-define62.0%
distribute-rgt-in62.0%
sqr-neg62.0%
distribute-rgt-in62.0%
Simplified65.2%
Taylor expanded in a around 0 100.0%
Taylor expanded in b around inf 100.0%
Final simplification98.2%
(FPCore (a b)
:precision binary64
(if (<= a -2200000.0)
(* (pow a 4.0) (+ (+ 2.0 (/ -4.0 a)) -1.0))
(if (<= a 1100000000.0)
(+ (+ (pow b 4.0) (* (* b b) 12.0)) -1.0)
(* (pow a 4.0) (- 1.0 (/ 4.0 a))))))
double code(double a, double b) {
double tmp;
if (a <= -2200000.0) {
tmp = pow(a, 4.0) * ((2.0 + (-4.0 / a)) + -1.0);
} else if (a <= 1100000000.0) {
tmp = (pow(b, 4.0) + ((b * b) * 12.0)) + -1.0;
} else {
tmp = pow(a, 4.0) * (1.0 - (4.0 / a));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-2200000.0d0)) then
tmp = (a ** 4.0d0) * ((2.0d0 + ((-4.0d0) / a)) + (-1.0d0))
else if (a <= 1100000000.0d0) then
tmp = ((b ** 4.0d0) + ((b * b) * 12.0d0)) + (-1.0d0)
else
tmp = (a ** 4.0d0) * (1.0d0 - (4.0d0 / a))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -2200000.0) {
tmp = Math.pow(a, 4.0) * ((2.0 + (-4.0 / a)) + -1.0);
} else if (a <= 1100000000.0) {
tmp = (Math.pow(b, 4.0) + ((b * b) * 12.0)) + -1.0;
} else {
tmp = Math.pow(a, 4.0) * (1.0 - (4.0 / a));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2200000.0: tmp = math.pow(a, 4.0) * ((2.0 + (-4.0 / a)) + -1.0) elif a <= 1100000000.0: tmp = (math.pow(b, 4.0) + ((b * b) * 12.0)) + -1.0 else: tmp = math.pow(a, 4.0) * (1.0 - (4.0 / a)) return tmp
function code(a, b) tmp = 0.0 if (a <= -2200000.0) tmp = Float64((a ^ 4.0) * Float64(Float64(2.0 + Float64(-4.0 / a)) + -1.0)); elseif (a <= 1100000000.0) tmp = Float64(Float64((b ^ 4.0) + Float64(Float64(b * b) * 12.0)) + -1.0); else tmp = Float64((a ^ 4.0) * Float64(1.0 - Float64(4.0 / a))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2200000.0) tmp = (a ^ 4.0) * ((2.0 + (-4.0 / a)) + -1.0); elseif (a <= 1100000000.0) tmp = ((b ^ 4.0) + ((b * b) * 12.0)) + -1.0; else tmp = (a ^ 4.0) * (1.0 - (4.0 / a)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2200000.0], N[(N[Power[a, 4.0], $MachinePrecision] * N[(N[(2.0 + N[(-4.0 / a), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1100000000.0], N[(N[(N[Power[b, 4.0], $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 - N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2200000:\\
\;\;\;\;{a}^{4} \cdot \left(\left(2 + \frac{-4}{a}\right) + -1\right)\\
\mathbf{elif}\;a \leq 1100000000:\\
\;\;\;\;\left({b}^{4} + \left(b \cdot b\right) \cdot 12\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4} \cdot \left(1 - \frac{4}{a}\right)\\
\end{array}
\end{array}
if a < -2.2e6Initial program 63.0%
associate--l+63.0%
fma-define63.0%
distribute-rgt-in63.0%
sqr-neg63.0%
distribute-rgt-in63.0%
Simplified63.0%
Taylor expanded in a around inf 93.0%
associate-*r/93.0%
metadata-eval93.0%
Simplified93.0%
expm1-log1p-u93.0%
Applied egg-rr93.0%
expm1-undefine93.0%
sub-neg93.0%
log1p-undefine93.0%
rem-exp-log93.0%
sub-neg93.0%
metadata-eval93.0%
associate-*r/93.0%
associate-+r+93.0%
metadata-eval93.0%
associate-*r/93.0%
metadata-eval93.0%
distribute-neg-frac93.0%
metadata-eval93.0%
metadata-eval93.0%
Simplified93.0%
if -2.2e6 < a < 1.1e9Initial program 99.2%
associate--l+99.2%
fma-define99.2%
distribute-rgt-in99.2%
sqr-neg99.2%
distribute-rgt-in99.2%
Simplified99.2%
Taylor expanded in a around 0 98.2%
pow298.2%
Applied egg-rr98.2%
if 1.1e9 < a Initial program 38.4%
associate--l+38.4%
fma-define38.4%
distribute-rgt-in38.4%
sqr-neg38.4%
distribute-rgt-in38.4%
Simplified43.7%
Taylor expanded in a around inf 90.0%
associate-*r/90.0%
metadata-eval90.0%
Simplified90.0%
Final simplification95.2%
(FPCore (a b) :precision binary64 (if (<= (* b b) 1000.0) (+ (* (pow a 2.0) (+ 4.0 (* a (- a 4.0)))) -1.0) (+ (+ (pow b 4.0) (* (* b b) 12.0)) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 1000.0) {
tmp = (pow(a, 2.0) * (4.0 + (a * (a - 4.0)))) + -1.0;
} else {
tmp = (pow(b, 4.0) + ((b * b) * 12.0)) + -1.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 1000.0d0) then
tmp = ((a ** 2.0d0) * (4.0d0 + (a * (a - 4.0d0)))) + (-1.0d0)
else
tmp = ((b ** 4.0d0) + ((b * b) * 12.0d0)) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 1000.0) {
tmp = (Math.pow(a, 2.0) * (4.0 + (a * (a - 4.0)))) + -1.0;
} else {
tmp = (Math.pow(b, 4.0) + ((b * b) * 12.0)) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 1000.0: tmp = (math.pow(a, 2.0) * (4.0 + (a * (a - 4.0)))) + -1.0 else: tmp = (math.pow(b, 4.0) + ((b * b) * 12.0)) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 1000.0) tmp = Float64(Float64((a ^ 2.0) * Float64(4.0 + Float64(a * Float64(a - 4.0)))) + -1.0); else tmp = Float64(Float64((b ^ 4.0) + Float64(Float64(b * b) * 12.0)) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 1000.0) tmp = ((a ^ 2.0) * (4.0 + (a * (a - 4.0)))) + -1.0; else tmp = ((b ^ 4.0) + ((b * b) * 12.0)) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 1000.0], N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[(4.0 + N[(a * N[(a - 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[Power[b, 4.0], $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 1000:\\
\;\;\;\;{a}^{2} \cdot \left(4 + a \cdot \left(a - 4\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left({b}^{4} + \left(b \cdot b\right) \cdot 12\right) + -1\\
\end{array}
\end{array}
if (*.f64 b b) < 1e3Initial program 89.8%
associate--l+89.8%
fma-define89.8%
distribute-rgt-in89.8%
sqr-neg89.8%
distribute-rgt-in89.8%
Simplified89.8%
Taylor expanded in b around 0 89.2%
Taylor expanded in a around 0 99.1%
if 1e3 < (*.f64 b b) Initial program 65.0%
associate--l+65.0%
fma-define65.0%
distribute-rgt-in65.0%
sqr-neg65.0%
distribute-rgt-in65.0%
Simplified67.3%
Taylor expanded in a around 0 90.9%
pow290.9%
Applied egg-rr90.9%
Final simplification95.1%
(FPCore (a b) :precision binary64 (if (<= b 4.2e-12) (+ (* (* a a) 4.0) -1.0) (if (<= b 52000000.0) (* (pow a 4.0) (- 1.0 (/ 4.0 a))) (pow b 4.0))))
double code(double a, double b) {
double tmp;
if (b <= 4.2e-12) {
tmp = ((a * a) * 4.0) + -1.0;
} else if (b <= 52000000.0) {
tmp = pow(a, 4.0) * (1.0 - (4.0 / a));
} else {
tmp = pow(b, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 4.2d-12) then
tmp = ((a * a) * 4.0d0) + (-1.0d0)
else if (b <= 52000000.0d0) then
tmp = (a ** 4.0d0) * (1.0d0 - (4.0d0 / a))
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 4.2e-12) {
tmp = ((a * a) * 4.0) + -1.0;
} else if (b <= 52000000.0) {
tmp = Math.pow(a, 4.0) * (1.0 - (4.0 / a));
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 4.2e-12: tmp = ((a * a) * 4.0) + -1.0 elif b <= 52000000.0: tmp = math.pow(a, 4.0) * (1.0 - (4.0 / a)) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 4.2e-12) tmp = Float64(Float64(Float64(a * a) * 4.0) + -1.0); elseif (b <= 52000000.0) tmp = Float64((a ^ 4.0) * Float64(1.0 - Float64(4.0 / a))); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 4.2e-12) tmp = ((a * a) * 4.0) + -1.0; elseif (b <= 52000000.0) tmp = (a ^ 4.0) * (1.0 - (4.0 / a)); else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 4.2e-12], N[(N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[b, 52000000.0], N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 - N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-12}:\\
\;\;\;\;\left(a \cdot a\right) \cdot 4 + -1\\
\mathbf{elif}\;b \leq 52000000:\\
\;\;\;\;{a}^{4} \cdot \left(1 - \frac{4}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 4.19999999999999988e-12Initial program 82.8%
associate--l+82.8%
fma-define82.8%
distribute-rgt-in82.8%
sqr-neg82.8%
distribute-rgt-in82.8%
Simplified82.8%
Taylor expanded in b around 0 64.7%
Taylor expanded in a around 0 53.4%
*-commutative53.4%
Simplified53.4%
pow253.4%
Applied egg-rr53.4%
if 4.19999999999999988e-12 < b < 5.2e7Initial program 39.4%
associate--l+39.4%
fma-define39.4%
distribute-rgt-in39.4%
sqr-neg39.4%
distribute-rgt-in39.4%
Simplified39.4%
Taylor expanded in a around inf 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if 5.2e7 < b Initial program 61.4%
associate--l+61.4%
fma-define61.4%
distribute-rgt-in61.4%
sqr-neg61.4%
distribute-rgt-in61.4%
Simplified67.2%
Taylor expanded in a around 0 92.6%
Taylor expanded in b around inf 92.6%
Final simplification62.3%
(FPCore (a b) :precision binary64 (if (<= b 6e-10) (+ (* (* a a) 4.0) -1.0) (if (<= b 11600000.0) (* (pow a 3.0) (- a 4.0)) (pow b 4.0))))
double code(double a, double b) {
double tmp;
if (b <= 6e-10) {
tmp = ((a * a) * 4.0) + -1.0;
} else if (b <= 11600000.0) {
tmp = pow(a, 3.0) * (a - 4.0);
} else {
tmp = pow(b, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 6d-10) then
tmp = ((a * a) * 4.0d0) + (-1.0d0)
else if (b <= 11600000.0d0) then
tmp = (a ** 3.0d0) * (a - 4.0d0)
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 6e-10) {
tmp = ((a * a) * 4.0) + -1.0;
} else if (b <= 11600000.0) {
tmp = Math.pow(a, 3.0) * (a - 4.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 6e-10: tmp = ((a * a) * 4.0) + -1.0 elif b <= 11600000.0: tmp = math.pow(a, 3.0) * (a - 4.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 6e-10) tmp = Float64(Float64(Float64(a * a) * 4.0) + -1.0); elseif (b <= 11600000.0) tmp = Float64((a ^ 3.0) * Float64(a - 4.0)); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 6e-10) tmp = ((a * a) * 4.0) + -1.0; elseif (b <= 11600000.0) tmp = (a ^ 3.0) * (a - 4.0); else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 6e-10], N[(N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[b, 11600000.0], N[(N[Power[a, 3.0], $MachinePrecision] * N[(a - 4.0), $MachinePrecision]), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6 \cdot 10^{-10}:\\
\;\;\;\;\left(a \cdot a\right) \cdot 4 + -1\\
\mathbf{elif}\;b \leq 11600000:\\
\;\;\;\;{a}^{3} \cdot \left(a - 4\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 6e-10Initial program 82.8%
associate--l+82.8%
fma-define82.8%
distribute-rgt-in82.8%
sqr-neg82.8%
distribute-rgt-in82.8%
Simplified82.8%
Taylor expanded in b around 0 64.7%
Taylor expanded in a around 0 53.4%
*-commutative53.4%
Simplified53.4%
pow253.4%
Applied egg-rr53.4%
if 6e-10 < b < 1.16e7Initial program 39.4%
associate--l+39.4%
fma-define39.4%
distribute-rgt-in39.4%
sqr-neg39.4%
distribute-rgt-in39.4%
Simplified39.4%
Taylor expanded in a around inf 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around 0 99.7%
if 1.16e7 < b Initial program 61.4%
associate--l+61.4%
fma-define61.4%
distribute-rgt-in61.4%
sqr-neg61.4%
distribute-rgt-in61.4%
Simplified67.2%
Taylor expanded in a around 0 92.6%
Taylor expanded in b around inf 92.6%
Final simplification62.3%
(FPCore (a b) :precision binary64 (if (<= b 6.2e-10) (+ (* (* a a) 4.0) -1.0) (if (<= b 12200000.0) (* a (pow a 3.0)) (pow b 4.0))))
double code(double a, double b) {
double tmp;
if (b <= 6.2e-10) {
tmp = ((a * a) * 4.0) + -1.0;
} else if (b <= 12200000.0) {
tmp = a * pow(a, 3.0);
} else {
tmp = pow(b, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 6.2d-10) then
tmp = ((a * a) * 4.0d0) + (-1.0d0)
else if (b <= 12200000.0d0) then
tmp = a * (a ** 3.0d0)
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 6.2e-10) {
tmp = ((a * a) * 4.0) + -1.0;
} else if (b <= 12200000.0) {
tmp = a * Math.pow(a, 3.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 6.2e-10: tmp = ((a * a) * 4.0) + -1.0 elif b <= 12200000.0: tmp = a * math.pow(a, 3.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 6.2e-10) tmp = Float64(Float64(Float64(a * a) * 4.0) + -1.0); elseif (b <= 12200000.0) tmp = Float64(a * (a ^ 3.0)); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 6.2e-10) tmp = ((a * a) * 4.0) + -1.0; elseif (b <= 12200000.0) tmp = a * (a ^ 3.0); else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 6.2e-10], N[(N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[b, 12200000.0], N[(a * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6.2 \cdot 10^{-10}:\\
\;\;\;\;\left(a \cdot a\right) \cdot 4 + -1\\
\mathbf{elif}\;b \leq 12200000:\\
\;\;\;\;a \cdot {a}^{3}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 6.2000000000000003e-10Initial program 82.8%
associate--l+82.8%
fma-define82.8%
distribute-rgt-in82.8%
sqr-neg82.8%
distribute-rgt-in82.8%
Simplified82.8%
Taylor expanded in b around 0 64.7%
Taylor expanded in a around 0 53.4%
*-commutative53.4%
Simplified53.4%
pow253.4%
Applied egg-rr53.4%
if 6.2000000000000003e-10 < b < 1.22e7Initial program 39.4%
associate--l+39.4%
fma-define39.4%
distribute-rgt-in39.4%
sqr-neg39.4%
distribute-rgt-in39.4%
Simplified39.4%
Taylor expanded in a around inf 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around 0 99.7%
Taylor expanded in a around inf 93.1%
if 1.22e7 < b Initial program 61.4%
associate--l+61.4%
fma-define61.4%
distribute-rgt-in61.4%
sqr-neg61.4%
distribute-rgt-in61.4%
Simplified67.2%
Taylor expanded in a around 0 92.6%
Taylor expanded in b around inf 92.6%
Final simplification62.1%
(FPCore (a b) :precision binary64 (if (or (<= a -1850000.0) (not (<= a 72000.0))) (pow a 4.0) (+ (* (* b b) 12.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -1850000.0) || !(a <= 72000.0)) {
tmp = pow(a, 4.0);
} else {
tmp = ((b * b) * 12.0) + -1.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-1850000.0d0)) .or. (.not. (a <= 72000.0d0))) then
tmp = a ** 4.0d0
else
tmp = ((b * b) * 12.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -1850000.0) || !(a <= 72000.0)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = ((b * b) * 12.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -1850000.0) or not (a <= 72000.0): tmp = math.pow(a, 4.0) else: tmp = ((b * b) * 12.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -1850000.0) || !(a <= 72000.0)) tmp = a ^ 4.0; else tmp = Float64(Float64(Float64(b * b) * 12.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -1850000.0) || ~((a <= 72000.0))) tmp = a ^ 4.0; else tmp = ((b * b) * 12.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -1850000.0], N[Not[LessEqual[a, 72000.0]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1850000 \lor \neg \left(a \leq 72000\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 12 + -1\\
\end{array}
\end{array}
if a < -1.85e6 or 72000 < a Initial program 51.6%
associate--l+51.6%
fma-define51.6%
distribute-rgt-in51.6%
sqr-neg51.6%
distribute-rgt-in51.6%
Simplified54.1%
Taylor expanded in a around inf 90.6%
associate-*r/90.6%
metadata-eval90.6%
Simplified90.6%
Taylor expanded in a around inf 89.3%
if -1.85e6 < a < 72000Initial program 99.2%
associate--l+99.2%
fma-define99.2%
distribute-rgt-in99.2%
sqr-neg99.2%
distribute-rgt-in99.2%
Simplified99.2%
Taylor expanded in a around 0 98.8%
Taylor expanded in b around 0 75.0%
pow298.8%
Applied egg-rr75.0%
Final simplification81.5%
(FPCore (a b) :precision binary64 (if (<= b 6.5e-10) (+ (* (* a a) 4.0) -1.0) (if (<= b 7200000.0) (pow a 4.0) (pow b 4.0))))
double code(double a, double b) {
double tmp;
if (b <= 6.5e-10) {
tmp = ((a * a) * 4.0) + -1.0;
} else if (b <= 7200000.0) {
tmp = pow(a, 4.0);
} else {
tmp = pow(b, 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 6.5d-10) then
tmp = ((a * a) * 4.0d0) + (-1.0d0)
else if (b <= 7200000.0d0) then
tmp = a ** 4.0d0
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 6.5e-10) {
tmp = ((a * a) * 4.0) + -1.0;
} else if (b <= 7200000.0) {
tmp = Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 6.5e-10: tmp = ((a * a) * 4.0) + -1.0 elif b <= 7200000.0: tmp = math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 6.5e-10) tmp = Float64(Float64(Float64(a * a) * 4.0) + -1.0); elseif (b <= 7200000.0) tmp = a ^ 4.0; else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 6.5e-10) tmp = ((a * a) * 4.0) + -1.0; elseif (b <= 7200000.0) tmp = a ^ 4.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 6.5e-10], N[(N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[b, 7200000.0], N[Power[a, 4.0], $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6.5 \cdot 10^{-10}:\\
\;\;\;\;\left(a \cdot a\right) \cdot 4 + -1\\
\mathbf{elif}\;b \leq 7200000:\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 6.5000000000000003e-10Initial program 82.8%
associate--l+82.8%
fma-define82.8%
distribute-rgt-in82.8%
sqr-neg82.8%
distribute-rgt-in82.8%
Simplified82.8%
Taylor expanded in b around 0 64.7%
Taylor expanded in a around 0 53.4%
*-commutative53.4%
Simplified53.4%
pow253.4%
Applied egg-rr53.4%
if 6.5000000000000003e-10 < b < 7.2e6Initial program 39.4%
associate--l+39.4%
fma-define39.4%
distribute-rgt-in39.4%
sqr-neg39.4%
distribute-rgt-in39.4%
Simplified39.4%
Taylor expanded in a around inf 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around inf 93.1%
if 7.2e6 < b Initial program 61.4%
associate--l+61.4%
fma-define61.4%
distribute-rgt-in61.4%
sqr-neg61.4%
distribute-rgt-in61.4%
Simplified67.2%
Taylor expanded in a around 0 92.6%
Taylor expanded in b around inf 92.6%
Final simplification62.1%
(FPCore (a b) :precision binary64 (if (<= b 5.6e+144) (+ (* (* a a) 4.0) -1.0) (+ (* (* b b) 12.0) -1.0)))
double code(double a, double b) {
double tmp;
if (b <= 5.6e+144) {
tmp = ((a * a) * 4.0) + -1.0;
} else {
tmp = ((b * b) * 12.0) + -1.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 5.6d+144) then
tmp = ((a * a) * 4.0d0) + (-1.0d0)
else
tmp = ((b * b) * 12.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 5.6e+144) {
tmp = ((a * a) * 4.0) + -1.0;
} else {
tmp = ((b * b) * 12.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 5.6e+144: tmp = ((a * a) * 4.0) + -1.0 else: tmp = ((b * b) * 12.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (b <= 5.6e+144) tmp = Float64(Float64(Float64(a * a) * 4.0) + -1.0); else tmp = Float64(Float64(Float64(b * b) * 12.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 5.6e+144) tmp = ((a * a) * 4.0) + -1.0; else tmp = ((b * b) * 12.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 5.6e+144], N[(N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.6 \cdot 10^{+144}:\\
\;\;\;\;\left(a \cdot a\right) \cdot 4 + -1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 12 + -1\\
\end{array}
\end{array}
if b < 5.60000000000000013e144Initial program 81.3%
associate--l+81.3%
fma-define81.3%
distribute-rgt-in81.3%
sqr-neg81.3%
distribute-rgt-in81.3%
Simplified81.8%
Taylor expanded in b around 0 58.6%
Taylor expanded in a around 0 49.3%
*-commutative49.3%
Simplified49.3%
pow249.3%
Applied egg-rr49.3%
if 5.60000000000000013e144 < b Initial program 48.3%
associate--l+48.3%
fma-define48.3%
distribute-rgt-in48.3%
sqr-neg48.3%
distribute-rgt-in48.3%
Simplified55.2%
Taylor expanded in a around 0 100.0%
Taylor expanded in b around 0 88.1%
pow2100.0%
Applied egg-rr88.1%
Final simplification53.7%
(FPCore (a b) :precision binary64 (+ (* (* b b) 12.0) -1.0))
double code(double a, double b) {
return ((b * b) * 12.0) + -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((b * b) * 12.0d0) + (-1.0d0)
end function
public static double code(double a, double b) {
return ((b * b) * 12.0) + -1.0;
}
def code(a, b): return ((b * b) * 12.0) + -1.0
function code(a, b) return Float64(Float64(Float64(b * b) * 12.0) + -1.0) end
function tmp = code(a, b) tmp = ((b * b) * 12.0) + -1.0; end
code[a_, b_] := N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(b \cdot b\right) \cdot 12 + -1
\end{array}
Initial program 77.6%
associate--l+77.6%
fma-define77.6%
distribute-rgt-in77.6%
sqr-neg77.6%
distribute-rgt-in77.6%
Simplified78.8%
Taylor expanded in a around 0 71.7%
Taylor expanded in b around 0 53.6%
pow271.7%
Applied egg-rr53.6%
Final simplification53.6%
(FPCore (a b) :precision binary64 -1.0)
double code(double a, double b) {
return -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = -1.0d0
end function
public static double code(double a, double b) {
return -1.0;
}
def code(a, b): return -1.0
function code(a, b) return -1.0 end
function tmp = code(a, b) tmp = -1.0; end
code[a_, b_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 77.6%
associate--l+77.6%
fma-define77.6%
distribute-rgt-in77.6%
sqr-neg77.6%
distribute-rgt-in77.6%
Simplified78.8%
Taylor expanded in a around 0 71.7%
Taylor expanded in b around 0 26.9%
herbie shell --seed 2024166
(FPCore (a b)
:name "Bouland and Aaronson, Equation (24)"
:precision binary64
(- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 3.0 a))))) 1.0))