
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 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) * (1.0 - (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) * (1.0d0 - (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) * (1.0 - (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) * (1.0 - (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(1.0 - 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) * (1.0 - (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[(1.0 - N[(3.0 * a), $MachinePrecision]), $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(1 - 3 \cdot 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) (- 1.0 (* 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) * (1.0 - (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) * (1.0d0 - (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) * (1.0 - (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) * (1.0 - (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(1.0 - 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) * (1.0 - (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[(1.0 - N[(3.0 * a), $MachinePrecision]), $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(1 - 3 \cdot a\right)\right)\right) - 1
\end{array}
(FPCore (a b)
:precision binary64
(if (<=
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))
INFINITY)
(+
(fma
4.0
(fma a (* a (+ a 1.0)) (* b (* b (+ 1.0 (* a -3.0)))))
(pow (fma a a (* b b)) 2.0))
-1.0)
(+ -1.0 (* (pow a 2.0) (+ 4.0 (+ (* 2.0 (pow b 2.0)) (* a (+ a 4.0))))))))
double code(double a, double b) {
double tmp;
if ((pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))))) <= ((double) INFINITY)) {
tmp = fma(4.0, fma(a, (a * (a + 1.0)), (b * (b * (1.0 + (a * -3.0))))), pow(fma(a, a, (b * b)), 2.0)) + -1.0;
} else {
tmp = -1.0 + (pow(a, 2.0) * (4.0 + ((2.0 * pow(b, 2.0)) + (a * (a + 4.0)))));
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(a + 1.0)) + Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0)))))) <= Inf) tmp = Float64(fma(4.0, fma(a, Float64(a * Float64(a + 1.0)), Float64(b * Float64(b * Float64(1.0 + Float64(a * -3.0))))), (fma(a, a, Float64(b * b)) ^ 2.0)) + -1.0); else tmp = Float64(-1.0 + Float64((a ^ 2.0) * Float64(4.0 + Float64(Float64(2.0 * (b ^ 2.0)) + Float64(a * Float64(a + 4.0)))))); end return tmp end
code[a_, b_] := If[LessEqual[N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(4.0 * N[(a * N[(a * N[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(b * N[(b * N[(1.0 + N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(a * a + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(-1.0 + N[(N[Power[a, 2.0], $MachinePrecision] * N[(4.0 + N[(N[(2.0 * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(4, \mathsf{fma}\left(a, a \cdot \left(a + 1\right), b \cdot \left(b \cdot \left(1 + a \cdot -3\right)\right)\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) + -1\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{2} \cdot \left(4 + \left(2 \cdot {b}^{2} + a \cdot \left(a + 4\right)\right)\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (+.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (-.f64 #s(literal 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) < +inf.0Initial program 99.9%
associate--l+99.8%
+-commutative99.8%
+-commutative99.8%
sub-neg99.8%
associate-+l+99.8%
+-commutative99.8%
associate-+l+99.9%
Simplified99.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 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) Initial program 0.0%
associate--l+0.0%
+-commutative0.0%
+-commutative0.0%
sub-neg0.0%
associate-+l+0.0%
+-commutative0.0%
associate-+l+0.0%
Simplified5.3%
Taylor expanded in a around -inf 100.0%
Taylor expanded in a around 0 100.0%
Final simplification99.9%
(FPCore (a b)
:precision binary64
(if (<=
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))
INFINITY)
(+
-1.0
(+
(pow (fma a a (* b b)) 2.0)
(* 4.0 (fma (* a a) (+ a 1.0) (* b (* b (+ 1.0 (* a -3.0))))))))
(+ -1.0 (* (pow a 2.0) (+ 4.0 (+ (* 2.0 (pow b 2.0)) (* a (+ a 4.0))))))))
double code(double a, double b) {
double tmp;
if ((pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))))) <= ((double) INFINITY)) {
tmp = -1.0 + (pow(fma(a, a, (b * b)), 2.0) + (4.0 * fma((a * a), (a + 1.0), (b * (b * (1.0 + (a * -3.0)))))));
} else {
tmp = -1.0 + (pow(a, 2.0) * (4.0 + ((2.0 * pow(b, 2.0)) + (a * (a + 4.0)))));
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(a + 1.0)) + Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0)))))) <= Inf) tmp = Float64(-1.0 + Float64((fma(a, a, Float64(b * b)) ^ 2.0) + Float64(4.0 * fma(Float64(a * a), Float64(a + 1.0), Float64(b * Float64(b * Float64(1.0 + Float64(a * -3.0)))))))); else tmp = Float64(-1.0 + Float64((a ^ 2.0) * Float64(4.0 + Float64(Float64(2.0 * (b ^ 2.0)) + Float64(a * Float64(a + 4.0)))))); end return tmp end
code[a_, b_] := If[LessEqual[N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(-1.0 + N[(N[Power[N[(a * a + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision] + N[(b * N[(b * N[(1.0 + N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[Power[a, 2.0], $MachinePrecision] * N[(4.0 + N[(N[(2.0 * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right) \leq \infty:\\
\;\;\;\;-1 + \left({\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + 4 \cdot \mathsf{fma}\left(a \cdot a, a + 1, b \cdot \left(b \cdot \left(1 + a \cdot -3\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{2} \cdot \left(4 + \left(2 \cdot {b}^{2} + a \cdot \left(a + 4\right)\right)\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (+.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (-.f64 #s(literal 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) < +inf.0Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
fma-define99.9%
+-commutative99.9%
associate-*l*99.9%
cancel-sign-sub-inv99.9%
metadata-eval99.9%
fma-define99.9%
metadata-eval99.9%
Simplified99.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 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) Initial program 0.0%
associate--l+0.0%
+-commutative0.0%
+-commutative0.0%
sub-neg0.0%
associate-+l+0.0%
+-commutative0.0%
associate-+l+0.0%
Simplified5.3%
Taylor expanded in a around -inf 100.0%
Taylor expanded in a around 0 100.0%
Final simplification99.9%
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))))
(if (<= t_0 INFINITY)
(+ t_0 -1.0)
(+
-1.0
(* (pow a 2.0) (+ 4.0 (+ (* 2.0 (pow b 2.0)) (* a (+ a 4.0)))))))))
double code(double a, double b) {
double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 + -1.0;
} else {
tmp = -1.0 + (pow(a, 2.0) * (4.0 + ((2.0 * pow(b, 2.0)) + (a * (a + 4.0)))));
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 + -1.0;
} else {
tmp = -1.0 + (Math.pow(a, 2.0) * (4.0 + ((2.0 * Math.pow(b, 2.0)) + (a * (a + 4.0)))));
}
return tmp;
}
def code(a, b): t_0 = math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0))))) tmp = 0 if t_0 <= math.inf: tmp = t_0 + -1.0 else: tmp = -1.0 + (math.pow(a, 2.0) * (4.0 + ((2.0 * math.pow(b, 2.0)) + (a * (a + 4.0))))) return tmp
function code(a, b) t_0 = Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(a + 1.0)) + Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0)))))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 + -1.0); else tmp = Float64(-1.0 + Float64((a ^ 2.0) * Float64(4.0 + Float64(Float64(2.0 * (b ^ 2.0)) + Float64(a * Float64(a + 4.0)))))); end return tmp end
function tmp_2 = code(a, b) t_0 = (((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0))))); tmp = 0.0; if (t_0 <= Inf) tmp = t_0 + -1.0; else tmp = -1.0 + ((a ^ 2.0) * (4.0 + ((2.0 * (b ^ 2.0)) + (a * (a + 4.0))))); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 + -1.0), $MachinePrecision], N[(-1.0 + N[(N[Power[a, 2.0], $MachinePrecision] * N[(4.0 + N[(N[(2.0 * N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right)\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 + -1\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{2} \cdot \left(4 + \left(2 \cdot {b}^{2} + a \cdot \left(a + 4\right)\right)\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (+.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (-.f64 #s(literal 1 binary64) (*.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 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) Initial program 0.0%
associate--l+0.0%
+-commutative0.0%
+-commutative0.0%
sub-neg0.0%
associate-+l+0.0%
+-commutative0.0%
associate-+l+0.0%
Simplified5.3%
Taylor expanded in a around -inf 100.0%
Taylor expanded in a around 0 100.0%
Final simplification99.9%
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))))
(if (<= t_0 INFINITY)
(+ t_0 -1.0)
(+ -1.0 (* (pow a 2.0) (+ 4.0 (* a (+ a 4.0))))))))
double code(double a, double b) {
double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 + -1.0;
} else {
tmp = -1.0 + (pow(a, 2.0) * (4.0 + (a * (a + 4.0))));
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 + -1.0;
} else {
tmp = -1.0 + (Math.pow(a, 2.0) * (4.0 + (a * (a + 4.0))));
}
return tmp;
}
def code(a, b): t_0 = math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0))))) tmp = 0 if t_0 <= math.inf: tmp = t_0 + -1.0 else: tmp = -1.0 + (math.pow(a, 2.0) * (4.0 + (a * (a + 4.0)))) return tmp
function code(a, b) t_0 = Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(a + 1.0)) + Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0)))))) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 + -1.0); else tmp = Float64(-1.0 + Float64((a ^ 2.0) * Float64(4.0 + Float64(a * Float64(a + 4.0))))); end return tmp end
function tmp_2 = code(a, b) t_0 = (((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0))))); tmp = 0.0; if (t_0 <= Inf) tmp = t_0 + -1.0; else tmp = -1.0 + ((a ^ 2.0) * (4.0 + (a * (a + 4.0)))); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 + -1.0), $MachinePrecision], N[(-1.0 + N[(N[Power[a, 2.0], $MachinePrecision] * N[(4.0 + N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right)\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 + -1\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{2} \cdot \left(4 + a \cdot \left(a + 4\right)\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (+.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (-.f64 #s(literal 1 binary64) (*.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 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) Initial program 0.0%
associate--l+0.0%
+-commutative0.0%
+-commutative0.0%
sub-neg0.0%
associate-+l+0.0%
+-commutative0.0%
associate-+l+0.0%
Simplified5.3%
Taylor expanded in a around -inf 100.0%
Taylor expanded in a around 0 100.0%
Taylor expanded in b around 0 95.0%
+-commutative95.0%
Simplified95.0%
Final simplification98.4%
(FPCore (a b)
:precision binary64
(if (<= a -3.7e+74)
(pow a 4.0)
(if (<= a 5500000.0)
(+ -1.0 (pow b 4.0))
(+ -1.0 (* (pow a 4.0) (- 1.0 (/ (+ -4.0 (/ -4.0 a)) a)))))))
double code(double a, double b) {
double tmp;
if (a <= -3.7e+74) {
tmp = pow(a, 4.0);
} else if (a <= 5500000.0) {
tmp = -1.0 + pow(b, 4.0);
} else {
tmp = -1.0 + (pow(a, 4.0) * (1.0 - ((-4.0 + (-4.0 / a)) / a)));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-3.7d+74)) then
tmp = a ** 4.0d0
else if (a <= 5500000.0d0) then
tmp = (-1.0d0) + (b ** 4.0d0)
else
tmp = (-1.0d0) + ((a ** 4.0d0) * (1.0d0 - (((-4.0d0) + ((-4.0d0) / a)) / a)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -3.7e+74) {
tmp = Math.pow(a, 4.0);
} else if (a <= 5500000.0) {
tmp = -1.0 + Math.pow(b, 4.0);
} else {
tmp = -1.0 + (Math.pow(a, 4.0) * (1.0 - ((-4.0 + (-4.0 / a)) / a)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -3.7e+74: tmp = math.pow(a, 4.0) elif a <= 5500000.0: tmp = -1.0 + math.pow(b, 4.0) else: tmp = -1.0 + (math.pow(a, 4.0) * (1.0 - ((-4.0 + (-4.0 / a)) / a))) return tmp
function code(a, b) tmp = 0.0 if (a <= -3.7e+74) tmp = a ^ 4.0; elseif (a <= 5500000.0) tmp = Float64(-1.0 + (b ^ 4.0)); else tmp = Float64(-1.0 + Float64((a ^ 4.0) * Float64(1.0 - Float64(Float64(-4.0 + Float64(-4.0 / a)) / a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -3.7e+74) tmp = a ^ 4.0; elseif (a <= 5500000.0) tmp = -1.0 + (b ^ 4.0); else tmp = -1.0 + ((a ^ 4.0) * (1.0 - ((-4.0 + (-4.0 / a)) / a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -3.7e+74], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 5500000.0], N[(-1.0 + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 - N[(N[(-4.0 + N[(-4.0 / a), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.7 \cdot 10^{+74}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 5500000:\\
\;\;\;\;-1 + {b}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4} \cdot \left(1 - \frac{-4 + \frac{-4}{a}}{a}\right)\\
\end{array}
\end{array}
if a < -3.7000000000000001e74Initial program 1.9%
associate--l+1.9%
+-commutative1.9%
+-commutative1.9%
sub-neg1.9%
associate-+l+1.9%
+-commutative1.9%
associate-+l+1.9%
Simplified9.4%
Taylor expanded in a around inf 100.0%
Taylor expanded in a around inf 100.0%
if -3.7000000000000001e74 < a < 5.5e6Initial program 99.1%
associate--l+99.1%
+-commutative99.1%
+-commutative99.1%
sub-neg99.1%
associate-+l+99.1%
+-commutative99.1%
associate-+l+99.1%
Simplified99.2%
Taylor expanded in b around inf 96.3%
if 5.5e6 < a Initial program 64.5%
associate--l+64.5%
+-commutative64.5%
+-commutative64.5%
sub-neg64.5%
associate-+l+64.5%
+-commutative64.5%
associate-+l+64.5%
Simplified64.5%
Taylor expanded in a around -inf 98.7%
Taylor expanded in b around 0 92.7%
associate-*r/92.7%
associate-*r/92.7%
metadata-eval92.7%
distribute-lft-in92.7%
metadata-eval92.7%
associate-*r/92.7%
metadata-eval92.7%
Simplified92.7%
Final simplification96.2%
(FPCore (a b)
:precision binary64
(if (<= a -6.9e+74)
(pow a 4.0)
(if (<= a 6.2)
(+ -1.0 (pow b 4.0))
(+ -1.0 (* (pow a 2.0) (+ 4.0 (* a (+ a 4.0))))))))
double code(double a, double b) {
double tmp;
if (a <= -6.9e+74) {
tmp = pow(a, 4.0);
} else if (a <= 6.2) {
tmp = -1.0 + pow(b, 4.0);
} else {
tmp = -1.0 + (pow(a, 2.0) * (4.0 + (a * (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 <= (-6.9d+74)) then
tmp = a ** 4.0d0
else if (a <= 6.2d0) then
tmp = (-1.0d0) + (b ** 4.0d0)
else
tmp = (-1.0d0) + ((a ** 2.0d0) * (4.0d0 + (a * (a + 4.0d0))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -6.9e+74) {
tmp = Math.pow(a, 4.0);
} else if (a <= 6.2) {
tmp = -1.0 + Math.pow(b, 4.0);
} else {
tmp = -1.0 + (Math.pow(a, 2.0) * (4.0 + (a * (a + 4.0))));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -6.9e+74: tmp = math.pow(a, 4.0) elif a <= 6.2: tmp = -1.0 + math.pow(b, 4.0) else: tmp = -1.0 + (math.pow(a, 2.0) * (4.0 + (a * (a + 4.0)))) return tmp
function code(a, b) tmp = 0.0 if (a <= -6.9e+74) tmp = a ^ 4.0; elseif (a <= 6.2) tmp = Float64(-1.0 + (b ^ 4.0)); else tmp = Float64(-1.0 + Float64((a ^ 2.0) * Float64(4.0 + Float64(a * Float64(a + 4.0))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -6.9e+74) tmp = a ^ 4.0; elseif (a <= 6.2) tmp = -1.0 + (b ^ 4.0); else tmp = -1.0 + ((a ^ 2.0) * (4.0 + (a * (a + 4.0)))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -6.9e+74], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 6.2], N[(-1.0 + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[Power[a, 2.0], $MachinePrecision] * N[(4.0 + N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.9 \cdot 10^{+74}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 6.2:\\
\;\;\;\;-1 + {b}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{2} \cdot \left(4 + a \cdot \left(a + 4\right)\right)\\
\end{array}
\end{array}
if a < -6.8999999999999996e74Initial program 1.9%
associate--l+1.9%
+-commutative1.9%
+-commutative1.9%
sub-neg1.9%
associate-+l+1.9%
+-commutative1.9%
associate-+l+1.9%
Simplified9.4%
Taylor expanded in a around inf 100.0%
Taylor expanded in a around inf 100.0%
if -6.8999999999999996e74 < a < 6.20000000000000018Initial program 99.1%
associate--l+99.1%
+-commutative99.1%
+-commutative99.1%
sub-neg99.1%
associate-+l+99.1%
+-commutative99.1%
associate-+l+99.1%
Simplified99.2%
Taylor expanded in b around inf 96.3%
if 6.20000000000000018 < a Initial program 64.5%
associate--l+64.5%
+-commutative64.5%
+-commutative64.5%
sub-neg64.5%
associate-+l+64.5%
+-commutative64.5%
associate-+l+64.5%
Simplified64.5%
Taylor expanded in a around -inf 98.7%
Taylor expanded in a around 0 98.7%
Taylor expanded in b around 0 92.7%
+-commutative92.7%
Simplified92.7%
Final simplification96.2%
(FPCore (a b)
:precision binary64
(if (<= a -1.24e+58)
(pow a 4.0)
(if (<= a 4500000.0)
(+ -1.0 (pow b 4.0))
(+ -1.0 (* (pow a 4.0) (+ 1.0 (/ 4.0 a)))))))
double code(double a, double b) {
double tmp;
if (a <= -1.24e+58) {
tmp = pow(a, 4.0);
} else if (a <= 4500000.0) {
tmp = -1.0 + pow(b, 4.0);
} else {
tmp = -1.0 + (pow(a, 4.0) * (1.0 + (4.0 / a)));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-1.24d+58)) then
tmp = a ** 4.0d0
else if (a <= 4500000.0d0) then
tmp = (-1.0d0) + (b ** 4.0d0)
else
tmp = (-1.0d0) + ((a ** 4.0d0) * (1.0d0 + (4.0d0 / a)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -1.24e+58) {
tmp = Math.pow(a, 4.0);
} else if (a <= 4500000.0) {
tmp = -1.0 + Math.pow(b, 4.0);
} else {
tmp = -1.0 + (Math.pow(a, 4.0) * (1.0 + (4.0 / a)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -1.24e+58: tmp = math.pow(a, 4.0) elif a <= 4500000.0: tmp = -1.0 + math.pow(b, 4.0) else: tmp = -1.0 + (math.pow(a, 4.0) * (1.0 + (4.0 / a))) return tmp
function code(a, b) tmp = 0.0 if (a <= -1.24e+58) tmp = a ^ 4.0; elseif (a <= 4500000.0) tmp = Float64(-1.0 + (b ^ 4.0)); else tmp = Float64(-1.0 + Float64((a ^ 4.0) * Float64(1.0 + Float64(4.0 / a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -1.24e+58) tmp = a ^ 4.0; elseif (a <= 4500000.0) tmp = -1.0 + (b ^ 4.0); else tmp = -1.0 + ((a ^ 4.0) * (1.0 + (4.0 / a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -1.24e+58], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 4500000.0], N[(-1.0 + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 + N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.24 \cdot 10^{+58}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 4500000:\\
\;\;\;\;-1 + {b}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4} \cdot \left(1 + \frac{4}{a}\right)\\
\end{array}
\end{array}
if a < -1.24000000000000005e58Initial program 1.9%
associate--l+1.9%
+-commutative1.9%
+-commutative1.9%
sub-neg1.9%
associate-+l+1.9%
+-commutative1.9%
associate-+l+1.9%
Simplified9.4%
Taylor expanded in a around inf 100.0%
Taylor expanded in a around inf 100.0%
if -1.24000000000000005e58 < a < 4.5e6Initial program 99.1%
associate--l+99.1%
+-commutative99.1%
+-commutative99.1%
sub-neg99.1%
associate-+l+99.1%
+-commutative99.1%
associate-+l+99.1%
Simplified99.2%
Taylor expanded in b around inf 96.3%
if 4.5e6 < a Initial program 64.5%
associate--l+64.5%
+-commutative64.5%
+-commutative64.5%
sub-neg64.5%
associate-+l+64.5%
+-commutative64.5%
associate-+l+64.5%
Simplified64.5%
Taylor expanded in a around inf 92.6%
associate-*r/92.6%
metadata-eval92.6%
Simplified92.6%
Final simplification96.1%
(FPCore (a b)
:precision binary64
(if (<= a -6.6e+58)
(pow a 4.0)
(if (<= a 140000.0)
(+ -1.0 (pow b 4.0))
(+ -1.0 (* (+ a 4.0) (pow a 3.0))))))
double code(double a, double b) {
double tmp;
if (a <= -6.6e+58) {
tmp = pow(a, 4.0);
} else if (a <= 140000.0) {
tmp = -1.0 + pow(b, 4.0);
} else {
tmp = -1.0 + ((a + 4.0) * pow(a, 3.0));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-6.6d+58)) then
tmp = a ** 4.0d0
else if (a <= 140000.0d0) then
tmp = (-1.0d0) + (b ** 4.0d0)
else
tmp = (-1.0d0) + ((a + 4.0d0) * (a ** 3.0d0))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -6.6e+58) {
tmp = Math.pow(a, 4.0);
} else if (a <= 140000.0) {
tmp = -1.0 + Math.pow(b, 4.0);
} else {
tmp = -1.0 + ((a + 4.0) * Math.pow(a, 3.0));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -6.6e+58: tmp = math.pow(a, 4.0) elif a <= 140000.0: tmp = -1.0 + math.pow(b, 4.0) else: tmp = -1.0 + ((a + 4.0) * math.pow(a, 3.0)) return tmp
function code(a, b) tmp = 0.0 if (a <= -6.6e+58) tmp = a ^ 4.0; elseif (a <= 140000.0) tmp = Float64(-1.0 + (b ^ 4.0)); else tmp = Float64(-1.0 + Float64(Float64(a + 4.0) * (a ^ 3.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -6.6e+58) tmp = a ^ 4.0; elseif (a <= 140000.0) tmp = -1.0 + (b ^ 4.0); else tmp = -1.0 + ((a + 4.0) * (a ^ 3.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -6.6e+58], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 140000.0], N[(-1.0 + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(a + 4.0), $MachinePrecision] * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.6 \cdot 10^{+58}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 140000:\\
\;\;\;\;-1 + {b}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(a + 4\right) \cdot {a}^{3}\\
\end{array}
\end{array}
if a < -6.59999999999999966e58Initial program 1.9%
associate--l+1.9%
+-commutative1.9%
+-commutative1.9%
sub-neg1.9%
associate-+l+1.9%
+-commutative1.9%
associate-+l+1.9%
Simplified9.4%
Taylor expanded in a around inf 100.0%
Taylor expanded in a around inf 100.0%
if -6.59999999999999966e58 < a < 1.4e5Initial program 99.1%
associate--l+99.1%
+-commutative99.1%
+-commutative99.1%
sub-neg99.1%
associate-+l+99.1%
+-commutative99.1%
associate-+l+99.1%
Simplified99.2%
Taylor expanded in b around inf 96.3%
if 1.4e5 < a Initial program 64.5%
associate--l+64.5%
+-commutative64.5%
+-commutative64.5%
sub-neg64.5%
associate-+l+64.5%
+-commutative64.5%
associate-+l+64.5%
Simplified64.5%
Taylor expanded in a around inf 92.6%
associate-*r/92.6%
metadata-eval92.6%
Simplified92.6%
Taylor expanded in a around 0 92.6%
Final simplification96.1%
(FPCore (a b) :precision binary64 (if (or (<= a -4.8e+53) (not (<= a 14500000.0))) (pow a 4.0) (+ -1.0 (pow b 4.0))))
double code(double a, double b) {
double tmp;
if ((a <= -4.8e+53) || !(a <= 14500000.0)) {
tmp = pow(a, 4.0);
} else {
tmp = -1.0 + 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 ((a <= (-4.8d+53)) .or. (.not. (a <= 14500000.0d0))) then
tmp = a ** 4.0d0
else
tmp = (-1.0d0) + (b ** 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -4.8e+53) || !(a <= 14500000.0)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = -1.0 + Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -4.8e+53) or not (a <= 14500000.0): tmp = math.pow(a, 4.0) else: tmp = -1.0 + math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if ((a <= -4.8e+53) || !(a <= 14500000.0)) tmp = a ^ 4.0; else tmp = Float64(-1.0 + (b ^ 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -4.8e+53) || ~((a <= 14500000.0))) tmp = a ^ 4.0; else tmp = -1.0 + (b ^ 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -4.8e+53], N[Not[LessEqual[a, 14500000.0]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(-1.0 + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.8 \cdot 10^{+53} \lor \neg \left(a \leq 14500000\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1 + {b}^{4}\\
\end{array}
\end{array}
if a < -4.8e53 or 1.45e7 < a Initial program 36.4%
associate--l+36.4%
+-commutative36.4%
+-commutative36.4%
sub-neg36.4%
associate-+l+36.4%
+-commutative36.4%
associate-+l+36.4%
Simplified39.8%
Taylor expanded in a around inf 95.6%
Taylor expanded in a around inf 95.6%
if -4.8e53 < a < 1.45e7Initial program 99.1%
associate--l+99.1%
+-commutative99.1%
+-commutative99.1%
sub-neg99.1%
associate-+l+99.1%
+-commutative99.1%
associate-+l+99.1%
Simplified99.2%
Taylor expanded in b around inf 96.3%
Final simplification96.0%
(FPCore (a b) :precision binary64 (if (or (<= a -2.0) (not (<= a 4.2e-55))) (pow a 4.0) -1.0))
double code(double a, double b) {
double tmp;
if ((a <= -2.0) || !(a <= 4.2e-55)) {
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.0d0)) .or. (.not. (a <= 4.2d-55))) 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.0) || !(a <= 4.2e-55)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -2.0) or not (a <= 4.2e-55): tmp = math.pow(a, 4.0) else: tmp = -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -2.0) || !(a <= 4.2e-55)) tmp = a ^ 4.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -2.0) || ~((a <= 4.2e-55))) tmp = a ^ 4.0; else tmp = -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -2.0], N[Not[LessEqual[a, 4.2e-55]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], -1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \lor \neg \left(a \leq 4.2 \cdot 10^{-55}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if a < -2 or 4.2000000000000003e-55 < a Initial program 44.0%
associate--l+44.0%
+-commutative44.0%
+-commutative44.0%
sub-neg44.0%
associate-+l+44.0%
+-commutative44.0%
associate-+l+44.0%
Simplified47.0%
Taylor expanded in a around inf 85.5%
Taylor expanded in a around inf 85.6%
if -2 < a < 4.2000000000000003e-55Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
+-commutative99.9%
sub-neg99.9%
associate-+l+99.9%
+-commutative99.9%
associate-+l+99.9%
Simplified99.9%
Taylor expanded in a around inf 49.3%
Taylor expanded in a around 0 49.3%
Final simplification68.6%
(FPCore (a b) :precision binary64 (+ -1.0 (pow a 4.0)))
double code(double a, double b) {
return -1.0 + pow(a, 4.0);
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (-1.0d0) + (a ** 4.0d0)
end function
public static double code(double a, double b) {
return -1.0 + Math.pow(a, 4.0);
}
def code(a, b): return -1.0 + math.pow(a, 4.0)
function code(a, b) return Float64(-1.0 + (a ^ 4.0)) end
function tmp = code(a, b) tmp = -1.0 + (a ^ 4.0); end
code[a_, b_] := N[(-1.0 + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1 + {a}^{4}
\end{array}
Initial program 70.2%
associate--l+70.2%
+-commutative70.2%
+-commutative70.2%
sub-neg70.2%
associate-+l+70.2%
+-commutative70.2%
associate-+l+70.2%
Simplified71.8%
Taylor expanded in a around inf 68.5%
Final simplification68.5%
(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 70.2%
associate--l+70.2%
+-commutative70.2%
+-commutative70.2%
sub-neg70.2%
associate-+l+70.2%
+-commutative70.2%
associate-+l+70.2%
Simplified71.8%
Taylor expanded in a around inf 68.5%
Taylor expanded in a around 0 23.5%
herbie shell --seed 2024085
(FPCore (a b)
:name "Bouland and Aaronson, Equation (25)"
:precision binary64
(- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 3.0 a)))))) 1.0))