
(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 12 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
(let* ((t_0 (pow (hypot a b) 2.0)))
(if (<= a -2.45e-5)
(+ (fma t_0 t_0 (* 4.0 (* (pow a 2.0) (- 1.0 a)))) -1.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 t_0 = pow(hypot(a, b), 2.0);
double tmp;
if (a <= -2.45e-5) {
tmp = fma(t_0, t_0, (4.0 * (pow(a, 2.0) * (1.0 - a)))) + -1.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) t_0 = hypot(a, b) ^ 2.0 tmp = 0.0 if (a <= -2.45e-5) tmp = Float64(fma(t_0, t_0, Float64(4.0 * Float64((a ^ 2.0) * Float64(1.0 - a)))) + -1.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_] := Block[{t$95$0 = N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[a, -2.45e-5], N[(N[(t$95$0 * t$95$0 + N[(4.0 * N[(N[Power[a, 2.0], $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $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}
t_0 := {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\\
\mathbf{if}\;a \leq -2.45 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0, 4 \cdot \left({a}^{2} \cdot \left(1 - a\right)\right)\right) + -1\\
\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.45e-5Initial program 65.4%
unpow265.4%
+-commutative65.4%
associate-*r*65.4%
fma-undefine65.4%
fma-define65.4%
fma-define65.4%
add-sqr-sqrt65.4%
pow265.4%
fma-define65.4%
hypot-define65.4%
fma-define65.4%
add-sqr-sqrt65.4%
pow265.4%
fma-define65.4%
hypot-define65.4%
Applied egg-rr77.5%
Taylor expanded in b around 0 99.9%
if -2.45e-5 < a Initial program 76.6%
Taylor expanded in a around 0 99.2%
Final simplification99.3%
(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 b 4.0) (* 4.0 (+ (* a a) (* (* b b) 3.0)))) -1.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(b, 4.0) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.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(b, 4.0) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.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(b, 4.0) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.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 = Float64(Float64((b ^ 4.0) + Float64(4.0 * Float64(Float64(a * a) + Float64(Float64(b * b) * 3.0)))) + -1.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 = ((b ^ 4.0) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.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[(N[(N[Power[b, 4.0], $MachinePrecision] + N[(4.0 * N[(N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.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}:\\
\;\;\;\;\left({b}^{4} + 4 \cdot \left(a \cdot a + \left(b \cdot b\right) \cdot 3\right)\right) + -1\\
\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%
Taylor expanded in a around 0 69.7%
Taylor expanded in a around 0 66.9%
Taylor expanded in a around 0 97.2%
Final simplification99.2%
(FPCore (a b)
:precision binary64
(if (<= (* b b) 2e+79)
(+
(+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* a a) (* (* b b) (+ a 3.0)))))
-1.0)
(+ (+ (pow b 4.0) (* 4.0 (+ (* a a) (* (* b b) 3.0)))) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+79) {
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) + (4.0 * ((a * a) + ((b * b) * 3.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) <= 2d+79) then
tmp = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * ((a * a) + ((b * b) * (a + 3.0d0))))) + (-1.0d0)
else
tmp = ((b ** 4.0d0) + (4.0d0 * ((a * a) + ((b * b) * 3.0d0)))) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+79) {
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) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e+79: 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) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+79) 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 = Float64(Float64((b ^ 4.0) + Float64(4.0 * Float64(Float64(a * a) + Float64(Float64(b * b) * 3.0)))) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e+79) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * ((a * a) + ((b * b) * (a + 3.0))))) + -1.0; else tmp = ((b ^ 4.0) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+79], 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[(N[(N[Power[b, 4.0], $MachinePrecision] + N[(4.0 * N[(N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+79}:\\
\;\;\;\;\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}:\\
\;\;\;\;\left({b}^{4} + 4 \cdot \left(a \cdot a + \left(b \cdot b\right) \cdot 3\right)\right) + -1\\
\end{array}
\end{array}
if (*.f64 b b) < 1.99999999999999993e79Initial program 81.5%
Taylor expanded in a around 0 96.7%
if 1.99999999999999993e79 < (*.f64 b b) Initial program 64.9%
Taylor expanded in a around 0 84.2%
Taylor expanded in a around 0 84.2%
Taylor expanded in a around 0 100.0%
Final simplification98.2%
(FPCore (a b) :precision binary64 (if (or (<= a -9.8e+48) (not (<= a 1.75e+27))) (pow a 4.0) (+ (+ (pow b 4.0) (* 4.0 (+ (* a a) (* (* b b) 3.0)))) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -9.8e+48) || !(a <= 1.75e+27)) {
tmp = pow(a, 4.0);
} else {
tmp = (pow(b, 4.0) + (4.0 * ((a * a) + ((b * b) * 3.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 <= (-9.8d+48)) .or. (.not. (a <= 1.75d+27))) then
tmp = a ** 4.0d0
else
tmp = ((b ** 4.0d0) + (4.0d0 * ((a * a) + ((b * b) * 3.0d0)))) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -9.8e+48) || !(a <= 1.75e+27)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = (Math.pow(b, 4.0) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -9.8e+48) or not (a <= 1.75e+27): tmp = math.pow(a, 4.0) else: tmp = (math.pow(b, 4.0) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -9.8e+48) || !(a <= 1.75e+27)) tmp = a ^ 4.0; else tmp = Float64(Float64((b ^ 4.0) + Float64(4.0 * Float64(Float64(a * a) + Float64(Float64(b * b) * 3.0)))) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -9.8e+48) || ~((a <= 1.75e+27))) tmp = a ^ 4.0; else tmp = ((b ^ 4.0) + (4.0 * ((a * a) + ((b * b) * 3.0)))) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -9.8e+48], N[Not[LessEqual[a, 1.75e+27]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(N[(N[Power[b, 4.0], $MachinePrecision] + N[(4.0 * N[(N[(a * a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.8 \cdot 10^{+48} \lor \neg \left(a \leq 1.75 \cdot 10^{+27}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;\left({b}^{4} + 4 \cdot \left(a \cdot a + \left(b \cdot b\right) \cdot 3\right)\right) + -1\\
\end{array}
\end{array}
if a < -9.80000000000000059e48 or 1.7500000000000001e27 < a Initial program 41.5%
unpow241.5%
+-commutative41.5%
associate-*r*41.5%
fma-undefine45.2%
fma-define45.2%
fma-define45.2%
add-sqr-sqrt45.2%
pow245.2%
fma-define45.2%
hypot-define45.2%
fma-define45.2%
add-sqr-sqrt45.2%
pow245.2%
fma-define45.2%
hypot-define45.2%
Applied egg-rr48.1%
Taylor expanded in b around 0 56.6%
Taylor expanded in a around inf 99.1%
if -9.80000000000000059e48 < a < 1.7500000000000001e27Initial program 97.1%
Taylor expanded in a around 0 95.5%
Taylor expanded in a around 0 93.1%
Taylor expanded in a around 0 95.8%
Final simplification97.2%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* (pow a 4.0) (- 1.0 (/ 4.0 a)))))
(if (<= b 1.85e-212)
t_0
(if (<= b 6.8e-5)
(+ (* 4.0 (* (- 1.0 a) (* a a))) -1.0)
(if (<= b 1.35e+35) t_0 (pow b 4.0))))))
double code(double a, double b) {
double t_0 = pow(a, 4.0) * (1.0 - (4.0 / a));
double tmp;
if (b <= 1.85e-212) {
tmp = t_0;
} else if (b <= 6.8e-5) {
tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0;
} else if (b <= 1.35e+35) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = (a ** 4.0d0) * (1.0d0 - (4.0d0 / a))
if (b <= 1.85d-212) then
tmp = t_0
else if (b <= 6.8d-5) then
tmp = (4.0d0 * ((1.0d0 - a) * (a * a))) + (-1.0d0)
else if (b <= 1.35d+35) then
tmp = t_0
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = Math.pow(a, 4.0) * (1.0 - (4.0 / a));
double tmp;
if (b <= 1.85e-212) {
tmp = t_0;
} else if (b <= 6.8e-5) {
tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0;
} else if (b <= 1.35e+35) {
tmp = t_0;
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): t_0 = math.pow(a, 4.0) * (1.0 - (4.0 / a)) tmp = 0 if b <= 1.85e-212: tmp = t_0 elif b <= 6.8e-5: tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0 elif b <= 1.35e+35: tmp = t_0 else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) t_0 = Float64((a ^ 4.0) * Float64(1.0 - Float64(4.0 / a))) tmp = 0.0 if (b <= 1.85e-212) tmp = t_0; elseif (b <= 6.8e-5) tmp = Float64(Float64(4.0 * Float64(Float64(1.0 - a) * Float64(a * a))) + -1.0); elseif (b <= 1.35e+35) tmp = t_0; else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) t_0 = (a ^ 4.0) * (1.0 - (4.0 / a)); tmp = 0.0; if (b <= 1.85e-212) tmp = t_0; elseif (b <= 6.8e-5) tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0; elseif (b <= 1.35e+35) tmp = t_0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 - N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.85e-212], t$95$0, If[LessEqual[b, 6.8e-5], N[(N[(4.0 * N[(N[(1.0 - a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[b, 1.35e+35], t$95$0, N[Power[b, 4.0], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {a}^{4} \cdot \left(1 - \frac{4}{a}\right)\\
\mathbf{if}\;b \leq 1.85 \cdot 10^{-212}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 6.8 \cdot 10^{-5}:\\
\;\;\;\;4 \cdot \left(\left(1 - a\right) \cdot \left(a \cdot a\right)\right) + -1\\
\mathbf{elif}\;b \leq 1.35 \cdot 10^{+35}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 1.84999999999999995e-212 or 6.7999999999999999e-5 < b < 1.35000000000000001e35Initial program 71.6%
associate--l+71.6%
fma-define71.6%
distribute-rgt-in71.6%
sqr-neg71.6%
distribute-rgt-in71.6%
Simplified73.5%
Taylor expanded in a around inf 49.2%
associate-*r/49.2%
metadata-eval49.2%
Simplified49.2%
if 1.84999999999999995e-212 < b < 6.7999999999999999e-5Initial program 92.7%
associate--l+92.7%
fma-define92.7%
distribute-rgt-in92.7%
sqr-neg92.7%
distribute-rgt-in92.7%
Simplified92.7%
Taylor expanded in a around 0 74.7%
Taylor expanded in b around 0 74.2%
pow274.2%
Applied egg-rr74.2%
if 1.35000000000000001e35 < b Initial program 66.6%
unpow266.6%
+-commutative66.6%
associate-*r*66.6%
fma-undefine68.6%
fma-define68.6%
fma-define68.6%
add-sqr-sqrt68.6%
pow268.6%
fma-define68.6%
hypot-define68.6%
fma-define68.6%
add-sqr-sqrt68.6%
pow268.6%
fma-define68.6%
hypot-define68.6%
Applied egg-rr72.5%
Taylor expanded in b around 0 82.3%
Taylor expanded in b around inf 94.6%
Final simplification62.4%
(FPCore (a b) :precision binary64 (if (or (<= a -9.2e+46) (not (<= a 9.6e+27))) (pow a 4.0) (+ (+ (pow b 4.0) (* (* b b) 12.0)) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -9.2e+46) || !(a <= 9.6e+27)) {
tmp = pow(a, 4.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 ((a <= (-9.2d+46)) .or. (.not. (a <= 9.6d+27))) then
tmp = a ** 4.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 ((a <= -9.2e+46) || !(a <= 9.6e+27)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = (Math.pow(b, 4.0) + ((b * b) * 12.0)) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -9.2e+46) or not (a <= 9.6e+27): tmp = math.pow(a, 4.0) else: tmp = (math.pow(b, 4.0) + ((b * b) * 12.0)) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -9.2e+46) || !(a <= 9.6e+27)) tmp = a ^ 4.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 ((a <= -9.2e+46) || ~((a <= 9.6e+27))) tmp = a ^ 4.0; else tmp = ((b ^ 4.0) + ((b * b) * 12.0)) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -9.2e+46], N[Not[LessEqual[a, 9.6e+27]], $MachinePrecision]], N[Power[a, 4.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}\;a \leq -9.2 \cdot 10^{+46} \lor \neg \left(a \leq 9.6 \cdot 10^{+27}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;\left({b}^{4} + \left(b \cdot b\right) \cdot 12\right) + -1\\
\end{array}
\end{array}
if a < -9.2000000000000002e46 or 9.59999999999999991e27 < a Initial program 41.5%
unpow241.5%
+-commutative41.5%
associate-*r*41.5%
fma-undefine45.2%
fma-define45.2%
fma-define45.2%
add-sqr-sqrt45.2%
pow245.2%
fma-define45.2%
hypot-define45.2%
fma-define45.2%
add-sqr-sqrt45.2%
pow245.2%
fma-define45.2%
hypot-define45.2%
Applied egg-rr48.1%
Taylor expanded in b around 0 56.6%
Taylor expanded in a around inf 99.1%
if -9.2000000000000002e46 < a < 9.59999999999999991e27Initial program 97.1%
associate--l+97.1%
fma-define97.1%
distribute-rgt-in97.1%
sqr-neg97.1%
distribute-rgt-in97.1%
Simplified97.1%
Taylor expanded in a around 0 95.4%
pow295.4%
Applied egg-rr95.4%
Final simplification96.9%
(FPCore (a b)
:precision binary64
(if (<= b 3.7e-212)
(* (pow a 3.0) (- a 4.0))
(if (<= b 0.0002)
(+ (* 4.0 (* (- 1.0 a) (* a a))) -1.0)
(if (<= b 6e+35) (pow a 4.0) (pow b 4.0)))))
double code(double a, double b) {
double tmp;
if (b <= 3.7e-212) {
tmp = pow(a, 3.0) * (a - 4.0);
} else if (b <= 0.0002) {
tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0;
} else if (b <= 6e+35) {
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 <= 3.7d-212) then
tmp = (a ** 3.0d0) * (a - 4.0d0)
else if (b <= 0.0002d0) then
tmp = (4.0d0 * ((1.0d0 - a) * (a * a))) + (-1.0d0)
else if (b <= 6d+35) 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 <= 3.7e-212) {
tmp = Math.pow(a, 3.0) * (a - 4.0);
} else if (b <= 0.0002) {
tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0;
} else if (b <= 6e+35) {
tmp = Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 3.7e-212: tmp = math.pow(a, 3.0) * (a - 4.0) elif b <= 0.0002: tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0 elif b <= 6e+35: tmp = math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 3.7e-212) tmp = Float64((a ^ 3.0) * Float64(a - 4.0)); elseif (b <= 0.0002) tmp = Float64(Float64(4.0 * Float64(Float64(1.0 - a) * Float64(a * a))) + -1.0); elseif (b <= 6e+35) tmp = a ^ 4.0; else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 3.7e-212) tmp = (a ^ 3.0) * (a - 4.0); elseif (b <= 0.0002) tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0; elseif (b <= 6e+35) tmp = a ^ 4.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 3.7e-212], N[(N[Power[a, 3.0], $MachinePrecision] * N[(a - 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 0.0002], N[(N[(4.0 * N[(N[(1.0 - a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[b, 6e+35], N[Power[a, 4.0], $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.7 \cdot 10^{-212}:\\
\;\;\;\;{a}^{3} \cdot \left(a - 4\right)\\
\mathbf{elif}\;b \leq 0.0002:\\
\;\;\;\;4 \cdot \left(\left(1 - a\right) \cdot \left(a \cdot a\right)\right) + -1\\
\mathbf{elif}\;b \leq 6 \cdot 10^{+35}:\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 3.6999999999999999e-212Initial program 71.7%
associate--l+71.7%
fma-define71.7%
distribute-rgt-in71.7%
sqr-neg71.7%
distribute-rgt-in71.7%
Simplified73.7%
Taylor expanded in a around inf 49.0%
associate-*r/49.0%
metadata-eval49.0%
Simplified49.0%
Taylor expanded in a around 0 49.0%
if 3.6999999999999999e-212 < b < 2.0000000000000001e-4Initial program 92.7%
associate--l+92.7%
fma-define92.7%
distribute-rgt-in92.7%
sqr-neg92.7%
distribute-rgt-in92.7%
Simplified92.7%
Taylor expanded in a around 0 74.7%
Taylor expanded in b around 0 74.2%
pow274.2%
Applied egg-rr74.2%
if 2.0000000000000001e-4 < b < 5.99999999999999981e35Initial program 70.8%
unpow270.8%
+-commutative70.8%
associate-*r*70.8%
fma-undefine70.8%
fma-define70.8%
fma-define70.8%
add-sqr-sqrt70.8%
pow270.8%
fma-define70.8%
hypot-define70.8%
fma-define70.8%
add-sqr-sqrt70.8%
pow270.8%
fma-define70.8%
hypot-define70.8%
Applied egg-rr77.9%
Taylor expanded in b around 0 67.2%
Taylor expanded in a around inf 51.7%
if 5.99999999999999981e35 < b Initial program 66.6%
unpow266.6%
+-commutative66.6%
associate-*r*66.6%
fma-undefine68.6%
fma-define68.6%
fma-define68.6%
add-sqr-sqrt68.6%
pow268.6%
fma-define68.6%
hypot-define68.6%
fma-define68.6%
add-sqr-sqrt68.6%
pow268.6%
fma-define68.6%
hypot-define68.6%
Applied egg-rr72.5%
Taylor expanded in b around 0 82.3%
Taylor expanded in b around inf 94.6%
Final simplification62.4%
(FPCore (a b)
:precision binary64
(if (<= b 1.35e-212)
(pow a 4.0)
(if (<= b 1.3e-5)
(+ (* 4.0 (* (- 1.0 a) (* a a))) -1.0)
(if (<= b 3.2e+36) (pow a 4.0) (pow b 4.0)))))
double code(double a, double b) {
double tmp;
if (b <= 1.35e-212) {
tmp = pow(a, 4.0);
} else if (b <= 1.3e-5) {
tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0;
} else if (b <= 3.2e+36) {
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 <= 1.35d-212) then
tmp = a ** 4.0d0
else if (b <= 1.3d-5) then
tmp = (4.0d0 * ((1.0d0 - a) * (a * a))) + (-1.0d0)
else if (b <= 3.2d+36) 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 <= 1.35e-212) {
tmp = Math.pow(a, 4.0);
} else if (b <= 1.3e-5) {
tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0;
} else if (b <= 3.2e+36) {
tmp = Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1.35e-212: tmp = math.pow(a, 4.0) elif b <= 1.3e-5: tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0 elif b <= 3.2e+36: tmp = math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 1.35e-212) tmp = a ^ 4.0; elseif (b <= 1.3e-5) tmp = Float64(Float64(4.0 * Float64(Float64(1.0 - a) * Float64(a * a))) + -1.0); elseif (b <= 3.2e+36) tmp = a ^ 4.0; else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 1.35e-212) tmp = a ^ 4.0; elseif (b <= 1.3e-5) tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0; elseif (b <= 3.2e+36) tmp = a ^ 4.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1.35e-212], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[b, 1.3e-5], N[(N[(4.0 * N[(N[(1.0 - a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[b, 3.2e+36], N[Power[a, 4.0], $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.35 \cdot 10^{-212}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;b \leq 1.3 \cdot 10^{-5}:\\
\;\;\;\;4 \cdot \left(\left(1 - a\right) \cdot \left(a \cdot a\right)\right) + -1\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{+36}:\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 1.34999999999999991e-212 or 1.29999999999999992e-5 < b < 3.1999999999999999e36Initial program 71.6%
unpow271.6%
+-commutative71.6%
associate-*r*71.6%
fma-undefine73.5%
fma-define73.5%
fma-define73.5%
add-sqr-sqrt73.5%
pow273.5%
fma-define73.5%
hypot-define73.5%
fma-define73.5%
add-sqr-sqrt73.5%
pow273.5%
fma-define73.5%
hypot-define73.5%
Applied egg-rr74.1%
Taylor expanded in b around 0 78.1%
Taylor expanded in a around inf 48.8%
if 1.34999999999999991e-212 < b < 1.29999999999999992e-5Initial program 92.7%
associate--l+92.7%
fma-define92.7%
distribute-rgt-in92.7%
sqr-neg92.7%
distribute-rgt-in92.7%
Simplified92.7%
Taylor expanded in a around 0 74.7%
Taylor expanded in b around 0 74.2%
pow274.2%
Applied egg-rr74.2%
if 3.1999999999999999e36 < b Initial program 66.6%
unpow266.6%
+-commutative66.6%
associate-*r*66.6%
fma-undefine68.6%
fma-define68.6%
fma-define68.6%
add-sqr-sqrt68.6%
pow268.6%
fma-define68.6%
hypot-define68.6%
fma-define68.6%
add-sqr-sqrt68.6%
pow268.6%
fma-define68.6%
hypot-define68.6%
Applied egg-rr72.5%
Taylor expanded in b around 0 82.3%
Taylor expanded in b around inf 94.6%
Final simplification62.1%
(FPCore (a b) :precision binary64 (if (or (<= a -5.5e+26) (not (<= a 1.65e+29))) (pow a 4.0) (+ (* (* b b) 12.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -5.5e+26) || !(a <= 1.65e+29)) {
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 <= (-5.5d+26)) .or. (.not. (a <= 1.65d+29))) 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 <= -5.5e+26) || !(a <= 1.65e+29)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = ((b * b) * 12.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -5.5e+26) or not (a <= 1.65e+29): 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 <= -5.5e+26) || !(a <= 1.65e+29)) 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 <= -5.5e+26) || ~((a <= 1.65e+29))) tmp = a ^ 4.0; else tmp = ((b * b) * 12.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -5.5e+26], N[Not[LessEqual[a, 1.65e+29]], $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 -5.5 \cdot 10^{+26} \lor \neg \left(a \leq 1.65 \cdot 10^{+29}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 12 + -1\\
\end{array}
\end{array}
if a < -5.4999999999999997e26 or 1.64999999999999992e29 < a Initial program 42.3%
unpow242.3%
+-commutative42.3%
associate-*r*42.3%
fma-undefine45.9%
fma-define45.9%
fma-define45.9%
add-sqr-sqrt45.9%
pow245.9%
fma-define45.9%
hypot-define45.9%
fma-define45.9%
add-sqr-sqrt45.9%
pow245.9%
fma-define45.9%
hypot-define45.9%
Applied egg-rr48.6%
Taylor expanded in b around 0 58.5%
Taylor expanded in a around inf 96.6%
if -5.4999999999999997e26 < a < 1.64999999999999992e29Initial program 98.4%
associate--l+98.4%
fma-define98.4%
distribute-rgt-in98.4%
sqr-neg98.4%
distribute-rgt-in98.4%
Simplified98.4%
Taylor expanded in a around 0 96.6%
Taylor expanded in b around 0 68.0%
*-commutative68.0%
Simplified68.0%
pow296.6%
Applied egg-rr68.0%
Final simplification80.4%
(FPCore (a b) :precision binary64 (if (<= a -1.2e+68) (+ (* 4.0 (* (- 1.0 a) (* a a))) -1.0) (+ (* (* b b) 12.0) -1.0)))
double code(double a, double b) {
double tmp;
if (a <= -1.2e+68) {
tmp = (4.0 * ((1.0 - a) * (a * a))) + -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 (a <= (-1.2d+68)) then
tmp = (4.0d0 * ((1.0d0 - a) * (a * a))) + (-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 (a <= -1.2e+68) {
tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0;
} else {
tmp = ((b * b) * 12.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -1.2e+68: tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0 else: tmp = ((b * b) * 12.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (a <= -1.2e+68) tmp = Float64(Float64(4.0 * Float64(Float64(1.0 - a) * Float64(a * a))) + -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 (a <= -1.2e+68) tmp = (4.0 * ((1.0 - a) * (a * a))) + -1.0; else tmp = ((b * b) * 12.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -1.2e+68], N[(N[(4.0 * N[(N[(1.0 - a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.2 \cdot 10^{+68}:\\
\;\;\;\;4 \cdot \left(\left(1 - a\right) \cdot \left(a \cdot a\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 12 + -1\\
\end{array}
\end{array}
if a < -1.20000000000000004e68Initial program 65.9%
associate--l+65.9%
fma-define65.9%
distribute-rgt-in65.9%
sqr-neg65.9%
distribute-rgt-in65.9%
Simplified65.9%
Taylor expanded in a around 0 51.3%
Taylor expanded in b around 0 83.3%
pow283.3%
Applied egg-rr83.3%
if -1.20000000000000004e68 < a Initial program 75.8%
associate--l+75.8%
fma-define75.8%
distribute-rgt-in75.8%
sqr-neg75.8%
distribute-rgt-in75.8%
Simplified77.7%
Taylor expanded in a around 0 77.8%
Taylor expanded in b around 0 54.2%
*-commutative54.2%
Simplified54.2%
pow277.8%
Applied egg-rr54.2%
Final simplification59.2%
(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 74.1%
associate--l+74.1%
fma-define74.1%
distribute-rgt-in74.1%
sqr-neg74.1%
distribute-rgt-in74.1%
Simplified75.7%
Taylor expanded in a around 0 69.7%
Taylor expanded in b around 0 48.4%
*-commutative48.4%
Simplified48.4%
pow269.7%
Applied egg-rr48.4%
Final simplification48.4%
(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 74.1%
associate--l+74.1%
fma-define74.1%
distribute-rgt-in74.1%
sqr-neg74.1%
distribute-rgt-in74.1%
Simplified75.7%
Taylor expanded in a around 0 69.7%
Taylor expanded in b around 0 23.3%
herbie shell --seed 2024155
(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))