
(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 16 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)
(+
(+
(* 4.0 (fma (* a a) (+ a 1.0) (* b (* b (+ 1.0 (* a -3.0))))))
(+ (pow b 4.0) (fma 2.0 (* (* a b) (* a b)) (pow a 4.0))))
-1.0)
(+
-1.0
(+
(pow b 4.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 = ((4.0 * fma((a * a), (a + 1.0), (b * (b * (1.0 + (a * -3.0)))))) + (pow(b, 4.0) + fma(2.0, ((a * b) * (a * b)), pow(a, 4.0)))) + -1.0;
} else {
tmp = -1.0 + (pow(b, 4.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(Float64(Float64(4.0 * fma(Float64(a * a), Float64(a + 1.0), Float64(b * Float64(b * Float64(1.0 + Float64(a * -3.0)))))) + Float64((b ^ 4.0) + fma(2.0, Float64(Float64(a * b) * Float64(a * b)), (a ^ 4.0)))) + -1.0); else tmp = Float64(-1.0 + Float64((b ^ 4.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[(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] + N[(N[Power[b, 4.0], $MachinePrecision] + N[(2.0 * N[(N[(a * b), $MachinePrecision] * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(-1.0 + N[(N[Power[b, 4.0], $MachinePrecision] + 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]), $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:\\
\;\;\;\;\left(4 \cdot \mathsf{fma}\left(a \cdot a, a + 1, b \cdot \left(b \cdot \left(1 + a \cdot -3\right)\right)\right) + \left({b}^{4} + \mathsf{fma}\left(2, \left(a \cdot b\right) \cdot \left(a \cdot b\right), {a}^{4}\right)\right)\right) + -1\\
\mathbf{else}:\\
\;\;\;\;-1 + \left({b}^{4} + {a}^{2} \cdot \left(4 + \left(2 \cdot {b}^{2} + a \cdot \left(a + 4\right)\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.7%
sub-neg99.7%
Simplified99.7%
Taylor expanded in a around 0 94.2%
+-commutative94.2%
distribute-lft-in87.4%
associate-*r*87.4%
*-commutative87.4%
associate-*r*87.4%
pow-sqr87.5%
metadata-eval87.5%
fma-define87.5%
unpow287.5%
unpow287.5%
swap-sqr100.0%
unpow2100.0%
Simplified100.0%
unpow2100.0%
*-commutative100.0%
*-commutative100.0%
Applied egg-rr100.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 1 binary64) (*.f64 #s(literal 3 binary64) a)))))) Initial program 0.0%
sub-neg0.0%
Simplified7.8%
Taylor expanded in a around 0 7.8%
+-commutative7.8%
distribute-lft-in7.8%
associate-*r*7.8%
*-commutative7.8%
associate-*r*7.8%
pow-sqr7.8%
metadata-eval7.8%
fma-define7.8%
unpow27.8%
unpow27.8%
swap-sqr7.8%
unpow27.8%
Simplified7.8%
unpow27.8%
*-commutative7.8%
*-commutative7.8%
Applied egg-rr7.8%
Taylor expanded in b around 0 43.8%
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) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))))
(if (<= t_0 INFINITY)
(+ t_0 -1.0)
(+
-1.0
(+
(pow b 4.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(b, 4.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(b, 4.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(b, 4.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((b ^ 4.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 + ((b ^ 4.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[b, 4.0], $MachinePrecision] + 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]), $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 + \left({b}^{4} + {a}^{2} \cdot \left(4 + \left(2 \cdot {b}^{2} + a \cdot \left(a + 4\right)\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.7%
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%
sub-neg0.0%
Simplified7.8%
Taylor expanded in a around 0 7.8%
+-commutative7.8%
distribute-lft-in7.8%
associate-*r*7.8%
*-commutative7.8%
associate-*r*7.8%
pow-sqr7.8%
metadata-eval7.8%
fma-define7.8%
unpow27.8%
unpow27.8%
swap-sqr7.8%
unpow27.8%
Simplified7.8%
unpow27.8%
*-commutative7.8%
*-commutative7.8%
Applied egg-rr7.8%
Taylor expanded in b around 0 43.8%
Taylor expanded in a around 0 100.0%
Final simplification99.8%
(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) (* (pow a 4.0) (+ 1.0 (/ 4.0 a))))))
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 = pow(a, 4.0) * (1.0 + (4.0 / a));
}
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 = Math.pow(a, 4.0) * (1.0 + (4.0 / a));
}
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 = math.pow(a, 4.0) * (1.0 + (4.0 / a)) 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((a ^ 4.0) * Float64(1.0 + Float64(4.0 / a))); 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 = (a ^ 4.0) * (1.0 + (4.0 / a)); 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[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 + N[(4.0 / a), $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}:\\
\;\;\;\;{a}^{4} \cdot \left(1 + \frac{4}{a}\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.7%
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%
Simplified6.3%
Taylor expanded in a around inf 94.2%
associate-*r/94.2%
metadata-eval94.2%
Simplified94.2%
Final simplification98.3%
(FPCore (a b)
:precision binary64
(if (<= a -170000000000.0)
(* (pow a 4.0) (+ 1.0 (/ 4.0 a)))
(if (<= a 2650000000.0)
(+ -1.0 (+ (pow b 4.0) (* (* b b) 4.0)))
(* (pow a 4.0) (+ -1.0 (+ 2.0 (/ 4.0 a)))))))
double code(double a, double b) {
double tmp;
if (a <= -170000000000.0) {
tmp = pow(a, 4.0) * (1.0 + (4.0 / a));
} else if (a <= 2650000000.0) {
tmp = -1.0 + (pow(b, 4.0) + ((b * b) * 4.0));
} else {
tmp = pow(a, 4.0) * (-1.0 + (2.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 <= (-170000000000.0d0)) then
tmp = (a ** 4.0d0) * (1.0d0 + (4.0d0 / a))
else if (a <= 2650000000.0d0) then
tmp = (-1.0d0) + ((b ** 4.0d0) + ((b * b) * 4.0d0))
else
tmp = (a ** 4.0d0) * ((-1.0d0) + (2.0d0 + (4.0d0 / a)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -170000000000.0) {
tmp = Math.pow(a, 4.0) * (1.0 + (4.0 / a));
} else if (a <= 2650000000.0) {
tmp = -1.0 + (Math.pow(b, 4.0) + ((b * b) * 4.0));
} else {
tmp = Math.pow(a, 4.0) * (-1.0 + (2.0 + (4.0 / a)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -170000000000.0: tmp = math.pow(a, 4.0) * (1.0 + (4.0 / a)) elif a <= 2650000000.0: tmp = -1.0 + (math.pow(b, 4.0) + ((b * b) * 4.0)) else: tmp = math.pow(a, 4.0) * (-1.0 + (2.0 + (4.0 / a))) return tmp
function code(a, b) tmp = 0.0 if (a <= -170000000000.0) tmp = Float64((a ^ 4.0) * Float64(1.0 + Float64(4.0 / a))); elseif (a <= 2650000000.0) tmp = Float64(-1.0 + Float64((b ^ 4.0) + Float64(Float64(b * b) * 4.0))); else tmp = Float64((a ^ 4.0) * Float64(-1.0 + Float64(2.0 + Float64(4.0 / a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -170000000000.0) tmp = (a ^ 4.0) * (1.0 + (4.0 / a)); elseif (a <= 2650000000.0) tmp = -1.0 + ((b ^ 4.0) + ((b * b) * 4.0)); else tmp = (a ^ 4.0) * (-1.0 + (2.0 + (4.0 / a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -170000000000.0], N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 + N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2650000000.0], N[(-1.0 + N[(N[Power[b, 4.0], $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a, 4.0], $MachinePrecision] * N[(-1.0 + N[(2.0 + N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -170000000000:\\
\;\;\;\;{a}^{4} \cdot \left(1 + \frac{4}{a}\right)\\
\mathbf{elif}\;a \leq 2650000000:\\
\;\;\;\;-1 + \left({b}^{4} + \left(b \cdot b\right) \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;{a}^{4} \cdot \left(-1 + \left(2 + \frac{4}{a}\right)\right)\\
\end{array}
\end{array}
if a < -1.7e11Initial program 29.2%
associate--l+29.2%
+-commutative29.2%
+-commutative29.2%
sub-neg29.2%
associate-+l+29.2%
+-commutative29.2%
associate-+l+29.2%
Simplified29.2%
Taylor expanded in a around inf 98.1%
associate-*r/98.1%
metadata-eval98.1%
Simplified98.1%
if -1.7e11 < a < 2.65e9Initial program 99.8%
associate--l+99.8%
+-commutative99.8%
+-commutative99.8%
sub-neg99.8%
associate-+l+99.8%
+-commutative99.8%
associate-+l+99.8%
Simplified99.8%
Taylor expanded in a around 0 99.0%
unpow299.0%
Applied egg-rr99.0%
if 2.65e9 < a Initial program 56.1%
associate--l+56.1%
+-commutative56.1%
+-commutative56.1%
sub-neg56.1%
associate-+l+56.1%
+-commutative56.1%
associate-+l+56.1%
Simplified62.4%
Taylor expanded in a around inf 91.2%
associate-*r/91.2%
metadata-eval91.2%
Simplified91.2%
expm1-log1p-u91.2%
expm1-undefine91.2%
Applied egg-rr91.2%
sub-neg91.2%
metadata-eval91.2%
+-commutative91.2%
log1p-undefine91.2%
rem-exp-log91.2%
associate-+r+91.2%
metadata-eval91.2%
Simplified91.2%
Final simplification96.9%
(FPCore (a b)
:precision binary64
(if (<= a -105000000000.0)
(* (pow a 4.0) (+ 1.0 (/ 4.0 a)))
(if (<= a 42000000.0)
(+ (pow b 4.0) -1.0)
(* (pow a 4.0) (+ -1.0 (+ 2.0 (/ 4.0 a)))))))
double code(double a, double b) {
double tmp;
if (a <= -105000000000.0) {
tmp = pow(a, 4.0) * (1.0 + (4.0 / a));
} else if (a <= 42000000.0) {
tmp = pow(b, 4.0) + -1.0;
} else {
tmp = pow(a, 4.0) * (-1.0 + (2.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 <= (-105000000000.0d0)) then
tmp = (a ** 4.0d0) * (1.0d0 + (4.0d0 / a))
else if (a <= 42000000.0d0) then
tmp = (b ** 4.0d0) + (-1.0d0)
else
tmp = (a ** 4.0d0) * ((-1.0d0) + (2.0d0 + (4.0d0 / a)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -105000000000.0) {
tmp = Math.pow(a, 4.0) * (1.0 + (4.0 / a));
} else if (a <= 42000000.0) {
tmp = Math.pow(b, 4.0) + -1.0;
} else {
tmp = Math.pow(a, 4.0) * (-1.0 + (2.0 + (4.0 / a)));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -105000000000.0: tmp = math.pow(a, 4.0) * (1.0 + (4.0 / a)) elif a <= 42000000.0: tmp = math.pow(b, 4.0) + -1.0 else: tmp = math.pow(a, 4.0) * (-1.0 + (2.0 + (4.0 / a))) return tmp
function code(a, b) tmp = 0.0 if (a <= -105000000000.0) tmp = Float64((a ^ 4.0) * Float64(1.0 + Float64(4.0 / a))); elseif (a <= 42000000.0) tmp = Float64((b ^ 4.0) + -1.0); else tmp = Float64((a ^ 4.0) * Float64(-1.0 + Float64(2.0 + Float64(4.0 / a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -105000000000.0) tmp = (a ^ 4.0) * (1.0 + (4.0 / a)); elseif (a <= 42000000.0) tmp = (b ^ 4.0) + -1.0; else tmp = (a ^ 4.0) * (-1.0 + (2.0 + (4.0 / a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -105000000000.0], N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 + N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 42000000.0], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[a, 4.0], $MachinePrecision] * N[(-1.0 + N[(2.0 + N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -105000000000:\\
\;\;\;\;{a}^{4} \cdot \left(1 + \frac{4}{a}\right)\\
\mathbf{elif}\;a \leq 42000000:\\
\;\;\;\;{b}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4} \cdot \left(-1 + \left(2 + \frac{4}{a}\right)\right)\\
\end{array}
\end{array}
if a < -1.05e11Initial program 29.2%
associate--l+29.2%
+-commutative29.2%
+-commutative29.2%
sub-neg29.2%
associate-+l+29.2%
+-commutative29.2%
associate-+l+29.2%
Simplified29.2%
Taylor expanded in a around inf 98.1%
associate-*r/98.1%
metadata-eval98.1%
Simplified98.1%
if -1.05e11 < a < 4.2e7Initial program 99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in a around 0 92.2%
+-commutative92.2%
distribute-lft-in92.2%
associate-*r*92.2%
*-commutative92.2%
associate-*r*92.2%
pow-sqr92.2%
metadata-eval92.2%
fma-define92.2%
unpow292.2%
unpow292.2%
swap-sqr100.0%
unpow2100.0%
Simplified100.0%
unpow2100.0%
*-commutative100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in b around inf 98.2%
if 4.2e7 < a Initial program 56.1%
associate--l+56.1%
+-commutative56.1%
+-commutative56.1%
sub-neg56.1%
associate-+l+56.1%
+-commutative56.1%
associate-+l+56.1%
Simplified62.4%
Taylor expanded in a around inf 91.2%
associate-*r/91.2%
metadata-eval91.2%
Simplified91.2%
expm1-log1p-u91.2%
expm1-undefine91.2%
Applied egg-rr91.2%
sub-neg91.2%
metadata-eval91.2%
+-commutative91.2%
log1p-undefine91.2%
rem-exp-log91.2%
associate-+r+91.2%
metadata-eval91.2%
Simplified91.2%
(FPCore (a b) :precision binary64 (if (or (<= a -80000000000.0) (not (<= a 180000000000.0))) (* (pow a 4.0) (+ 1.0 (/ 4.0 a))) (+ (pow b 4.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -80000000000.0) || !(a <= 180000000000.0)) {
tmp = pow(a, 4.0) * (1.0 + (4.0 / a));
} else {
tmp = pow(b, 4.0) + -1.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-80000000000.0d0)) .or. (.not. (a <= 180000000000.0d0))) then
tmp = (a ** 4.0d0) * (1.0d0 + (4.0d0 / a))
else
tmp = (b ** 4.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -80000000000.0) || !(a <= 180000000000.0)) {
tmp = Math.pow(a, 4.0) * (1.0 + (4.0 / a));
} else {
tmp = Math.pow(b, 4.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -80000000000.0) or not (a <= 180000000000.0): tmp = math.pow(a, 4.0) * (1.0 + (4.0 / a)) else: tmp = math.pow(b, 4.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -80000000000.0) || !(a <= 180000000000.0)) tmp = Float64((a ^ 4.0) * Float64(1.0 + Float64(4.0 / a))); else tmp = Float64((b ^ 4.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -80000000000.0) || ~((a <= 180000000000.0))) tmp = (a ^ 4.0) * (1.0 + (4.0 / a)); else tmp = (b ^ 4.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -80000000000.0], N[Not[LessEqual[a, 180000000000.0]], $MachinePrecision]], N[(N[Power[a, 4.0], $MachinePrecision] * N[(1.0 + N[(4.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -80000000000 \lor \neg \left(a \leq 180000000000\right):\\
\;\;\;\;{a}^{4} \cdot \left(1 + \frac{4}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} + -1\\
\end{array}
\end{array}
if a < -8e10 or 1.8e11 < a Initial program 44.2%
associate--l+44.2%
+-commutative44.2%
+-commutative44.2%
sub-neg44.2%
associate-+l+44.2%
+-commutative44.2%
associate-+l+44.2%
Simplified47.6%
Taylor expanded in a around inf 94.3%
associate-*r/94.3%
metadata-eval94.3%
Simplified94.3%
if -8e10 < a < 1.8e11Initial program 99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in a around 0 92.2%
+-commutative92.2%
distribute-lft-in92.2%
associate-*r*92.2%
*-commutative92.2%
associate-*r*92.2%
pow-sqr92.2%
metadata-eval92.2%
fma-define92.2%
unpow292.2%
unpow292.2%
swap-sqr100.0%
unpow2100.0%
Simplified100.0%
unpow2100.0%
*-commutative100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in b around inf 98.2%
Final simplification96.4%
(FPCore (a b) :precision binary64 (if (or (<= a -140000000000.0) (not (<= a 205000000000.0))) (* (+ a 4.0) (pow a 3.0)) (+ (pow b 4.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -140000000000.0) || !(a <= 205000000000.0)) {
tmp = (a + 4.0) * pow(a, 3.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 <= (-140000000000.0d0)) .or. (.not. (a <= 205000000000.0d0))) then
tmp = (a + 4.0d0) * (a ** 3.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 <= -140000000000.0) || !(a <= 205000000000.0)) {
tmp = (a + 4.0) * Math.pow(a, 3.0);
} else {
tmp = Math.pow(b, 4.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -140000000000.0) or not (a <= 205000000000.0): tmp = (a + 4.0) * math.pow(a, 3.0) else: tmp = math.pow(b, 4.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -140000000000.0) || !(a <= 205000000000.0)) tmp = Float64(Float64(a + 4.0) * (a ^ 3.0)); else tmp = Float64((b ^ 4.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -140000000000.0) || ~((a <= 205000000000.0))) tmp = (a + 4.0) * (a ^ 3.0); else tmp = (b ^ 4.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -140000000000.0], N[Not[LessEqual[a, 205000000000.0]], $MachinePrecision]], N[(N[(a + 4.0), $MachinePrecision] * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -140000000000 \lor \neg \left(a \leq 205000000000\right):\\
\;\;\;\;\left(a + 4\right) \cdot {a}^{3}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} + -1\\
\end{array}
\end{array}
if a < -1.4e11 or 2.05e11 < a Initial program 44.2%
associate--l+44.2%
+-commutative44.2%
+-commutative44.2%
sub-neg44.2%
associate-+l+44.2%
+-commutative44.2%
associate-+l+44.2%
Simplified47.6%
Taylor expanded in a around inf 94.3%
associate-*r/94.3%
metadata-eval94.3%
Simplified94.3%
Taylor expanded in a around 0 94.2%
+-commutative94.2%
Simplified94.2%
if -1.4e11 < a < 2.05e11Initial program 99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in a around 0 92.2%
+-commutative92.2%
distribute-lft-in92.2%
associate-*r*92.2%
*-commutative92.2%
associate-*r*92.2%
pow-sqr92.2%
metadata-eval92.2%
fma-define92.2%
unpow292.2%
unpow292.2%
swap-sqr100.0%
unpow2100.0%
Simplified100.0%
unpow2100.0%
*-commutative100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in b around inf 98.2%
Final simplification96.4%
(FPCore (a b) :precision binary64 (if (or (<= a -220000000000.0) (not (<= a 1000000000.0))) (pow a 4.0) (+ (pow b 4.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((a <= -220000000000.0) || !(a <= 1000000000.0)) {
tmp = pow(a, 4.0);
} else {
tmp = pow(b, 4.0) + -1.0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-220000000000.0d0)) .or. (.not. (a <= 1000000000.0d0))) then
tmp = a ** 4.0d0
else
tmp = (b ** 4.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -220000000000.0) || !(a <= 1000000000.0)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -220000000000.0) or not (a <= 1000000000.0): tmp = math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -220000000000.0) || !(a <= 1000000000.0)) tmp = a ^ 4.0; else tmp = Float64((b ^ 4.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -220000000000.0) || ~((a <= 1000000000.0))) tmp = a ^ 4.0; else tmp = (b ^ 4.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -220000000000.0], N[Not[LessEqual[a, 1000000000.0]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -220000000000 \lor \neg \left(a \leq 1000000000\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} + -1\\
\end{array}
\end{array}
if a < -2.2e11 or 1e9 < a Initial program 44.2%
associate--l+44.2%
+-commutative44.2%
+-commutative44.2%
sub-neg44.2%
associate-+l+44.2%
+-commutative44.2%
associate-+l+44.2%
Simplified47.6%
Taylor expanded in a around inf 94.3%
associate-*r/94.3%
metadata-eval94.3%
Simplified94.3%
Taylor expanded in a around 0 94.2%
+-commutative94.2%
Simplified94.2%
Taylor expanded in a around inf 93.5%
if -2.2e11 < a < 1e9Initial program 99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in a around 0 92.2%
+-commutative92.2%
distribute-lft-in92.2%
associate-*r*92.2%
*-commutative92.2%
associate-*r*92.2%
pow-sqr92.2%
metadata-eval92.2%
fma-define92.2%
unpow292.2%
unpow292.2%
swap-sqr100.0%
unpow2100.0%
Simplified100.0%
unpow2100.0%
*-commutative100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in b around inf 98.2%
Final simplification96.1%
(FPCore (a b) :precision binary64 (if (or (<= a -90000000000.0) (not (<= a 15000000.0))) (pow a 4.0) (+ -1.0 (* (* b b) 4.0))))
double code(double a, double b) {
double tmp;
if ((a <= -90000000000.0) || !(a <= 15000000.0)) {
tmp = pow(a, 4.0);
} else {
tmp = -1.0 + ((b * 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 <= (-90000000000.0d0)) .or. (.not. (a <= 15000000.0d0))) then
tmp = a ** 4.0d0
else
tmp = (-1.0d0) + ((b * b) * 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((a <= -90000000000.0) || !(a <= 15000000.0)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = -1.0 + ((b * b) * 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -90000000000.0) or not (a <= 15000000.0): tmp = math.pow(a, 4.0) else: tmp = -1.0 + ((b * b) * 4.0) return tmp
function code(a, b) tmp = 0.0 if ((a <= -90000000000.0) || !(a <= 15000000.0)) tmp = a ^ 4.0; else tmp = Float64(-1.0 + Float64(Float64(b * b) * 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -90000000000.0) || ~((a <= 15000000.0))) tmp = a ^ 4.0; else tmp = -1.0 + ((b * b) * 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -90000000000.0], N[Not[LessEqual[a, 15000000.0]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -90000000000 \lor \neg \left(a \leq 15000000\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot 4\\
\end{array}
\end{array}
if a < -9e10 or 1.5e7 < a Initial program 44.2%
associate--l+44.2%
+-commutative44.2%
+-commutative44.2%
sub-neg44.2%
associate-+l+44.2%
+-commutative44.2%
associate-+l+44.2%
Simplified47.6%
Taylor expanded in a around inf 94.3%
associate-*r/94.3%
metadata-eval94.3%
Simplified94.3%
Taylor expanded in a around 0 94.2%
+-commutative94.2%
Simplified94.2%
Taylor expanded in a around inf 93.5%
if -9e10 < a < 1.5e7Initial program 99.8%
associate--l+99.8%
+-commutative99.8%
+-commutative99.8%
sub-neg99.8%
associate-+l+99.8%
+-commutative99.8%
associate-+l+99.8%
Simplified99.8%
Taylor expanded in a around 0 99.0%
Taylor expanded in b around 0 69.7%
unpow299.0%
Applied egg-rr69.7%
Final simplification80.4%
(FPCore (a b) :precision binary64 (if (<= (* b b) 0.5) (+ (pow a 4.0) -1.0) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = pow(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 * b) <= 0.5d0) then
tmp = (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 * b) <= 0.5) {
tmp = Math.pow(a, 4.0) + -1.0;
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 0.5: tmp = math.pow(a, 4.0) + -1.0 else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 0.5) tmp = 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 * b) <= 0.5) tmp = (a ^ 4.0) + -1.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 0.5], N[(N[Power[a, 4.0], $MachinePrecision] + -1.0), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 0.5:\\
\;\;\;\;{a}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 0.5Initial program 83.8%
sub-neg83.8%
Simplified83.8%
Taylor expanded in a around 0 83.8%
+-commutative83.8%
distribute-lft-in73.9%
associate-*r*73.9%
*-commutative73.9%
associate-*r*73.9%
pow-sqr74.0%
metadata-eval74.0%
fma-define74.0%
unpow274.0%
unpow274.0%
swap-sqr83.9%
unpow283.9%
Simplified83.9%
unpow283.9%
*-commutative83.9%
*-commutative83.9%
Applied egg-rr83.9%
Taylor expanded in a around inf 97.6%
if 0.5 < (*.f64 b b) Initial program 65.3%
associate--l+65.3%
+-commutative65.3%
+-commutative65.3%
sub-neg65.3%
associate-+l+65.3%
+-commutative65.3%
associate-+l+65.3%
Simplified68.5%
Taylor expanded in a around 0 90.4%
unpow290.4%
Applied egg-rr90.4%
Taylor expanded in b around inf 90.4%
(FPCore (a b) :precision binary64 (if (<= (* b b) 0.5) (+ -1.0 (* (* a a) 4.0)) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = -1.0 + ((a * 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 * b) <= 0.5d0) then
tmp = (-1.0d0) + ((a * 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 * b) <= 0.5) {
tmp = -1.0 + ((a * a) * 4.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 0.5: tmp = -1.0 + ((a * a) * 4.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 0.5) tmp = Float64(-1.0 + Float64(Float64(a * a) * 4.0)); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 0.5) tmp = -1.0 + ((a * a) * 4.0); else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 0.5], N[(-1.0 + N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 0.5:\\
\;\;\;\;-1 + \left(a \cdot a\right) \cdot 4\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 0.5Initial program 83.8%
sub-neg83.8%
Simplified83.8%
Taylor expanded in b around 0 83.1%
Taylor expanded in a around 0 67.8%
pow267.8%
Applied egg-rr67.8%
Taylor expanded in a around 0 80.6%
if 0.5 < (*.f64 b b) Initial program 65.3%
associate--l+65.3%
+-commutative65.3%
+-commutative65.3%
sub-neg65.3%
associate-+l+65.3%
+-commutative65.3%
associate-+l+65.3%
Simplified68.5%
Taylor expanded in a around 0 90.4%
unpow290.4%
Applied egg-rr90.4%
Taylor expanded in b around inf 90.4%
Final simplification85.4%
(FPCore (a b)
:precision binary64
(if (<= (* b b) 0.5)
(+ -1.0 (* (* a a) 4.0))
(if (<= (* b b) 5e+297)
(* 2.0 (* (* a b) (* a b)))
(* (+ 1.0 (* b 2.0)) (+ -1.0 (* b 2.0))))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = -1.0 + ((a * a) * 4.0);
} else if ((b * b) <= 5e+297) {
tmp = 2.0 * ((a * b) * (a * b));
} else {
tmp = (1.0 + (b * 2.0)) * (-1.0 + (b * 2.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) <= 0.5d0) then
tmp = (-1.0d0) + ((a * a) * 4.0d0)
else if ((b * b) <= 5d+297) then
tmp = 2.0d0 * ((a * b) * (a * b))
else
tmp = (1.0d0 + (b * 2.0d0)) * ((-1.0d0) + (b * 2.0d0))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = -1.0 + ((a * a) * 4.0);
} else if ((b * b) <= 5e+297) {
tmp = 2.0 * ((a * b) * (a * b));
} else {
tmp = (1.0 + (b * 2.0)) * (-1.0 + (b * 2.0));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 0.5: tmp = -1.0 + ((a * a) * 4.0) elif (b * b) <= 5e+297: tmp = 2.0 * ((a * b) * (a * b)) else: tmp = (1.0 + (b * 2.0)) * (-1.0 + (b * 2.0)) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 0.5) tmp = Float64(-1.0 + Float64(Float64(a * a) * 4.0)); elseif (Float64(b * b) <= 5e+297) tmp = Float64(2.0 * Float64(Float64(a * b) * Float64(a * b))); else tmp = Float64(Float64(1.0 + Float64(b * 2.0)) * Float64(-1.0 + Float64(b * 2.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 0.5) tmp = -1.0 + ((a * a) * 4.0); elseif ((b * b) <= 5e+297) tmp = 2.0 * ((a * b) * (a * b)); else tmp = (1.0 + (b * 2.0)) * (-1.0 + (b * 2.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 0.5], N[(-1.0 + N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * b), $MachinePrecision], 5e+297], N[(2.0 * N[(N[(a * b), $MachinePrecision] * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(b * 2.0), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(b * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 0.5:\\
\;\;\;\;-1 + \left(a \cdot a\right) \cdot 4\\
\mathbf{elif}\;b \cdot b \leq 5 \cdot 10^{+297}:\\
\;\;\;\;2 \cdot \left(\left(a \cdot b\right) \cdot \left(a \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + b \cdot 2\right) \cdot \left(-1 + b \cdot 2\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 0.5Initial program 83.8%
sub-neg83.8%
Simplified83.8%
Taylor expanded in b around 0 83.1%
Taylor expanded in a around 0 67.8%
pow267.8%
Applied egg-rr67.8%
Taylor expanded in a around 0 80.6%
if 0.5 < (*.f64 b b) < 4.9999999999999998e297Initial program 77.9%
associate--l+77.9%
+-commutative77.9%
+-commutative77.9%
sub-neg77.9%
associate-+l+77.9%
+-commutative77.9%
associate-+l+77.9%
Simplified82.5%
Taylor expanded in b around inf 95.2%
Taylor expanded in a around inf 29.1%
*-commutative29.1%
unpow229.1%
unpow229.1%
swap-sqr29.1%
unpow229.1%
*-commutative29.1%
Simplified29.1%
unpow280.0%
*-commutative80.0%
*-commutative80.0%
Applied egg-rr29.1%
if 4.9999999999999998e297 < (*.f64 b b) Initial program 51.7%
associate--l+51.7%
+-commutative51.7%
+-commutative51.7%
sub-neg51.7%
associate-+l+51.7%
+-commutative51.7%
associate-+l+51.7%
Simplified53.3%
Taylor expanded in a around 0 100.0%
Taylor expanded in b around 0 98.6%
add-sqr-sqrt98.6%
difference-of-sqr-198.6%
*-commutative98.6%
sqrt-prod98.6%
sqrt-pow146.9%
metadata-eval46.9%
pow146.9%
metadata-eval46.9%
*-commutative46.9%
sqrt-prod46.9%
sqrt-pow198.6%
metadata-eval98.6%
pow198.6%
metadata-eval98.6%
Applied egg-rr98.6%
Final simplification71.8%
(FPCore (a b)
:precision binary64
(if (<= (* b b) 0.5)
(+ -1.0 (* (* a a) 4.0))
(if (<= (* b b) 5e+297)
(* 2.0 (* (* a b) (* a b)))
(+ -1.0 (* (* b b) 4.0)))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = -1.0 + ((a * a) * 4.0);
} else if ((b * b) <= 5e+297) {
tmp = 2.0 * ((a * b) * (a * b));
} else {
tmp = -1.0 + ((b * b) * 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 0.5d0) then
tmp = (-1.0d0) + ((a * a) * 4.0d0)
else if ((b * b) <= 5d+297) then
tmp = 2.0d0 * ((a * b) * (a * b))
else
tmp = (-1.0d0) + ((b * b) * 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = -1.0 + ((a * a) * 4.0);
} else if ((b * b) <= 5e+297) {
tmp = 2.0 * ((a * b) * (a * b));
} else {
tmp = -1.0 + ((b * b) * 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 0.5: tmp = -1.0 + ((a * a) * 4.0) elif (b * b) <= 5e+297: tmp = 2.0 * ((a * b) * (a * b)) else: tmp = -1.0 + ((b * b) * 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 0.5) tmp = Float64(-1.0 + Float64(Float64(a * a) * 4.0)); elseif (Float64(b * b) <= 5e+297) tmp = Float64(2.0 * Float64(Float64(a * b) * Float64(a * b))); else tmp = Float64(-1.0 + Float64(Float64(b * b) * 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 0.5) tmp = -1.0 + ((a * a) * 4.0); elseif ((b * b) <= 5e+297) tmp = 2.0 * ((a * b) * (a * b)); else tmp = -1.0 + ((b * b) * 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 0.5], N[(-1.0 + N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * b), $MachinePrecision], 5e+297], N[(2.0 * N[(N[(a * b), $MachinePrecision] * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 0.5:\\
\;\;\;\;-1 + \left(a \cdot a\right) \cdot 4\\
\mathbf{elif}\;b \cdot b \leq 5 \cdot 10^{+297}:\\
\;\;\;\;2 \cdot \left(\left(a \cdot b\right) \cdot \left(a \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot 4\\
\end{array}
\end{array}
if (*.f64 b b) < 0.5Initial program 83.8%
sub-neg83.8%
Simplified83.8%
Taylor expanded in b around 0 83.1%
Taylor expanded in a around 0 67.8%
pow267.8%
Applied egg-rr67.8%
Taylor expanded in a around 0 80.6%
if 0.5 < (*.f64 b b) < 4.9999999999999998e297Initial program 77.9%
associate--l+77.9%
+-commutative77.9%
+-commutative77.9%
sub-neg77.9%
associate-+l+77.9%
+-commutative77.9%
associate-+l+77.9%
Simplified82.5%
Taylor expanded in b around inf 95.2%
Taylor expanded in a around inf 29.1%
*-commutative29.1%
unpow229.1%
unpow229.1%
swap-sqr29.1%
unpow229.1%
*-commutative29.1%
Simplified29.1%
unpow280.0%
*-commutative80.0%
*-commutative80.0%
Applied egg-rr29.1%
if 4.9999999999999998e297 < (*.f64 b b) Initial program 51.7%
associate--l+51.7%
+-commutative51.7%
+-commutative51.7%
sub-neg51.7%
associate-+l+51.7%
+-commutative51.7%
associate-+l+51.7%
Simplified53.3%
Taylor expanded in a around 0 100.0%
Taylor expanded in b around 0 98.6%
unpow2100.0%
Applied egg-rr98.6%
Final simplification71.8%
(FPCore (a b) :precision binary64 (if (<= (* b b) 8.6e+303) (+ -1.0 (* (* a a) 4.0)) (+ -1.0 (* (* b b) 4.0))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 8.6e+303) {
tmp = -1.0 + ((a * a) * 4.0);
} else {
tmp = -1.0 + ((b * b) * 4.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b * b) <= 8.6d+303) then
tmp = (-1.0d0) + ((a * a) * 4.0d0)
else
tmp = (-1.0d0) + ((b * b) * 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 8.6e+303) {
tmp = -1.0 + ((a * a) * 4.0);
} else {
tmp = -1.0 + ((b * b) * 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 8.6e+303: tmp = -1.0 + ((a * a) * 4.0) else: tmp = -1.0 + ((b * b) * 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 8.6e+303) tmp = Float64(-1.0 + Float64(Float64(a * a) * 4.0)); else tmp = Float64(-1.0 + Float64(Float64(b * b) * 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 8.6e+303) tmp = -1.0 + ((a * a) * 4.0); else tmp = -1.0 + ((b * b) * 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 8.6e+303], N[(-1.0 + N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 8.6 \cdot 10^{+303}:\\
\;\;\;\;-1 + \left(a \cdot a\right) \cdot 4\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot b\right) \cdot 4\\
\end{array}
\end{array}
if (*.f64 b b) < 8.59999999999999982e303Initial program 81.9%
sub-neg81.9%
Simplified82.4%
Taylor expanded in b around 0 63.1%
Taylor expanded in a around 0 50.7%
pow250.7%
Applied egg-rr50.7%
Taylor expanded in a around 0 61.0%
if 8.59999999999999982e303 < (*.f64 b b) Initial program 51.7%
associate--l+51.7%
+-commutative51.7%
+-commutative51.7%
sub-neg51.7%
associate-+l+51.7%
+-commutative51.7%
associate-+l+51.7%
Simplified53.3%
Taylor expanded in a around 0 100.0%
Taylor expanded in b around 0 98.6%
unpow2100.0%
Applied egg-rr98.6%
Final simplification69.8%
(FPCore (a b) :precision binary64 (+ -1.0 (* (* b b) 4.0)))
double code(double a, double b) {
return -1.0 + ((b * b) * 4.0);
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (-1.0d0) + ((b * b) * 4.0d0)
end function
public static double code(double a, double b) {
return -1.0 + ((b * b) * 4.0);
}
def code(a, b): return -1.0 + ((b * b) * 4.0)
function code(a, b) return Float64(-1.0 + Float64(Float64(b * b) * 4.0)) end
function tmp = code(a, b) tmp = -1.0 + ((b * b) * 4.0); end
code[a_, b_] := N[(-1.0 + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1 + \left(b \cdot b\right) \cdot 4
\end{array}
Initial program 74.8%
associate--l+74.8%
+-commutative74.8%
+-commutative74.8%
sub-neg74.8%
associate-+l+74.8%
+-commutative74.8%
associate-+l+74.8%
Simplified76.4%
Taylor expanded in a around 0 70.4%
Taylor expanded in b around 0 50.8%
unpow270.4%
Applied egg-rr50.8%
Final simplification50.8%
(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.8%
associate--l+74.8%
+-commutative74.8%
+-commutative74.8%
sub-neg74.8%
associate-+l+74.8%
+-commutative74.8%
associate-+l+74.8%
Simplified76.4%
Taylor expanded in a around 0 70.4%
Taylor expanded in b around 0 26.2%
herbie shell --seed 2024163
(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))