
(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 11 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 (fma a a a) (* (* b b) (fma a -3.0 1.0)))
(+ (pow (hypot a b) 4.0) -1.0))
(+ -1.0 (* (pow a 3.0) (+ 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, fma(a, a, a), ((b * b) * fma(a, -3.0, 1.0))), (pow(hypot(a, b), 4.0) + -1.0));
} else {
tmp = -1.0 + (pow(a, 3.0) * (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 = fma(4.0, fma(a, fma(a, a, a), Float64(Float64(b * b) * fma(a, -3.0, 1.0))), Float64((hypot(a, b) ^ 4.0) + -1.0)); else tmp = Float64(-1.0 + Float64((a ^ 3.0) * 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[(4.0 * N[(a * N[(a * a + a), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(a * -3.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[Power[a, 3.0], $MachinePrecision] * N[(a + 4.0), $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, \mathsf{fma}\left(a, a, a\right), \left(b \cdot b\right) \cdot \mathsf{fma}\left(a, -3, 1\right)\right), {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + {a}^{3} \cdot \left(a + 4\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) < +inf.0Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
associate-+l+99.9%
fma-def99.9%
Simplified100.0%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) Initial program 0.0%
associate--l+0.0%
sqr-pow0.0%
sqr-pow0.0%
fma-def0.0%
distribute-lft-in0.0%
sqr-neg0.0%
distribute-lft-in0.0%
Simplified7.9%
*-un-lft-identity7.9%
Applied egg-rr7.9%
*-lft-identity7.9%
fma-udef7.9%
unpow27.9%
unpow27.9%
+-commutative7.9%
unpow27.9%
fma-def7.9%
unpow27.9%
Simplified7.9%
Taylor expanded in a around inf 30.2%
Taylor expanded in b around 0 27.2%
sub-neg27.2%
*-commutative27.2%
metadata-eval27.2%
pow-plus27.2%
distribute-lft-out97.0%
metadata-eval97.0%
Simplified97.0%
Final simplification99.2%
(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 3.0) (+ 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, 3.0) * (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, 3.0) * (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, 3.0) * (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 ^ 3.0) * 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 ^ 3.0) * (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, 3.0], $MachinePrecision] * N[(a + 4.0), $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}^{3} \cdot \left(a + 4\right)\\
\end{array}
\end{array}
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) < +inf.0Initial program 99.9%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (+.f64 1 a)) (*.f64 (*.f64 b b) (-.f64 1 (*.f64 3 a)))))) Initial program 0.0%
associate--l+0.0%
sqr-pow0.0%
sqr-pow0.0%
fma-def0.0%
distribute-lft-in0.0%
sqr-neg0.0%
distribute-lft-in0.0%
Simplified7.9%
*-un-lft-identity7.9%
Applied egg-rr7.9%
*-lft-identity7.9%
fma-udef7.9%
unpow27.9%
unpow27.9%
+-commutative7.9%
unpow27.9%
fma-def7.9%
unpow27.9%
Simplified7.9%
Taylor expanded in a around inf 30.2%
Taylor expanded in b around 0 27.2%
sub-neg27.2%
*-commutative27.2%
metadata-eval27.2%
pow-plus27.2%
distribute-lft-out97.0%
metadata-eval97.0%
Simplified97.0%
Final simplification99.2%
(FPCore (a b)
:precision binary64
(if (<= a -8e+49)
(pow a 4.0)
(if (<= a 1.06e+69)
(+ -1.0 (+ (pow b 4.0) (* (* b b) 4.0)))
(* (* a a) (* a a)))))
double code(double a, double b) {
double tmp;
if (a <= -8e+49) {
tmp = pow(a, 4.0);
} else if (a <= 1.06e+69) {
tmp = -1.0 + (pow(b, 4.0) + ((b * b) * 4.0));
} else {
tmp = (a * a) * (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 <= (-8d+49)) then
tmp = a ** 4.0d0
else if (a <= 1.06d+69) then
tmp = (-1.0d0) + ((b ** 4.0d0) + ((b * b) * 4.0d0))
else
tmp = (a * a) * (a * a)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -8e+49) {
tmp = Math.pow(a, 4.0);
} else if (a <= 1.06e+69) {
tmp = -1.0 + (Math.pow(b, 4.0) + ((b * b) * 4.0));
} else {
tmp = (a * a) * (a * a);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -8e+49: tmp = math.pow(a, 4.0) elif a <= 1.06e+69: tmp = -1.0 + (math.pow(b, 4.0) + ((b * b) * 4.0)) else: tmp = (a * a) * (a * a) return tmp
function code(a, b) tmp = 0.0 if (a <= -8e+49) tmp = a ^ 4.0; elseif (a <= 1.06e+69) tmp = Float64(-1.0 + Float64((b ^ 4.0) + Float64(Float64(b * b) * 4.0))); else tmp = Float64(Float64(a * a) * Float64(a * a)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -8e+49) tmp = a ^ 4.0; elseif (a <= 1.06e+69) tmp = -1.0 + ((b ^ 4.0) + ((b * b) * 4.0)); else tmp = (a * a) * (a * a); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -8e+49], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 1.06e+69], N[(-1.0 + N[(N[Power[b, 4.0], $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{+49}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 1.06 \cdot 10^{+69}:\\
\;\;\;\;-1 + \left({b}^{4} + \left(b \cdot b\right) \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\
\end{array}
\end{array}
if a < -7.99999999999999957e49Initial program 16.9%
associate--l+16.9%
sqr-pow16.9%
sqr-pow16.9%
fma-def16.9%
distribute-lft-in16.9%
sqr-neg16.9%
distribute-lft-in16.9%
Simplified26.3%
Taylor expanded in a around inf 96.6%
if -7.99999999999999957e49 < a < 1.06000000000000004e69Initial program 98.6%
Taylor expanded in a around 0 83.1%
associate-+r+83.1%
+-commutative83.1%
associate-*r*83.1%
distribute-rgt-out95.6%
unpow295.6%
+-commutative95.6%
Simplified95.6%
Taylor expanded in a around 0 96.9%
if 1.06000000000000004e69 < a Initial program 66.7%
associate--l+66.7%
sqr-pow66.7%
sqr-pow66.7%
fma-def66.7%
distribute-lft-in66.7%
sqr-neg66.7%
distribute-lft-in66.7%
Simplified66.7%
Taylor expanded in a around inf 100.0%
metadata-eval100.0%
pow-prod-up100.0%
pow2100.0%
pow2100.0%
Applied egg-rr100.0%
Final simplification97.5%
(FPCore (a b) :precision binary64 (if (<= a -1.55e+50) (pow a 4.0) (if (<= a 6.2e+70) (fma (* b b) (+ (* b b) 4.0) -1.0) (* (* a a) (* a a)))))
double code(double a, double b) {
double tmp;
if (a <= -1.55e+50) {
tmp = pow(a, 4.0);
} else if (a <= 6.2e+70) {
tmp = fma((b * b), ((b * b) + 4.0), -1.0);
} else {
tmp = (a * a) * (a * a);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (a <= -1.55e+50) tmp = a ^ 4.0; elseif (a <= 6.2e+70) tmp = fma(Float64(b * b), Float64(Float64(b * b) + 4.0), -1.0); else tmp = Float64(Float64(a * a) * Float64(a * a)); end return tmp end
code[a_, b_] := If[LessEqual[a, -1.55e+50], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 6.2e+70], N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55 \cdot 10^{+50}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 6.2 \cdot 10^{+70}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot b, b \cdot b + 4, -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\
\end{array}
\end{array}
if a < -1.55000000000000001e50Initial program 16.9%
associate--l+16.9%
sqr-pow16.9%
sqr-pow16.9%
fma-def16.9%
distribute-lft-in16.9%
sqr-neg16.9%
distribute-lft-in16.9%
Simplified26.3%
Taylor expanded in a around inf 96.6%
if -1.55000000000000001e50 < a < 6.2000000000000006e70Initial program 98.6%
associate--l+98.5%
sqr-pow98.5%
sqr-pow98.5%
fma-def98.5%
distribute-lft-in98.5%
sqr-neg98.5%
distribute-lft-in98.5%
Simplified98.5%
Taylor expanded in a around 0 96.9%
metadata-eval96.9%
pow-sqr96.8%
distribute-rgt-out96.8%
fma-neg96.8%
unpow296.8%
unpow296.8%
metadata-eval96.8%
Simplified96.8%
if 6.2000000000000006e70 < a Initial program 66.7%
associate--l+66.7%
sqr-pow66.7%
sqr-pow66.7%
fma-def66.7%
distribute-lft-in66.7%
sqr-neg66.7%
distribute-lft-in66.7%
Simplified66.7%
Taylor expanded in a around inf 100.0%
metadata-eval100.0%
pow-prod-up100.0%
pow2100.0%
pow2100.0%
Applied egg-rr100.0%
Final simplification97.4%
(FPCore (a b)
:precision binary64
(if (<= b 1.95e-202)
-1.0
(if (<= b 2.1e-158)
(pow a 4.0)
(if (<= b 2.3e-79)
-1.0
(if (<= b 1250.0) (* (* a a) (* a a)) (pow b 4.0))))))
double code(double a, double b) {
double tmp;
if (b <= 1.95e-202) {
tmp = -1.0;
} else if (b <= 2.1e-158) {
tmp = pow(a, 4.0);
} else if (b <= 2.3e-79) {
tmp = -1.0;
} else if (b <= 1250.0) {
tmp = (a * a) * (a * a);
} 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.95d-202) then
tmp = -1.0d0
else if (b <= 2.1d-158) then
tmp = a ** 4.0d0
else if (b <= 2.3d-79) then
tmp = -1.0d0
else if (b <= 1250.0d0) then
tmp = (a * a) * (a * a)
else
tmp = b ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 1.95e-202) {
tmp = -1.0;
} else if (b <= 2.1e-158) {
tmp = Math.pow(a, 4.0);
} else if (b <= 2.3e-79) {
tmp = -1.0;
} else if (b <= 1250.0) {
tmp = (a * a) * (a * a);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1.95e-202: tmp = -1.0 elif b <= 2.1e-158: tmp = math.pow(a, 4.0) elif b <= 2.3e-79: tmp = -1.0 elif b <= 1250.0: tmp = (a * a) * (a * a) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 1.95e-202) tmp = -1.0; elseif (b <= 2.1e-158) tmp = a ^ 4.0; elseif (b <= 2.3e-79) tmp = -1.0; elseif (b <= 1250.0) tmp = Float64(Float64(a * a) * Float64(a * a)); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 1.95e-202) tmp = -1.0; elseif (b <= 2.1e-158) tmp = a ^ 4.0; elseif (b <= 2.3e-79) tmp = -1.0; elseif (b <= 1250.0) tmp = (a * a) * (a * a); else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1.95e-202], -1.0, If[LessEqual[b, 2.1e-158], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[b, 2.3e-79], -1.0, If[LessEqual[b, 1250.0], N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.95 \cdot 10^{-202}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 2.1 \cdot 10^{-158}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{-79}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 1250:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 1.95e-202 or 2.09999999999999991e-158 < b < 2.30000000000000012e-79Initial program 77.8%
associate--l+77.8%
sqr-pow77.8%
sqr-pow77.8%
fma-def77.8%
distribute-lft-in77.8%
sqr-neg77.8%
distribute-lft-in77.8%
Simplified78.4%
Taylor expanded in a around 0 70.8%
metadata-eval70.8%
pow-sqr70.7%
distribute-rgt-out70.7%
fma-neg70.7%
unpow270.7%
unpow270.7%
metadata-eval70.7%
Simplified70.7%
Taylor expanded in b around 0 36.2%
if 1.95e-202 < b < 2.09999999999999991e-158Initial program 71.4%
associate--l+71.4%
sqr-pow71.4%
sqr-pow71.4%
fma-def71.4%
distribute-lft-in71.4%
sqr-neg71.4%
distribute-lft-in71.4%
Simplified71.4%
Taylor expanded in a around inf 79.2%
if 2.30000000000000012e-79 < b < 1250Initial program 70.6%
associate--l+70.5%
sqr-pow70.5%
sqr-pow70.5%
fma-def70.5%
distribute-lft-in70.5%
sqr-neg70.5%
distribute-lft-in70.5%
Simplified70.5%
Taylor expanded in a around inf 65.7%
metadata-eval65.7%
pow-prod-up65.7%
pow265.7%
pow265.7%
Applied egg-rr65.7%
if 1250 < b Initial program 70.8%
associate--l+70.8%
sqr-pow70.8%
sqr-pow70.8%
fma-def70.8%
distribute-lft-in70.8%
sqr-neg70.8%
distribute-lft-in70.8%
Simplified77.2%
Taylor expanded in b around inf 92.3%
Final simplification54.1%
(FPCore (a b) :precision binary64 (if (<= a -6.5e+49) (pow a 4.0) (if (<= a 1.15e+69) (+ -1.0 (pow b 4.0)) (* (* a a) (* a a)))))
double code(double a, double b) {
double tmp;
if (a <= -6.5e+49) {
tmp = pow(a, 4.0);
} else if (a <= 1.15e+69) {
tmp = -1.0 + pow(b, 4.0);
} else {
tmp = (a * a) * (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 <= (-6.5d+49)) then
tmp = a ** 4.0d0
else if (a <= 1.15d+69) then
tmp = (-1.0d0) + (b ** 4.0d0)
else
tmp = (a * a) * (a * a)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -6.5e+49) {
tmp = Math.pow(a, 4.0);
} else if (a <= 1.15e+69) {
tmp = -1.0 + Math.pow(b, 4.0);
} else {
tmp = (a * a) * (a * a);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -6.5e+49: tmp = math.pow(a, 4.0) elif a <= 1.15e+69: tmp = -1.0 + math.pow(b, 4.0) else: tmp = (a * a) * (a * a) return tmp
function code(a, b) tmp = 0.0 if (a <= -6.5e+49) tmp = a ^ 4.0; elseif (a <= 1.15e+69) tmp = Float64(-1.0 + (b ^ 4.0)); else tmp = Float64(Float64(a * a) * Float64(a * a)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -6.5e+49) tmp = a ^ 4.0; elseif (a <= 1.15e+69) tmp = -1.0 + (b ^ 4.0); else tmp = (a * a) * (a * a); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -6.5e+49], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, 1.15e+69], N[(-1.0 + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{+49}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq 1.15 \cdot 10^{+69}:\\
\;\;\;\;-1 + {b}^{4}\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\
\end{array}
\end{array}
if a < -6.5000000000000005e49Initial program 16.9%
associate--l+16.9%
sqr-pow16.9%
sqr-pow16.9%
fma-def16.9%
distribute-lft-in16.9%
sqr-neg16.9%
distribute-lft-in16.9%
Simplified26.3%
Taylor expanded in a around inf 96.6%
if -6.5000000000000005e49 < a < 1.15000000000000008e69Initial program 98.6%
associate--l+98.5%
sqr-pow98.5%
sqr-pow98.5%
fma-def98.5%
distribute-lft-in98.5%
sqr-neg98.5%
distribute-lft-in98.5%
Simplified98.5%
*-un-lft-identity98.5%
Applied egg-rr98.5%
*-lft-identity98.5%
fma-udef98.5%
unpow298.5%
unpow298.5%
+-commutative98.5%
unpow298.5%
fma-def98.5%
unpow298.5%
Simplified98.5%
Taylor expanded in a around inf 97.2%
Taylor expanded in a around 0 96.0%
if 1.15000000000000008e69 < a Initial program 66.7%
associate--l+66.7%
sqr-pow66.7%
sqr-pow66.7%
fma-def66.7%
distribute-lft-in66.7%
sqr-neg66.7%
distribute-lft-in66.7%
Simplified66.7%
Taylor expanded in a around inf 100.0%
metadata-eval100.0%
pow-prod-up100.0%
pow2100.0%
pow2100.0%
Applied egg-rr100.0%
Final simplification96.9%
(FPCore (a b) :precision binary64 (if (<= (* b b) 200000.0) (+ -1.0 (pow a 4.0)) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 200000.0) {
tmp = -1.0 + 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 * b) <= 200000.0d0) then
tmp = (-1.0d0) + (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) <= 200000.0) {
tmp = -1.0 + Math.pow(a, 4.0);
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 200000.0: tmp = -1.0 + math.pow(a, 4.0) else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 200000.0) tmp = Float64(-1.0 + (a ^ 4.0)); else tmp = b ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 200000.0) tmp = -1.0 + (a ^ 4.0); else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 200000.0], N[(-1.0 + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 200000:\\
\;\;\;\;-1 + {a}^{4}\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if (*.f64 b b) < 2e5Initial program 80.0%
associate--l+80.0%
sqr-pow80.0%
sqr-pow80.0%
fma-def80.0%
distribute-lft-in80.0%
sqr-neg80.0%
distribute-lft-in80.0%
Simplified80.0%
*-un-lft-identity80.0%
Applied egg-rr80.0%
*-lft-identity80.0%
fma-udef80.0%
unpow280.0%
unpow280.0%
+-commutative80.0%
unpow280.0%
fma-def80.0%
unpow280.0%
Simplified80.0%
Taylor expanded in a around inf 77.6%
Taylor expanded in b around 0 77.6%
sub-neg77.6%
*-commutative77.6%
metadata-eval77.6%
pow-plus77.6%
distribute-lft-out97.6%
metadata-eval97.6%
Simplified97.6%
Taylor expanded in a around inf 97.6%
if 2e5 < (*.f64 b b) Initial program 70.5%
associate--l+70.5%
sqr-pow70.5%
sqr-pow70.5%
fma-def70.5%
distribute-lft-in70.5%
sqr-neg70.5%
distribute-lft-in70.5%
Simplified74.4%
Taylor expanded in b around inf 89.7%
Final simplification93.7%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* (* b b) 4.0)))
(if (<= a -6.5e+49)
(pow a 4.0)
(if (<= a -3.5e-114)
t_0
(if (<= a -4.2e-302)
-1.0
(if (<= a 3.6e-256)
t_0
(if (<= a 0.0215) -1.0 (* (* a a) (* a a)))))))))
double code(double a, double b) {
double t_0 = (b * b) * 4.0;
double tmp;
if (a <= -6.5e+49) {
tmp = pow(a, 4.0);
} else if (a <= -3.5e-114) {
tmp = t_0;
} else if (a <= -4.2e-302) {
tmp = -1.0;
} else if (a <= 3.6e-256) {
tmp = t_0;
} else if (a <= 0.0215) {
tmp = -1.0;
} else {
tmp = (a * a) * (a * a);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) * 4.0d0
if (a <= (-6.5d+49)) then
tmp = a ** 4.0d0
else if (a <= (-3.5d-114)) then
tmp = t_0
else if (a <= (-4.2d-302)) then
tmp = -1.0d0
else if (a <= 3.6d-256) then
tmp = t_0
else if (a <= 0.0215d0) then
tmp = -1.0d0
else
tmp = (a * a) * (a * a)
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = (b * b) * 4.0;
double tmp;
if (a <= -6.5e+49) {
tmp = Math.pow(a, 4.0);
} else if (a <= -3.5e-114) {
tmp = t_0;
} else if (a <= -4.2e-302) {
tmp = -1.0;
} else if (a <= 3.6e-256) {
tmp = t_0;
} else if (a <= 0.0215) {
tmp = -1.0;
} else {
tmp = (a * a) * (a * a);
}
return tmp;
}
def code(a, b): t_0 = (b * b) * 4.0 tmp = 0 if a <= -6.5e+49: tmp = math.pow(a, 4.0) elif a <= -3.5e-114: tmp = t_0 elif a <= -4.2e-302: tmp = -1.0 elif a <= 3.6e-256: tmp = t_0 elif a <= 0.0215: tmp = -1.0 else: tmp = (a * a) * (a * a) return tmp
function code(a, b) t_0 = Float64(Float64(b * b) * 4.0) tmp = 0.0 if (a <= -6.5e+49) tmp = a ^ 4.0; elseif (a <= -3.5e-114) tmp = t_0; elseif (a <= -4.2e-302) tmp = -1.0; elseif (a <= 3.6e-256) tmp = t_0; elseif (a <= 0.0215) tmp = -1.0; else tmp = Float64(Float64(a * a) * Float64(a * a)); end return tmp end
function tmp_2 = code(a, b) t_0 = (b * b) * 4.0; tmp = 0.0; if (a <= -6.5e+49) tmp = a ^ 4.0; elseif (a <= -3.5e-114) tmp = t_0; elseif (a <= -4.2e-302) tmp = -1.0; elseif (a <= 3.6e-256) tmp = t_0; elseif (a <= 0.0215) tmp = -1.0; else tmp = (a * a) * (a * a); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]}, If[LessEqual[a, -6.5e+49], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, -3.5e-114], t$95$0, If[LessEqual[a, -4.2e-302], -1.0, If[LessEqual[a, 3.6e-256], t$95$0, If[LessEqual[a, 0.0215], -1.0, N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(b \cdot b\right) \cdot 4\\
\mathbf{if}\;a \leq -6.5 \cdot 10^{+49}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq -3.5 \cdot 10^{-114}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;a \leq -4.2 \cdot 10^{-302}:\\
\;\;\;\;-1\\
\mathbf{elif}\;a \leq 3.6 \cdot 10^{-256}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;a \leq 0.0215:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\
\end{array}
\end{array}
if a < -6.5000000000000005e49Initial program 16.9%
associate--l+16.9%
sqr-pow16.9%
sqr-pow16.9%
fma-def16.9%
distribute-lft-in16.9%
sqr-neg16.9%
distribute-lft-in16.9%
Simplified26.3%
Taylor expanded in a around inf 96.6%
if -6.5000000000000005e49 < a < -3.5e-114 or -4.20000000000000026e-302 < a < 3.6000000000000002e-256Initial program 99.9%
associate--l+99.9%
sqr-pow99.9%
sqr-pow99.9%
fma-def99.9%
distribute-lft-in99.9%
sqr-neg99.9%
distribute-lft-in99.9%
Simplified99.9%
Taylor expanded in a around 0 91.5%
metadata-eval91.5%
pow-sqr91.4%
distribute-rgt-out91.4%
fma-neg91.4%
unpow291.4%
unpow291.4%
metadata-eval91.4%
Simplified91.4%
Taylor expanded in b around inf 70.6%
+-commutative70.6%
metadata-eval70.6%
pow-sqr70.5%
unpow270.5%
unpow270.5%
unpow270.5%
distribute-rgt-in70.5%
fma-udef70.5%
Simplified70.5%
Taylor expanded in b around 0 57.5%
unpow257.5%
Simplified57.5%
if -3.5e-114 < a < -4.20000000000000026e-302 or 3.6000000000000002e-256 < a < 0.021499999999999998Initial program 99.8%
associate--l+99.8%
sqr-pow99.8%
sqr-pow99.8%
fma-def99.8%
distribute-lft-in99.8%
sqr-neg99.8%
distribute-lft-in99.8%
Simplified99.8%
Taylor expanded in a around 0 99.1%
metadata-eval99.1%
pow-sqr98.9%
distribute-rgt-out98.9%
fma-neg98.9%
unpow298.9%
unpow298.9%
metadata-eval98.9%
Simplified98.9%
Taylor expanded in b around 0 54.7%
if 0.021499999999999998 < a Initial program 64.8%
associate--l+64.8%
sqr-pow64.8%
sqr-pow64.8%
fma-def64.8%
distribute-lft-in64.8%
sqr-neg64.8%
distribute-lft-in64.8%
Simplified64.8%
Taylor expanded in a around inf 94.7%
metadata-eval94.7%
pow-prod-up94.7%
pow294.7%
pow294.7%
Applied egg-rr94.7%
Final simplification72.3%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* (* a a) (* a a))) (t_1 (* (* b b) 4.0)))
(if (<= a -1.55e+50)
t_0
(if (<= a -3.2e-114)
t_1
(if (<= a -3.5e-302)
-1.0
(if (<= a 1.05e-254) t_1 (if (<= a 0.0215) -1.0 t_0)))))))
double code(double a, double b) {
double t_0 = (a * a) * (a * a);
double t_1 = (b * b) * 4.0;
double tmp;
if (a <= -1.55e+50) {
tmp = t_0;
} else if (a <= -3.2e-114) {
tmp = t_1;
} else if (a <= -3.5e-302) {
tmp = -1.0;
} else if (a <= 1.05e-254) {
tmp = t_1;
} else if (a <= 0.0215) {
tmp = -1.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (a * a) * (a * a)
t_1 = (b * b) * 4.0d0
if (a <= (-1.55d+50)) then
tmp = t_0
else if (a <= (-3.2d-114)) then
tmp = t_1
else if (a <= (-3.5d-302)) then
tmp = -1.0d0
else if (a <= 1.05d-254) then
tmp = t_1
else if (a <= 0.0215d0) then
tmp = -1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = (a * a) * (a * a);
double t_1 = (b * b) * 4.0;
double tmp;
if (a <= -1.55e+50) {
tmp = t_0;
} else if (a <= -3.2e-114) {
tmp = t_1;
} else if (a <= -3.5e-302) {
tmp = -1.0;
} else if (a <= 1.05e-254) {
tmp = t_1;
} else if (a <= 0.0215) {
tmp = -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b): t_0 = (a * a) * (a * a) t_1 = (b * b) * 4.0 tmp = 0 if a <= -1.55e+50: tmp = t_0 elif a <= -3.2e-114: tmp = t_1 elif a <= -3.5e-302: tmp = -1.0 elif a <= 1.05e-254: tmp = t_1 elif a <= 0.0215: tmp = -1.0 else: tmp = t_0 return tmp
function code(a, b) t_0 = Float64(Float64(a * a) * Float64(a * a)) t_1 = Float64(Float64(b * b) * 4.0) tmp = 0.0 if (a <= -1.55e+50) tmp = t_0; elseif (a <= -3.2e-114) tmp = t_1; elseif (a <= -3.5e-302) tmp = -1.0; elseif (a <= 1.05e-254) tmp = t_1; elseif (a <= 0.0215) tmp = -1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(a, b) t_0 = (a * a) * (a * a); t_1 = (b * b) * 4.0; tmp = 0.0; if (a <= -1.55e+50) tmp = t_0; elseif (a <= -3.2e-114) tmp = t_1; elseif (a <= -3.5e-302) tmp = -1.0; elseif (a <= 1.05e-254) tmp = t_1; elseif (a <= 0.0215) tmp = -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]}, If[LessEqual[a, -1.55e+50], t$95$0, If[LessEqual[a, -3.2e-114], t$95$1, If[LessEqual[a, -3.5e-302], -1.0, If[LessEqual[a, 1.05e-254], t$95$1, If[LessEqual[a, 0.0215], -1.0, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(a \cdot a\right) \cdot \left(a \cdot a\right)\\
t_1 := \left(b \cdot b\right) \cdot 4\\
\mathbf{if}\;a \leq -1.55 \cdot 10^{+50}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;a \leq -3.2 \cdot 10^{-114}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -3.5 \cdot 10^{-302}:\\
\;\;\;\;-1\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-254}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 0.0215:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if a < -1.55000000000000001e50 or 0.021499999999999998 < a Initial program 41.1%
associate--l+41.1%
sqr-pow41.1%
sqr-pow41.1%
fma-def41.1%
distribute-lft-in41.1%
sqr-neg41.1%
distribute-lft-in41.1%
Simplified45.8%
Taylor expanded in a around inf 95.7%
metadata-eval95.7%
pow-prod-up95.7%
pow295.7%
pow295.7%
Applied egg-rr95.7%
if -1.55000000000000001e50 < a < -3.2000000000000002e-114 or -3.5000000000000001e-302 < a < 1.04999999999999998e-254Initial program 99.9%
associate--l+99.9%
sqr-pow99.9%
sqr-pow99.9%
fma-def99.9%
distribute-lft-in99.9%
sqr-neg99.9%
distribute-lft-in99.9%
Simplified99.9%
Taylor expanded in a around 0 91.5%
metadata-eval91.5%
pow-sqr91.4%
distribute-rgt-out91.4%
fma-neg91.4%
unpow291.4%
unpow291.4%
metadata-eval91.4%
Simplified91.4%
Taylor expanded in b around inf 70.6%
+-commutative70.6%
metadata-eval70.6%
pow-sqr70.5%
unpow270.5%
unpow270.5%
unpow270.5%
distribute-rgt-in70.5%
fma-udef70.5%
Simplified70.5%
Taylor expanded in b around 0 57.5%
unpow257.5%
Simplified57.5%
if -3.2000000000000002e-114 < a < -3.5000000000000001e-302 or 1.04999999999999998e-254 < a < 0.021499999999999998Initial program 99.8%
associate--l+99.8%
sqr-pow99.8%
sqr-pow99.8%
fma-def99.8%
distribute-lft-in99.8%
sqr-neg99.8%
distribute-lft-in99.8%
Simplified99.8%
Taylor expanded in a around 0 99.1%
metadata-eval99.1%
pow-sqr98.9%
distribute-rgt-out98.9%
fma-neg98.9%
unpow298.9%
unpow298.9%
metadata-eval98.9%
Simplified98.9%
Taylor expanded in b around 0 54.7%
Final simplification72.3%
(FPCore (a b) :precision binary64 (if (<= b 0.038) -1.0 (* (* b b) 4.0)))
double code(double a, double b) {
double tmp;
if (b <= 0.038) {
tmp = -1.0;
} else {
tmp = (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 <= 0.038d0) then
tmp = -1.0d0
else
tmp = (b * b) * 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 0.038) {
tmp = -1.0;
} else {
tmp = (b * b) * 4.0;
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 0.038: tmp = -1.0 else: tmp = (b * b) * 4.0 return tmp
function code(a, b) tmp = 0.0 if (b <= 0.038) tmp = -1.0; else tmp = Float64(Float64(b * b) * 4.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 0.038) tmp = -1.0; else tmp = (b * b) * 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 0.038], -1.0, N[(N[(b * b), $MachinePrecision] * 4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.038:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 4\\
\end{array}
\end{array}
if b < 0.0379999999999999991Initial program 76.6%
associate--l+76.6%
sqr-pow76.6%
sqr-pow76.6%
fma-def76.6%
distribute-lft-in76.6%
sqr-neg76.6%
distribute-lft-in76.6%
Simplified77.1%
Taylor expanded in a around 0 64.5%
metadata-eval64.5%
pow-sqr64.5%
distribute-rgt-out64.5%
fma-neg64.5%
unpow264.5%
unpow264.5%
metadata-eval64.5%
Simplified64.5%
Taylor expanded in b around 0 35.1%
if 0.0379999999999999991 < b Initial program 71.3%
associate--l+71.3%
sqr-pow71.3%
sqr-pow71.3%
fma-def71.3%
distribute-lft-in71.3%
sqr-neg71.3%
distribute-lft-in71.3%
Simplified77.6%
Taylor expanded in a around 0 90.9%
metadata-eval90.9%
pow-sqr90.7%
distribute-rgt-out90.7%
fma-neg90.7%
unpow290.7%
unpow290.7%
metadata-eval90.7%
Simplified90.7%
Taylor expanded in b around inf 90.9%
+-commutative90.9%
metadata-eval90.9%
pow-sqr90.7%
unpow290.7%
unpow290.7%
unpow290.7%
distribute-rgt-in90.7%
fma-udef90.7%
Simplified90.7%
Taylor expanded in b around 0 56.8%
unpow256.8%
Simplified56.8%
Final simplification40.4%
(FPCore (a b) :precision binary64 -1.0)
double code(double a, double b) {
return -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = -1.0d0
end function
public static double code(double a, double b) {
return -1.0;
}
def code(a, b): return -1.0
function code(a, b) return -1.0 end
function tmp = code(a, b) tmp = -1.0; end
code[a_, b_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 75.3%
associate--l+75.3%
sqr-pow75.3%
sqr-pow75.3%
fma-def75.3%
distribute-lft-in75.3%
sqr-neg75.3%
distribute-lft-in75.3%
Simplified77.2%
Taylor expanded in a around 0 71.0%
metadata-eval71.0%
pow-sqr70.9%
distribute-rgt-out70.9%
fma-neg70.9%
unpow270.9%
unpow270.9%
metadata-eval70.9%
Simplified70.9%
Taylor expanded in b around 0 26.6%
Final simplification26.6%
herbie shell --seed 2023292
(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))