
(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 (<= a -2.7e-6)
(expm1
(log (fma 4.0 (* (pow a 2.0) (- 1.0 a)) (pow (pow (hypot a b) 2.0) 2.0))))
(+
(+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* a a) (* (* b b) (+ a 3.0)))))
-1.0)))
double code(double a, double b) {
double tmp;
if (a <= -2.7e-6) {
tmp = expm1(log(fma(4.0, (pow(a, 2.0) * (1.0 - a)), pow(pow(hypot(a, b), 2.0), 2.0))));
} else {
tmp = (pow(((a * a) + (b * b)), 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0;
}
return tmp;
}
function code(a, b) tmp = 0.0 if (a <= -2.7e-6) tmp = expm1(log(fma(4.0, Float64((a ^ 2.0) * Float64(1.0 - a)), ((hypot(a, b) ^ 2.0) ^ 2.0)))); else 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); end return tmp end
code[a_, b_] := If[LessEqual[a, -2.7e-6], N[(Exp[N[Log[N[(4.0 * N[(N[Power[a, 2.0], $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[Power[N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 2.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.7 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{expm1}\left(\log \left(\mathsf{fma}\left(4, {a}^{2} \cdot \left(1 - a\right), {\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\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\\
\end{array}
\end{array}
if a < -2.69999999999999998e-6Initial program 79.6%
associate--l+79.6%
fma-define79.6%
sqr-neg79.6%
fma-define79.6%
distribute-rgt-in79.6%
sqr-neg79.6%
distribute-rgt-in79.6%
fma-define79.6%
sqr-neg79.6%
Simplified79.6%
Applied egg-rr84.0%
Taylor expanded in b around 0 97.7%
if -2.69999999999999998e-6 < a Initial program 80.1%
Taylor expanded in a around 0 99.3%
Final simplification98.9%
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* b b) (+ a 3.0)) (* (- 1.0 a) (* a a)))))))
(if (<= t_0 INFINITY) (+ t_0 -1.0) (pow a 4.0))))
double code(double a, double b) {
double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((b * b) * (a + 3.0)) + ((1.0 - a) * (a * a))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 + -1.0;
} else {
tmp = pow(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 * (((b * b) * (a + 3.0)) + ((1.0 - a) * (a * a))));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 + -1.0;
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): t_0 = math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((b * b) * (a + 3.0)) + ((1.0 - a) * (a * a)))) tmp = 0 if t_0 <= math.inf: tmp = t_0 + -1.0 else: tmp = math.pow(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(b * b) * Float64(a + 3.0)) + Float64(Float64(1.0 - a) * Float64(a * a))))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 + -1.0); else tmp = a ^ 4.0; end return tmp end
function tmp_2 = code(a, b) t_0 = (((a * a) + (b * b)) ^ 2.0) + (4.0 * (((b * b) * (a + 3.0)) + ((1.0 - a) * (a * a)))); tmp = 0.0; if (t_0 <= Inf) tmp = t_0 + -1.0; else tmp = 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[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 + -1.0), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(a + 3\right) + \left(1 - a\right) \cdot \left(a \cdot a\right)\right)\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\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.9%
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%
sqr-neg0.0%
fma-define0.0%
distribute-rgt-in0.0%
sqr-neg0.0%
distribute-rgt-in0.0%
fma-define0.0%
sqr-neg0.0%
Simplified7.8%
Taylor expanded in a around inf 94.5%
associate-*r/94.5%
metadata-eval94.5%
Simplified94.5%
Taylor expanded in a around inf 94.5%
Taylor expanded in a around 0 94.5%
Final simplification98.8%
(FPCore (a b)
:precision binary64
(if (<= (* b b) 5e+140)
(+
(+ (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) <= 5e+140) {
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) <= 5d+140) 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) <= 5e+140) {
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) <= 5e+140: 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) <= 5e+140) 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) <= 5e+140) 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], 5e+140], 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 5 \cdot 10^{+140}:\\
\;\;\;\;\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) < 5.00000000000000008e140Initial program 85.3%
Taylor expanded in a around 0 97.5%
if 5.00000000000000008e140 < (*.f64 b b) Initial program 69.0%
associate--l+69.0%
fma-define69.0%
sqr-neg69.0%
fma-define69.0%
distribute-rgt-in69.0%
sqr-neg69.0%
distribute-rgt-in69.0%
fma-define69.0%
sqr-neg69.0%
Simplified73.8%
Applied egg-rr72.4%
Taylor expanded in b around inf 100.0%
Final simplification98.3%
(FPCore (a b) :precision binary64 (if (<= (* b b) 5e+140) (+ (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* a a) (* a (* b b))))) -1.0) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 5e+140) {
tmp = (pow(((a * a) + (b * b)), 2.0) + (4.0 * ((a * a) + (a * (b * b))))) + -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) <= 5d+140) then
tmp = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * ((a * a) + (a * (b * b))))) + (-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) <= 5e+140) {
tmp = (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * ((a * a) + (a * (b * b))))) + -1.0;
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 5e+140: tmp = (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * ((a * a) + (a * (b * b))))) + -1.0 else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 5e+140) tmp = Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(a * a) + Float64(a * Float64(b * b))))) + -1.0); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 5e+140) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * ((a * a) + (a * (b * b))))) + -1.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 5e+140], 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[(a * N[(b * b), $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 5 \cdot 10^{+140}:\\
\;\;\;\;\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(a \cdot a + a \cdot \left(b \cdot b\right)\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 5.00000000000000008e140Initial program 85.3%
Taylor expanded in a around 0 97.5%
Taylor expanded in a around inf 97.2%
if 5.00000000000000008e140 < (*.f64 b b) Initial program 69.0%
associate--l+69.0%
fma-define69.0%
sqr-neg69.0%
fma-define69.0%
distribute-rgt-in69.0%
sqr-neg69.0%
distribute-rgt-in69.0%
fma-define69.0%
sqr-neg69.0%
Simplified73.8%
Applied egg-rr72.4%
Taylor expanded in b around inf 100.0%
Final simplification98.1%
(FPCore (a b)
:precision binary64
(if (<= a -135000000.0)
(* (pow a 4.0) (- 1.0 (/ 4.0 a)))
(if (<= a 76000000.0)
(+ (+ (* 4.0 (+ (* a a) (* (* b b) (+ a 3.0)))) (pow b 4.0)) -1.0)
(+ (+ (pow a 4.0) (* 4.0 (+ (* a a) (* a (* b b))))) -1.0))))
double code(double a, double b) {
double tmp;
if (a <= -135000000.0) {
tmp = pow(a, 4.0) * (1.0 - (4.0 / a));
} else if (a <= 76000000.0) {
tmp = ((4.0 * ((a * a) + ((b * b) * (a + 3.0)))) + pow(b, 4.0)) + -1.0;
} else {
tmp = (pow(a, 4.0) + (4.0 * ((a * a) + (a * (b * b))))) + -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 <= (-135000000.0d0)) then
tmp = (a ** 4.0d0) * (1.0d0 - (4.0d0 / a))
else if (a <= 76000000.0d0) then
tmp = ((4.0d0 * ((a * a) + ((b * b) * (a + 3.0d0)))) + (b ** 4.0d0)) + (-1.0d0)
else
tmp = ((a ** 4.0d0) + (4.0d0 * ((a * a) + (a * (b * b))))) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -135000000.0) {
tmp = Math.pow(a, 4.0) * (1.0 - (4.0 / a));
} else if (a <= 76000000.0) {
tmp = ((4.0 * ((a * a) + ((b * b) * (a + 3.0)))) + Math.pow(b, 4.0)) + -1.0;
} else {
tmp = (Math.pow(a, 4.0) + (4.0 * ((a * a) + (a * (b * b))))) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -135000000.0: tmp = math.pow(a, 4.0) * (1.0 - (4.0 / a)) elif a <= 76000000.0: tmp = ((4.0 * ((a * a) + ((b * b) * (a + 3.0)))) + math.pow(b, 4.0)) + -1.0 else: tmp = (math.pow(a, 4.0) + (4.0 * ((a * a) + (a * (b * b))))) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (a <= -135000000.0) tmp = Float64((a ^ 4.0) * Float64(1.0 - Float64(4.0 / a))); elseif (a <= 76000000.0) tmp = Float64(Float64(Float64(4.0 * Float64(Float64(a * a) + Float64(Float64(b * b) * Float64(a + 3.0)))) + (b ^ 4.0)) + -1.0); else tmp = Float64(Float64((a ^ 4.0) + Float64(4.0 * Float64(Float64(a * a) + Float64(a * Float64(b * b))))) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -135000000.0) tmp = (a ^ 4.0) * (1.0 - (4.0 / a)); elseif (a <= 76000000.0) tmp = ((4.0 * ((a * a) + ((b * b) * (a + 3.0)))) + (b ^ 4.0)) + -1.0; else tmp = ((a ^ 4.0) + (4.0 * ((a * a) + (a * (b * b))))) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -135000000.0], N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 - N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 76000000.0], N[(N[(N[(4.0 * N[(N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[Power[a, 4.0], $MachinePrecision] + N[(4.0 * N[(N[(a * a), $MachinePrecision] + N[(a * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -135000000:\\
\;\;\;\;{a}^{4} \cdot \left(1 - \frac{4}{a}\right)\\
\mathbf{elif}\;a \leq 76000000:\\
\;\;\;\;\left(4 \cdot \left(a \cdot a + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) + {b}^{4}\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left({a}^{4} + 4 \cdot \left(a \cdot a + a \cdot \left(b \cdot b\right)\right)\right) + -1\\
\end{array}
\end{array}
if a < -1.35e8Initial program 77.5%
associate--l+77.5%
fma-define77.5%
sqr-neg77.5%
fma-define77.5%
distribute-rgt-in77.5%
sqr-neg77.5%
distribute-rgt-in77.5%
fma-define77.5%
sqr-neg77.5%
Simplified77.5%
Taylor expanded in a around inf 91.9%
associate-*r/91.9%
metadata-eval91.9%
Simplified91.9%
if -1.35e8 < a < 7.6e7Initial program 99.9%
Taylor expanded in a around 0 98.0%
Taylor expanded in a around 0 97.6%
if 7.6e7 < a Initial program 33.3%
Taylor expanded in a around 0 99.5%
Taylor expanded in a around inf 97.9%
Taylor expanded in a around inf 97.9%
Final simplification96.4%
(FPCore (a b)
:precision binary64
(if (<= a -31000000000.0)
(* (pow a 4.0) (- 1.0 (/ 4.0 a)))
(if (<= a 3300000000.0)
(+ (+ (pow b 4.0) (* (* b b) 12.0)) -1.0)
(+ (+ (pow a 4.0) (* 4.0 (+ (* a a) (* a (* b b))))) -1.0))))
double code(double a, double b) {
double tmp;
if (a <= -31000000000.0) {
tmp = pow(a, 4.0) * (1.0 - (4.0 / a));
} else if (a <= 3300000000.0) {
tmp = (pow(b, 4.0) + ((b * b) * 12.0)) + -1.0;
} else {
tmp = (pow(a, 4.0) + (4.0 * ((a * a) + (a * (b * b))))) + -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 <= (-31000000000.0d0)) then
tmp = (a ** 4.0d0) * (1.0d0 - (4.0d0 / a))
else if (a <= 3300000000.0d0) then
tmp = ((b ** 4.0d0) + ((b * b) * 12.0d0)) + (-1.0d0)
else
tmp = ((a ** 4.0d0) + (4.0d0 * ((a * a) + (a * (b * b))))) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -31000000000.0) {
tmp = Math.pow(a, 4.0) * (1.0 - (4.0 / a));
} else if (a <= 3300000000.0) {
tmp = (Math.pow(b, 4.0) + ((b * b) * 12.0)) + -1.0;
} else {
tmp = (Math.pow(a, 4.0) + (4.0 * ((a * a) + (a * (b * b))))) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -31000000000.0: tmp = math.pow(a, 4.0) * (1.0 - (4.0 / a)) elif a <= 3300000000.0: tmp = (math.pow(b, 4.0) + ((b * b) * 12.0)) + -1.0 else: tmp = (math.pow(a, 4.0) + (4.0 * ((a * a) + (a * (b * b))))) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (a <= -31000000000.0) tmp = Float64((a ^ 4.0) * Float64(1.0 - Float64(4.0 / a))); elseif (a <= 3300000000.0) tmp = Float64(Float64((b ^ 4.0) + Float64(Float64(b * b) * 12.0)) + -1.0); else tmp = Float64(Float64((a ^ 4.0) + Float64(4.0 * Float64(Float64(a * a) + Float64(a * Float64(b * b))))) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -31000000000.0) tmp = (a ^ 4.0) * (1.0 - (4.0 / a)); elseif (a <= 3300000000.0) tmp = ((b ^ 4.0) + ((b * b) * 12.0)) + -1.0; else tmp = ((a ^ 4.0) + (4.0 * ((a * a) + (a * (b * b))))) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -31000000000.0], N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 - N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3300000000.0], N[(N[(N[Power[b, 4.0], $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[Power[a, 4.0], $MachinePrecision] + N[(4.0 * N[(N[(a * a), $MachinePrecision] + N[(a * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -31000000000:\\
\;\;\;\;{a}^{4} \cdot \left(1 - \frac{4}{a}\right)\\
\mathbf{elif}\;a \leq 3300000000:\\
\;\;\;\;\left({b}^{4} + \left(b \cdot b\right) \cdot 12\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left({a}^{4} + 4 \cdot \left(a \cdot a + a \cdot \left(b \cdot b\right)\right)\right) + -1\\
\end{array}
\end{array}
if a < -3.1e10Initial program 77.5%
associate--l+77.5%
fma-define77.5%
sqr-neg77.5%
fma-define77.5%
distribute-rgt-in77.5%
sqr-neg77.5%
distribute-rgt-in77.5%
fma-define77.5%
sqr-neg77.5%
Simplified77.5%
Taylor expanded in a around inf 91.9%
associate-*r/91.9%
metadata-eval91.9%
Simplified91.9%
if -3.1e10 < a < 3.3e9Initial program 99.9%
associate--l+99.9%
fma-define99.9%
sqr-neg99.9%
fma-define99.9%
distribute-rgt-in99.9%
sqr-neg99.9%
distribute-rgt-in99.9%
fma-define99.9%
sqr-neg99.9%
Simplified99.9%
Taylor expanded in a around 0 97.0%
pow297.0%
Applied egg-rr97.0%
if 3.3e9 < a Initial program 33.3%
Taylor expanded in a around 0 99.5%
Taylor expanded in a around inf 97.9%
Taylor expanded in a around inf 97.9%
Final simplification96.0%
(FPCore (a b) :precision binary64 (if (or (<= a -140000000.0) (not (<= a 32000000.0))) (* (pow a 4.0) (- 1.0 (/ 4.0 a))) (+ (+ (pow b 4.0) (* (* b b) 12.0)) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -140000000.0) || !(a <= 32000000.0)) {
tmp = pow(a, 4.0) * (1.0 - (4.0 / a));
} 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 ((a <= (-140000000.0d0)) .or. (.not. (a <= 32000000.0d0))) then
tmp = (a ** 4.0d0) * (1.0d0 - (4.0d0 / a))
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 ((a <= -140000000.0) || !(a <= 32000000.0)) {
tmp = Math.pow(a, 4.0) * (1.0 - (4.0 / a));
} else {
tmp = (Math.pow(b, 4.0) + ((b * b) * 12.0)) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -140000000.0) or not (a <= 32000000.0): tmp = math.pow(a, 4.0) * (1.0 - (4.0 / a)) else: tmp = (math.pow(b, 4.0) + ((b * b) * 12.0)) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -140000000.0) || !(a <= 32000000.0)) tmp = Float64((a ^ 4.0) * Float64(1.0 - Float64(4.0 / a))); 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 ((a <= -140000000.0) || ~((a <= 32000000.0))) tmp = (a ^ 4.0) * (1.0 - (4.0 / a)); else tmp = ((b ^ 4.0) + ((b * b) * 12.0)) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -140000000.0], N[Not[LessEqual[a, 32000000.0]], $MachinePrecision]], N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 - N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $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}\;a \leq -140000000 \lor \neg \left(a \leq 32000000\right):\\
\;\;\;\;{a}^{4} \cdot \left(1 - \frac{4}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\left({b}^{4} + \left(b \cdot b\right) \cdot 12\right) + -1\\
\end{array}
\end{array}
if a < -1.4e8 or 3.2e7 < a Initial program 55.5%
associate--l+55.5%
fma-define55.5%
sqr-neg55.5%
fma-define55.5%
distribute-rgt-in55.5%
sqr-neg55.5%
distribute-rgt-in55.5%
fma-define55.5%
sqr-neg55.5%
Simplified59.0%
Taylor expanded in a around inf 93.5%
associate-*r/93.5%
metadata-eval93.5%
Simplified93.5%
if -1.4e8 < a < 3.2e7Initial program 99.9%
associate--l+99.9%
fma-define99.9%
sqr-neg99.9%
fma-define99.9%
distribute-rgt-in99.9%
sqr-neg99.9%
distribute-rgt-in99.9%
fma-define99.9%
sqr-neg99.9%
Simplified99.9%
Taylor expanded in a around 0 97.0%
pow297.0%
Applied egg-rr97.0%
Final simplification95.4%
(FPCore (a b) :precision binary64 (if (or (<= a -245000000.0) (not (<= a 65000000.0))) (* (pow a 4.0) (- 1.0 (/ 4.0 a))) (+ (pow b 4.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -245000000.0) || !(a <= 65000000.0)) {
tmp = pow(a, 4.0) * (1.0 - (4.0 / a));
} else {
tmp = pow(b, 4.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 <= (-245000000.0d0)) .or. (.not. (a <= 65000000.0d0))) then
tmp = (a ** 4.0d0) * (1.0d0 - (4.0d0 / a))
else
tmp = (b ** 4.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -245000000.0) || !(a <= 65000000.0)) {
tmp = Math.pow(a, 4.0) * (1.0 - (4.0 / a));
} else {
tmp = Math.pow(b, 4.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -245000000.0) or not (a <= 65000000.0): tmp = math.pow(a, 4.0) * (1.0 - (4.0 / a)) else: tmp = math.pow(b, 4.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -245000000.0) || !(a <= 65000000.0)) tmp = Float64((a ^ 4.0) * Float64(1.0 - Float64(4.0 / a))); else tmp = Float64((b ^ 4.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -245000000.0) || ~((a <= 65000000.0))) tmp = (a ^ 4.0) * (1.0 - (4.0 / a)); else tmp = (b ^ 4.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -245000000.0], N[Not[LessEqual[a, 65000000.0]], $MachinePrecision]], N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 - N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -245000000 \lor \neg \left(a \leq 65000000\right):\\
\;\;\;\;{a}^{4} \cdot \left(1 - \frac{4}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} + -1\\
\end{array}
\end{array}
if a < -2.45e8 or 6.5e7 < a Initial program 55.5%
associate--l+55.5%
fma-define55.5%
sqr-neg55.5%
fma-define55.5%
distribute-rgt-in55.5%
sqr-neg55.5%
distribute-rgt-in55.5%
fma-define55.5%
sqr-neg55.5%
Simplified59.0%
Taylor expanded in a around inf 93.5%
associate-*r/93.5%
metadata-eval93.5%
Simplified93.5%
if -2.45e8 < a < 6.5e7Initial program 99.9%
Taylor expanded in a around 0 98.0%
Taylor expanded in a around inf 87.8%
Taylor expanded in a around 0 96.7%
Final simplification95.2%
(FPCore (a b) :precision binary64 (if (<= a -1.02e+14) (pow a 4.0) (if (<= a 105000000.0) (+ (pow b 4.0) -1.0) (* (pow a 3.0) (- a 4.0)))))
double code(double a, double b) {
double tmp;
if (a <= -1.02e+14) {
tmp = pow(a, 4.0);
} else if (a <= 105000000.0) {
tmp = pow(b, 4.0) + -1.0;
} else {
tmp = pow(a, 3.0) * (a - 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-1.02d+14)) then
tmp = a ** 4.0d0
else if (a <= 105000000.0d0) then
tmp = (b ** 4.0d0) + (-1.0d0)
else
tmp = (a ** 3.0d0) * (a - 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -1.02e+14) {
tmp = Math.pow(a, 4.0);
} else if (a <= 105000000.0) {
tmp = Math.pow(b, 4.0) + -1.0;
} else {
tmp = Math.pow(a, 3.0) * (a - 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -1.02e+14: tmp = math.pow(a, 4.0) elif a <= 105000000.0: tmp = math.pow(b, 4.0) + -1.0 else: tmp = math.pow(a, 3.0) * (a - 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -1.02e+14) tmp = a ^ 4.0; elseif (a <= 105000000.0) tmp = Float64((b ^ 4.0) + -1.0); else tmp = Float64((a ^ 3.0) * Float64(a - 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -1.02e+14) tmp = a ^ 4.0; elseif (a <= 105000000.0) tmp = (b ^ 4.0) + -1.0; else tmp = (a ^ 3.0) * (a - 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -1.02e+14], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 105000000.0], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[a, 3.0], $MachinePrecision] * N[(a - 4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.02 \cdot 10^{+14}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 105000000:\\
\;\;\;\;{b}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{3} \cdot \left(a - 4\right)\\
\end{array}
\end{array}
if a < -1.02e14Initial program 78.5%
associate--l+78.5%
fma-define78.5%
sqr-neg78.5%
fma-define78.5%
distribute-rgt-in78.5%
sqr-neg78.5%
distribute-rgt-in78.5%
fma-define78.5%
sqr-neg78.5%
Simplified78.5%
Taylor expanded in a around inf 93.3%
associate-*r/93.3%
metadata-eval93.3%
Simplified93.3%
Taylor expanded in a around inf 93.3%
Taylor expanded in a around 0 93.3%
if -1.02e14 < a < 1.05e8Initial program 99.2%
Taylor expanded in a around 0 97.2%
Taylor expanded in a around inf 87.1%
Taylor expanded in a around 0 96.0%
if 1.05e8 < a Initial program 33.3%
associate--l+33.3%
fma-define33.3%
sqr-neg33.3%
fma-define33.3%
distribute-rgt-in33.3%
sqr-neg33.3%
distribute-rgt-in33.3%
fma-define33.3%
sqr-neg33.3%
Simplified40.3%
Taylor expanded in a around inf 95.1%
associate-*r/95.1%
metadata-eval95.1%
Simplified95.1%
Taylor expanded in a around 0 95.1%
Final simplification95.2%
(FPCore (a b) :precision binary64 (if (or (<= a -5.6e+14) (not (<= a 280000000.0))) (pow a 4.0) (+ (pow b 4.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -5.6e+14) || !(a <= 280000000.0)) {
tmp = pow(a, 4.0);
} else {
tmp = pow(b, 4.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 <= (-5.6d+14)) .or. (.not. (a <= 280000000.0d0))) then
tmp = a ** 4.0d0
else
tmp = (b ** 4.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -5.6e+14) || !(a <= 280000000.0)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -5.6e+14) or not (a <= 280000000.0): tmp = math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -5.6e+14) || !(a <= 280000000.0)) tmp = a ^ 4.0; else tmp = Float64((b ^ 4.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -5.6e+14) || ~((a <= 280000000.0))) tmp = a ^ 4.0; else tmp = (b ^ 4.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -5.6e+14], N[Not[LessEqual[a, 280000000.0]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.6 \cdot 10^{+14} \lor \neg \left(a \leq 280000000\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} + -1\\
\end{array}
\end{array}
if a < -5.6e14 or 2.8e8 < a Initial program 55.7%
associate--l+55.7%
fma-define55.7%
sqr-neg55.7%
fma-define55.7%
distribute-rgt-in55.7%
sqr-neg55.7%
distribute-rgt-in55.7%
fma-define55.7%
sqr-neg55.7%
Simplified59.2%
Taylor expanded in a around inf 94.2%
associate-*r/94.2%
metadata-eval94.2%
Simplified94.2%
Taylor expanded in a around inf 94.0%
Taylor expanded in a around 0 94.0%
if -5.6e14 < a < 2.8e8Initial program 99.2%
Taylor expanded in a around 0 97.2%
Taylor expanded in a around inf 87.1%
Taylor expanded in a around 0 96.0%
Final simplification95.1%
(FPCore (a b) :precision binary64 (if (or (<= a -2.2) (not (<= a 32000000.0))) (pow a 4.0) (+ (* (* b b) 12.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -2.2) || !(a <= 32000000.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 <= (-2.2d0)) .or. (.not. (a <= 32000000.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 <= -2.2) || !(a <= 32000000.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 <= -2.2) or not (a <= 32000000.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 <= -2.2) || !(a <= 32000000.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 <= -2.2) || ~((a <= 32000000.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, -2.2], N[Not[LessEqual[a, 32000000.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 -2.2 \lor \neg \left(a \leq 32000000\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 12 + -1\\
\end{array}
\end{array}
if a < -2.2000000000000002 or 3.2e7 < a Initial program 57.0%
associate--l+57.0%
fma-define57.0%
sqr-neg57.0%
fma-define57.0%
distribute-rgt-in57.0%
sqr-neg57.0%
distribute-rgt-in57.0%
fma-define57.0%
sqr-neg57.0%
Simplified60.4%
Taylor expanded in a around inf 91.3%
associate-*r/91.3%
metadata-eval91.3%
Simplified91.3%
Taylor expanded in a around inf 90.6%
Taylor expanded in a around 0 90.6%
if -2.2000000000000002 < a < 3.2e7Initial program 99.9%
associate--l+99.9%
fma-define99.9%
sqr-neg99.9%
fma-define99.9%
distribute-rgt-in99.9%
sqr-neg99.9%
distribute-rgt-in99.9%
fma-define99.9%
sqr-neg99.9%
Simplified99.9%
Taylor expanded in a around 0 98.7%
Taylor expanded in b around 0 76.9%
*-commutative76.9%
Simplified76.9%
pow298.7%
Applied egg-rr76.9%
Final simplification83.3%
(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 80.0%
associate--l+80.0%
fma-define80.0%
sqr-neg80.0%
fma-define80.0%
distribute-rgt-in80.0%
sqr-neg80.0%
distribute-rgt-in80.0%
fma-define80.0%
sqr-neg80.0%
Simplified81.5%
Taylor expanded in a around 0 68.0%
Taylor expanded in b around 0 51.7%
*-commutative51.7%
Simplified51.7%
pow268.0%
Applied egg-rr51.7%
Final simplification51.7%
(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 80.0%
associate--l+80.0%
fma-define80.0%
sqr-neg80.0%
fma-define80.0%
distribute-rgt-in80.0%
sqr-neg80.0%
distribute-rgt-in80.0%
fma-define80.0%
sqr-neg80.0%
Simplified81.5%
Taylor expanded in a around 0 68.0%
Taylor expanded in b around 0 28.6%
herbie shell --seed 2024129
(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))