
(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 10 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)
(+
(pow (hypot b a) 4.0)
(+ (* 4.0 (fma (* a a) (- 1.0 a) (* b (* b (+ a 3.0))))) -1.0))
(+
(+ (* (pow a 2.0) (+ (* 2.0 (pow b 2.0)) (* a (- a 4.0)))) (pow b 4.0))
-1.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 = pow(hypot(b, a), 4.0) + ((4.0 * fma((a * a), (1.0 - a), (b * (b * (a + 3.0))))) + -1.0);
} else {
tmp = ((pow(a, 2.0) * ((2.0 * pow(b, 2.0)) + (a * (a - 4.0)))) + pow(b, 4.0)) + -1.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((hypot(b, a) ^ 4.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(Float64(Float64((a ^ 2.0) * Float64(Float64(2.0 * (b ^ 2.0)) + Float64(a * Float64(a - 4.0)))) + (b ^ 4.0)) + -1.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[Power[N[Sqrt[b ^ 2 + a ^ 2], $MachinePrecision], 4.0], $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[(N[(N[Power[a, 2.0], $MachinePrecision] * N[(N[(2.0 * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(a * N[(a - 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $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:\\
\;\;\;\;{\left(\mathsf{hypot}\left(b, a\right)\right)}^{4} + \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}:\\
\;\;\;\;\left({a}^{2} \cdot \left(2 \cdot {b}^{2} + a \cdot \left(a - 4\right)\right) + {b}^{4}\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%
associate--l+99.8%
fma-define99.8%
sqr-neg99.8%
fma-define99.8%
distribute-rgt-in99.8%
sqr-neg99.8%
distribute-rgt-in99.8%
fma-define99.8%
sqr-neg99.8%
Simplified99.8%
fma-define99.8%
unpow299.8%
+-commutative99.8%
distribute-lft-in92.0%
fma-define92.0%
add-sqr-sqrt92.0%
pow292.0%
fma-define92.0%
hypot-define92.0%
pow292.0%
fma-define92.0%
add-sqr-sqrt92.0%
pow292.0%
fma-define92.0%
hypot-define92.0%
pow292.0%
Applied egg-rr92.0%
distribute-lft-out99.8%
+-commutative99.8%
rem-square-sqrt99.8%
unpow299.8%
unpow299.8%
hypot-undefine99.8%
unpow299.8%
unpow299.8%
hypot-undefine99.8%
unpow299.8%
pow-sqr100.0%
hypot-undefine100.0%
unpow2100.0%
unpow2100.0%
+-commutative100.0%
unpow2100.0%
unpow2100.0%
hypot-define100.0%
metadata-eval100.0%
Simplified100.0%
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%
Simplified6.5%
fma-define6.5%
unpow26.5%
+-commutative6.5%
distribute-lft-in6.5%
fma-define6.5%
add-sqr-sqrt6.5%
pow26.5%
fma-define6.5%
hypot-define6.5%
pow26.5%
fma-define6.5%
add-sqr-sqrt6.5%
pow26.5%
fma-define6.5%
hypot-define6.5%
pow26.5%
Applied egg-rr6.5%
distribute-lft-out6.5%
+-commutative6.5%
rem-square-sqrt6.5%
unpow26.5%
unpow26.5%
hypot-undefine6.5%
unpow26.5%
unpow26.5%
hypot-undefine6.5%
unpow26.5%
pow-sqr6.5%
hypot-undefine6.5%
unpow26.5%
unpow26.5%
+-commutative6.5%
unpow26.5%
unpow26.5%
hypot-define6.5%
metadata-eval6.5%
Simplified6.5%
Taylor expanded in a around inf 39.0%
mul-1-neg39.0%
Simplified39.0%
Taylor expanded in a around 0 100.0%
Final simplification100.0%
(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 2.0) (+ (* 2.0 (pow b 2.0)) (* a (- a 4.0)))) (pow b 4.0))
-1.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, 2.0) * ((2.0 * pow(b, 2.0)) + (a * (a - 4.0)))) + pow(b, 4.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 * (((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, 2.0) * ((2.0 * Math.pow(b, 2.0)) + (a * (a - 4.0)))) + Math.pow(b, 4.0)) + -1.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, 2.0) * ((2.0 * math.pow(b, 2.0)) + (a * (a - 4.0)))) + math.pow(b, 4.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(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(Float64(Float64((a ^ 2.0) * Float64(Float64(2.0 * (b ^ 2.0)) + Float64(a * Float64(a - 4.0)))) + (b ^ 4.0)) + -1.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 ^ 2.0) * ((2.0 * (b ^ 2.0)) + (a * (a - 4.0)))) + (b ^ 4.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[(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[(N[(N[Power[a, 2.0], $MachinePrecision] * N[(N[(2.0 * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(a * N[(a - 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[b, 4.0], $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(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}:\\
\;\;\;\;\left({a}^{2} \cdot \left(2 \cdot {b}^{2} + a \cdot \left(a - 4\right)\right) + {b}^{4}\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%
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%
Simplified6.5%
fma-define6.5%
unpow26.5%
+-commutative6.5%
distribute-lft-in6.5%
fma-define6.5%
add-sqr-sqrt6.5%
pow26.5%
fma-define6.5%
hypot-define6.5%
pow26.5%
fma-define6.5%
add-sqr-sqrt6.5%
pow26.5%
fma-define6.5%
hypot-define6.5%
pow26.5%
Applied egg-rr6.5%
distribute-lft-out6.5%
+-commutative6.5%
rem-square-sqrt6.5%
unpow26.5%
unpow26.5%
hypot-undefine6.5%
unpow26.5%
unpow26.5%
hypot-undefine6.5%
unpow26.5%
pow-sqr6.5%
hypot-undefine6.5%
unpow26.5%
unpow26.5%
+-commutative6.5%
unpow26.5%
unpow26.5%
hypot-define6.5%
metadata-eval6.5%
Simplified6.5%
Taylor expanded in a around inf 39.0%
mul-1-neg39.0%
Simplified39.0%
Taylor expanded in a around 0 100.0%
Final simplification99.9%
(FPCore (a b)
:precision binary64
(if (<= a -2e+104)
(pow a 4.0)
(if (or (<= a -34000.0) (not (<= a 2e+25)))
(+ (+ (pow (hypot b a) 4.0) (* 4.0 (pow a 3.0))) -1.0)
(+
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ a 3.0)))))
-1.0))))
double code(double a, double b) {
double tmp;
if (a <= -2e+104) {
tmp = pow(a, 4.0);
} else if ((a <= -34000.0) || !(a <= 2e+25)) {
tmp = (pow(hypot(b, a), 4.0) + (4.0 * pow(a, 3.0))) + -1.0;
} else {
tmp = (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))))) + -1.0;
}
return tmp;
}
public static double code(double a, double b) {
double tmp;
if (a <= -2e+104) {
tmp = Math.pow(a, 4.0);
} else if ((a <= -34000.0) || !(a <= 2e+25)) {
tmp = (Math.pow(Math.hypot(b, a), 4.0) + (4.0 * Math.pow(a, 3.0))) + -1.0;
} else {
tmp = (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))))) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -2e+104: tmp = math.pow(a, 4.0) elif (a <= -34000.0) or not (a <= 2e+25): tmp = (math.pow(math.hypot(b, a), 4.0) + (4.0 * math.pow(a, 3.0))) + -1.0 else: tmp = (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))))) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (a <= -2e+104) tmp = a ^ 4.0; elseif ((a <= -34000.0) || !(a <= 2e+25)) tmp = Float64(Float64((hypot(b, a) ^ 4.0) + Float64(4.0 * (a ^ 3.0))) + -1.0); else tmp = 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(a + 3.0))))) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -2e+104) tmp = a ^ 4.0; elseif ((a <= -34000.0) || ~((a <= 2e+25))) tmp = ((hypot(b, a) ^ 4.0) + (4.0 * (a ^ 3.0))) + -1.0; else tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))))) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -2e+104], N[Power[a, 4.0], $MachinePrecision], If[Or[LessEqual[a, -34000.0], N[Not[LessEqual[a, 2e+25]], $MachinePrecision]], N[(N[(N[Power[N[Sqrt[b ^ 2 + a ^ 2], $MachinePrecision], 4.0], $MachinePrecision] + N[(4.0 * N[Power[a, 3.0], $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[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $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 \cdot 10^{+104}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq -34000 \lor \neg \left(a \leq 2 \cdot 10^{+25}\right):\\
\;\;\;\;\left({\left(\mathsf{hypot}\left(b, a\right)\right)}^{4} + 4 \cdot {a}^{3}\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\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(a + 3\right)\right)\right) + -1\\
\end{array}
\end{array}
if a < -2e104Initial program 56.8%
associate--l+56.8%
fma-define56.8%
sqr-neg56.8%
fma-define56.8%
distribute-rgt-in56.8%
sqr-neg56.8%
distribute-rgt-in56.8%
fma-define56.8%
sqr-neg56.8%
Simplified56.8%
Taylor expanded in a around inf 100.0%
if -2e104 < a < -34000 or 2.00000000000000018e25 < a Initial program 31.3%
associate--l+31.3%
fma-define31.3%
sqr-neg31.3%
fma-define31.3%
distribute-rgt-in31.3%
sqr-neg31.3%
distribute-rgt-in31.3%
fma-define31.3%
sqr-neg31.3%
Simplified36.9%
fma-define36.9%
unpow236.9%
+-commutative36.9%
distribute-lft-in36.9%
fma-define36.9%
add-sqr-sqrt36.9%
pow236.9%
fma-define36.9%
hypot-define36.9%
pow236.9%
fma-define36.9%
add-sqr-sqrt36.9%
pow236.9%
fma-define36.9%
hypot-define36.9%
pow236.9%
Applied egg-rr36.9%
distribute-lft-out36.9%
+-commutative36.9%
rem-square-sqrt36.9%
unpow236.9%
unpow236.9%
hypot-undefine36.9%
unpow236.9%
unpow236.9%
hypot-undefine36.9%
unpow236.9%
pow-sqr37.1%
hypot-undefine37.1%
unpow237.1%
unpow237.1%
+-commutative37.1%
unpow237.1%
unpow237.1%
hypot-define37.1%
metadata-eval37.1%
Simplified37.1%
Taylor expanded in a around inf 47.2%
mul-1-neg47.2%
Simplified47.2%
associate-+r-47.2%
add-sqr-sqrt28.1%
sqrt-unprod94.9%
sqr-neg94.9%
sqrt-unprod71.9%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
if -34000 < a < 2.00000000000000018e25Initial program 99.9%
Final simplification99.9%
(FPCore (a b) :precision binary64 (let* ((t_0 (pow (hypot b a) 4.0)) (t_1 (* 4.0 (pow a 3.0)))) (if (<= a 2e+25) (+ t_0 (- -1.0 t_1)) (+ (+ t_0 t_1) -1.0))))
double code(double a, double b) {
double t_0 = pow(hypot(b, a), 4.0);
double t_1 = 4.0 * pow(a, 3.0);
double tmp;
if (a <= 2e+25) {
tmp = t_0 + (-1.0 - t_1);
} else {
tmp = (t_0 + t_1) + -1.0;
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = Math.pow(Math.hypot(b, a), 4.0);
double t_1 = 4.0 * Math.pow(a, 3.0);
double tmp;
if (a <= 2e+25) {
tmp = t_0 + (-1.0 - t_1);
} else {
tmp = (t_0 + t_1) + -1.0;
}
return tmp;
}
def code(a, b): t_0 = math.pow(math.hypot(b, a), 4.0) t_1 = 4.0 * math.pow(a, 3.0) tmp = 0 if a <= 2e+25: tmp = t_0 + (-1.0 - t_1) else: tmp = (t_0 + t_1) + -1.0 return tmp
function code(a, b) t_0 = hypot(b, a) ^ 4.0 t_1 = Float64(4.0 * (a ^ 3.0)) tmp = 0.0 if (a <= 2e+25) tmp = Float64(t_0 + Float64(-1.0 - t_1)); else tmp = Float64(Float64(t_0 + t_1) + -1.0); end return tmp end
function tmp_2 = code(a, b) t_0 = hypot(b, a) ^ 4.0; t_1 = 4.0 * (a ^ 3.0); tmp = 0.0; if (a <= 2e+25) tmp = t_0 + (-1.0 - t_1); else tmp = (t_0 + t_1) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[Power[N[Sqrt[b ^ 2 + a ^ 2], $MachinePrecision], 4.0], $MachinePrecision]}, Block[{t$95$1 = N[(4.0 * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 2e+25], N[(t$95$0 + N[(-1.0 - t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 + t$95$1), $MachinePrecision] + -1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(b, a\right)\right)}^{4}\\
t_1 := 4 \cdot {a}^{3}\\
\mathbf{if}\;a \leq 2 \cdot 10^{+25}:\\
\;\;\;\;t\_0 + \left(-1 - t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 + t\_1\right) + -1\\
\end{array}
\end{array}
if a < 2.00000000000000018e25Initial program 84.3%
associate--l+84.3%
fma-define84.3%
sqr-neg84.3%
fma-define84.3%
distribute-rgt-in84.3%
sqr-neg84.3%
distribute-rgt-in84.3%
fma-define84.3%
sqr-neg84.3%
Simplified84.3%
fma-define84.3%
unpow284.3%
+-commutative84.3%
distribute-lft-in77.0%
fma-define77.0%
add-sqr-sqrt77.0%
pow277.0%
fma-define77.0%
hypot-define77.0%
pow277.0%
fma-define77.0%
add-sqr-sqrt76.9%
pow276.9%
fma-define77.0%
hypot-define77.0%
pow277.0%
Applied egg-rr77.0%
distribute-lft-out84.2%
+-commutative84.2%
rem-square-sqrt84.2%
unpow284.2%
unpow284.2%
hypot-undefine84.2%
unpow284.2%
unpow284.2%
hypot-undefine84.2%
unpow284.2%
pow-sqr84.3%
hypot-undefine84.3%
unpow284.3%
unpow284.3%
+-commutative84.3%
unpow284.3%
unpow284.3%
hypot-define84.3%
metadata-eval84.3%
Simplified84.3%
Taylor expanded in a around inf 98.0%
mul-1-neg98.0%
Simplified98.0%
if 2.00000000000000018e25 < a Initial program 26.4%
associate--l+26.4%
fma-define26.4%
sqr-neg26.4%
fma-define26.4%
distribute-rgt-in26.4%
sqr-neg26.4%
distribute-rgt-in26.4%
fma-define26.4%
sqr-neg26.4%
Simplified34.2%
fma-define34.2%
unpow234.2%
+-commutative34.2%
distribute-lft-in34.2%
fma-define34.2%
add-sqr-sqrt34.2%
pow234.2%
fma-define34.2%
hypot-define34.2%
pow234.2%
fma-define34.2%
add-sqr-sqrt34.2%
pow234.2%
fma-define34.2%
hypot-define34.2%
pow234.2%
Applied egg-rr34.2%
distribute-lft-out34.2%
+-commutative34.2%
rem-square-sqrt34.2%
unpow234.2%
unpow234.2%
hypot-undefine34.2%
unpow234.2%
unpow234.2%
hypot-undefine34.2%
unpow234.2%
pow-sqr34.4%
hypot-undefine34.4%
unpow234.4%
unpow234.4%
+-commutative34.4%
unpow234.4%
unpow234.4%
hypot-define34.4%
metadata-eval34.4%
Simplified34.4%
Taylor expanded in a around inf 26.6%
mul-1-neg26.6%
Simplified26.6%
associate-+r-26.6%
add-sqr-sqrt0.0%
sqrt-unprod94.4%
sqr-neg94.4%
sqrt-unprod100.0%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
Final simplification98.5%
(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 4.0) (- 1.0 (/ (+ 4.0 (/ -4.0 a)) a))) -1.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, 4.0) * (1.0 - ((4.0 + (-4.0 / a)) / a))) + -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 * (((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, 4.0) * (1.0 - ((4.0 + (-4.0 / a)) / a))) + -1.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, 4.0) * (1.0 - ((4.0 + (-4.0 / a)) / a))) + -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(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(Float64((a ^ 4.0) * Float64(1.0 - Float64(Float64(4.0 + Float64(-4.0 / a)) / a))) + -1.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 ^ 4.0) * (1.0 - ((4.0 + (-4.0 / a)) / a))) + -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[(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[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 - N[(N[(4.0 + N[(-4.0 / a), $MachinePrecision]), $MachinePrecision] / a), $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(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}^{4} \cdot \left(1 - \frac{4 + \frac{-4}{a}}{a}\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%
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%
Simplified6.5%
Taylor expanded in b around 0 28.0%
Taylor expanded in a around -inf 89.0%
mul-1-neg89.0%
unsub-neg89.0%
sub-neg89.0%
associate-*r/89.0%
metadata-eval89.0%
distribute-neg-frac89.0%
metadata-eval89.0%
Simplified89.0%
Final simplification96.6%
(FPCore (a b)
:precision binary64
(if (<= b 1.85e-252)
(pow a 4.0)
(if (<= b 2.05e-179)
-1.0
(if (<= b 2.4e-96)
(pow a 4.0)
(if (<= b 3.2e-66) -1.0 (if (<= b 2.4e+31) (pow a 4.0) (pow b 4.0)))))))
double code(double a, double b) {
double tmp;
if (b <= 1.85e-252) {
tmp = pow(a, 4.0);
} else if (b <= 2.05e-179) {
tmp = -1.0;
} else if (b <= 2.4e-96) {
tmp = pow(a, 4.0);
} else if (b <= 3.2e-66) {
tmp = -1.0;
} else if (b <= 2.4e+31) {
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.85d-252) then
tmp = a ** 4.0d0
else if (b <= 2.05d-179) then
tmp = -1.0d0
else if (b <= 2.4d-96) then
tmp = a ** 4.0d0
else if (b <= 3.2d-66) then
tmp = -1.0d0
else if (b <= 2.4d+31) 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.85e-252) {
tmp = Math.pow(a, 4.0);
} else if (b <= 2.05e-179) {
tmp = -1.0;
} else if (b <= 2.4e-96) {
tmp = Math.pow(a, 4.0);
} else if (b <= 3.2e-66) {
tmp = -1.0;
} else if (b <= 2.4e+31) {
tmp = Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1.85e-252: tmp = math.pow(a, 4.0) elif b <= 2.05e-179: tmp = -1.0 elif b <= 2.4e-96: tmp = math.pow(a, 4.0) elif b <= 3.2e-66: tmp = -1.0 elif b <= 2.4e+31: 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.85e-252) tmp = a ^ 4.0; elseif (b <= 2.05e-179) tmp = -1.0; elseif (b <= 2.4e-96) tmp = a ^ 4.0; elseif (b <= 3.2e-66) tmp = -1.0; elseif (b <= 2.4e+31) 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.85e-252) tmp = a ^ 4.0; elseif (b <= 2.05e-179) tmp = -1.0; elseif (b <= 2.4e-96) tmp = a ^ 4.0; elseif (b <= 3.2e-66) tmp = -1.0; elseif (b <= 2.4e+31) tmp = a ^ 4.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1.85e-252], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[b, 2.05e-179], -1.0, If[LessEqual[b, 2.4e-96], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[b, 3.2e-66], -1.0, If[LessEqual[b, 2.4e+31], N[Power[a, 4.0], $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.85 \cdot 10^{-252}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;b \leq 2.05 \cdot 10^{-179}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 2.4 \cdot 10^{-96}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{-66}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 2.4 \cdot 10^{+31}:\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 1.8500000000000001e-252 or 2.05e-179 < b < 2.40000000000000019e-96 or 3.19999999999999982e-66 < b < 2.39999999999999982e31Initial program 73.2%
associate--l+73.2%
fma-define73.2%
sqr-neg73.2%
fma-define73.2%
distribute-rgt-in73.2%
sqr-neg73.2%
distribute-rgt-in73.2%
fma-define73.2%
sqr-neg73.2%
Simplified74.9%
Taylor expanded in a around inf 48.1%
if 1.8500000000000001e-252 < b < 2.05e-179 or 2.40000000000000019e-96 < b < 3.19999999999999982e-66Initial program 94.9%
associate--l+94.9%
fma-define94.9%
sqr-neg94.9%
fma-define94.9%
distribute-rgt-in94.9%
sqr-neg94.9%
distribute-rgt-in94.9%
fma-define94.9%
sqr-neg94.9%
Simplified94.9%
Taylor expanded in b around 0 95.0%
Taylor expanded in a around 0 80.1%
if 2.39999999999999982e31 < b Initial program 51.6%
associate--l+51.6%
fma-define51.6%
sqr-neg51.6%
fma-define51.6%
distribute-rgt-in51.6%
sqr-neg51.6%
distribute-rgt-in51.6%
fma-define51.6%
sqr-neg51.6%
Simplified54.9%
Taylor expanded in b around inf 95.3%
(FPCore (a b) :precision binary64 (if (<= b 4.9e+32) (+ (* (pow a 2.0) (+ 4.0 (* a (- a 4.0)))) -1.0) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if (b <= 4.9e+32) {
tmp = (pow(a, 2.0) * (4.0 + (a * (a - 4.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 <= 4.9d+32) then
tmp = ((a ** 2.0d0) * (4.0d0 + (a * (a - 4.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 <= 4.9e+32) {
tmp = (Math.pow(a, 2.0) * (4.0 + (a * (a - 4.0)))) + -1.0;
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 4.9e+32: tmp = (math.pow(a, 2.0) * (4.0 + (a * (a - 4.0)))) + -1.0 else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 4.9e+32) tmp = Float64(Float64((a ^ 2.0) * Float64(4.0 + Float64(a * Float64(a - 4.0)))) + -1.0); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 4.9e+32) tmp = ((a ^ 2.0) * (4.0 + (a * (a - 4.0)))) + -1.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 4.9e+32], 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[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.9 \cdot 10^{+32}:\\
\;\;\;\;{a}^{2} \cdot \left(4 + a \cdot \left(a - 4\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 4.9000000000000001e32Initial program 75.4%
associate--l+75.4%
fma-define75.4%
sqr-neg75.4%
fma-define75.4%
distribute-rgt-in75.4%
sqr-neg75.4%
distribute-rgt-in75.4%
fma-define75.4%
sqr-neg75.4%
Simplified76.9%
Taylor expanded in b around 0 57.1%
Taylor expanded in a around 0 76.0%
if 4.9000000000000001e32 < b Initial program 51.6%
associate--l+51.6%
fma-define51.6%
sqr-neg51.6%
fma-define51.6%
distribute-rgt-in51.6%
sqr-neg51.6%
distribute-rgt-in51.6%
fma-define51.6%
sqr-neg51.6%
Simplified54.9%
Taylor expanded in b around inf 95.3%
Final simplification80.5%
(FPCore (a b) :precision binary64 (if (or (<= a -1.6e+82) (not (<= a 9.9e+61))) (pow a 4.0) (+ (pow b 4.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -1.6e+82) || !(a <= 9.9e+61)) {
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 <= (-1.6d+82)) .or. (.not. (a <= 9.9d+61))) 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 <= -1.6e+82) || !(a <= 9.9e+61)) {
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 <= -1.6e+82) or not (a <= 9.9e+61): 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 <= -1.6e+82) || !(a <= 9.9e+61)) 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 <= -1.6e+82) || ~((a <= 9.9e+61))) tmp = a ^ 4.0; else tmp = (b ^ 4.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -1.6e+82], N[Not[LessEqual[a, 9.9e+61]], $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 -1.6 \cdot 10^{+82} \lor \neg \left(a \leq 9.9 \cdot 10^{+61}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} + -1\\
\end{array}
\end{array}
if a < -1.59999999999999987e82 or 9.9000000000000004e61 < a Initial program 33.6%
associate--l+33.6%
fma-define33.6%
sqr-neg33.6%
fma-define33.6%
distribute-rgt-in33.6%
sqr-neg33.6%
distribute-rgt-in33.6%
fma-define33.6%
sqr-neg33.6%
Simplified38.7%
Taylor expanded in a around inf 99.1%
if -1.59999999999999987e82 < a < 9.9000000000000004e61Initial program 92.2%
associate--l+92.2%
fma-define92.2%
sqr-neg92.2%
fma-define92.2%
distribute-rgt-in92.2%
sqr-neg92.2%
distribute-rgt-in92.2%
fma-define92.2%
sqr-neg92.2%
Simplified92.2%
fma-define92.2%
unpow292.2%
+-commutative92.2%
distribute-lft-in85.9%
fma-define85.9%
add-sqr-sqrt85.9%
pow285.9%
fma-define85.9%
hypot-define85.9%
pow285.9%
fma-define85.9%
add-sqr-sqrt85.9%
pow285.9%
fma-define85.9%
hypot-define85.9%
pow285.9%
Applied egg-rr85.9%
distribute-lft-out92.2%
+-commutative92.2%
rem-square-sqrt92.2%
unpow292.2%
unpow292.2%
hypot-undefine92.2%
unpow292.2%
unpow292.2%
hypot-undefine92.2%
unpow292.2%
pow-sqr92.4%
hypot-undefine92.4%
unpow292.4%
unpow292.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-define92.4%
metadata-eval92.4%
Simplified92.4%
Taylor expanded in a around inf 97.6%
mul-1-neg97.6%
Simplified97.6%
Taylor expanded in a around 0 90.7%
Final simplification93.9%
(FPCore (a b) :precision binary64 (if (or (<= a -2.05e-9) (not (<= a 0.0078))) (pow a 4.0) -1.0))
double code(double a, double b) {
double tmp;
if ((a <= -2.05e-9) || !(a <= 0.0078)) {
tmp = pow(a, 4.0);
} else {
tmp = -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.05d-9)) .or. (.not. (a <= 0.0078d0))) then
tmp = a ** 4.0d0
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -2.05e-9) || !(a <= 0.0078)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -2.05e-9) or not (a <= 0.0078): tmp = math.pow(a, 4.0) else: tmp = -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -2.05e-9) || !(a <= 0.0078)) tmp = a ^ 4.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -2.05e-9) || ~((a <= 0.0078))) tmp = a ^ 4.0; else tmp = -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -2.05e-9], N[Not[LessEqual[a, 0.0078]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], -1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.05 \cdot 10^{-9} \lor \neg \left(a \leq 0.0078\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if a < -2.0500000000000002e-9 or 0.0077999999999999996 < a Initial program 44.1%
associate--l+44.1%
fma-define44.1%
sqr-neg44.1%
fma-define44.1%
distribute-rgt-in44.1%
sqr-neg44.1%
distribute-rgt-in44.1%
fma-define44.1%
sqr-neg44.1%
Simplified47.7%
Taylor expanded in a around inf 80.7%
if -2.0500000000000002e-9 < a < 0.0077999999999999996Initial 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 b around 0 52.0%
Taylor expanded in a around 0 51.5%
Final simplification67.3%
(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 69.8%
associate--l+69.8%
fma-define69.8%
sqr-neg69.8%
fma-define69.8%
distribute-rgt-in69.8%
sqr-neg69.8%
distribute-rgt-in69.8%
fma-define69.8%
sqr-neg69.8%
Simplified71.8%
Taylor expanded in b around 0 49.6%
Taylor expanded in a around 0 24.1%
herbie shell --seed 2024089
(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))