
(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 6 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
(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 3.0) (+ a 4.0)) -1.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 = (pow(a, 3.0) * (a + 4.0)) + -1.0;
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (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, 3.0) * (a + 4.0)) + -1.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 = (math.pow(a, 3.0) * (a + 4.0)) + -1.0 return tmp
function code(a, b) t_0 = Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(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(Float64((a ^ 3.0) * Float64(a + 4.0)) + -1.0); end return tmp end
function tmp_2 = code(a, b) t_0 = (((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (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 ^ 3.0) * (a + 4.0)) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(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[(N[Power[a, 3.0], $MachinePrecision] * N[(a + 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(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}^{3} \cdot \left(a + 4\right) + -1\\
\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%
+-commutative0.0%
+-commutative0.0%
sub-neg0.0%
associate-+l+0.0%
+-commutative0.0%
fma-def0.0%
Simplified9.4%
Taylor expanded in b around 0 29.7%
expm1-log1p-u29.7%
expm1-udef29.7%
unpow229.7%
fma-def29.7%
Applied egg-rr29.7%
expm1-def29.7%
expm1-log1p29.7%
Simplified29.7%
Taylor expanded in a around inf 29.7%
metadata-eval29.7%
pow-sqr29.7%
unpow229.7%
associate-*l*29.7%
unpow229.7%
cube-mult29.7%
distribute-rgt-out94.4%
Simplified94.4%
Final simplification98.1%
(FPCore (a b)
:precision binary64
(if (<= a -1.8e+28)
(pow a 4.0)
(if (<= a -3e-7)
(pow b 4.0)
(if (<= a -1.46e-61)
-1.0
(if (<= a -2.65e-145)
(pow b 4.0)
(if (<= a 8.5e-277)
-1.0
(if (<= a 5.5e+27) (pow b 4.0) (pow a 4.0))))))))
double code(double a, double b) {
double tmp;
if (a <= -1.8e+28) {
tmp = pow(a, 4.0);
} else if (a <= -3e-7) {
tmp = pow(b, 4.0);
} else if (a <= -1.46e-61) {
tmp = -1.0;
} else if (a <= -2.65e-145) {
tmp = pow(b, 4.0);
} else if (a <= 8.5e-277) {
tmp = -1.0;
} else if (a <= 5.5e+27) {
tmp = pow(b, 4.0);
} else {
tmp = pow(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 <= (-1.8d+28)) then
tmp = a ** 4.0d0
else if (a <= (-3d-7)) then
tmp = b ** 4.0d0
else if (a <= (-1.46d-61)) then
tmp = -1.0d0
else if (a <= (-2.65d-145)) then
tmp = b ** 4.0d0
else if (a <= 8.5d-277) then
tmp = -1.0d0
else if (a <= 5.5d+27) then
tmp = b ** 4.0d0
else
tmp = a ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -1.8e+28) {
tmp = Math.pow(a, 4.0);
} else if (a <= -3e-7) {
tmp = Math.pow(b, 4.0);
} else if (a <= -1.46e-61) {
tmp = -1.0;
} else if (a <= -2.65e-145) {
tmp = Math.pow(b, 4.0);
} else if (a <= 8.5e-277) {
tmp = -1.0;
} else if (a <= 5.5e+27) {
tmp = Math.pow(b, 4.0);
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -1.8e+28: tmp = math.pow(a, 4.0) elif a <= -3e-7: tmp = math.pow(b, 4.0) elif a <= -1.46e-61: tmp = -1.0 elif a <= -2.65e-145: tmp = math.pow(b, 4.0) elif a <= 8.5e-277: tmp = -1.0 elif a <= 5.5e+27: tmp = math.pow(b, 4.0) else: tmp = math.pow(a, 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= -1.8e+28) tmp = a ^ 4.0; elseif (a <= -3e-7) tmp = b ^ 4.0; elseif (a <= -1.46e-61) tmp = -1.0; elseif (a <= -2.65e-145) tmp = b ^ 4.0; elseif (a <= 8.5e-277) tmp = -1.0; elseif (a <= 5.5e+27) tmp = b ^ 4.0; else tmp = a ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -1.8e+28) tmp = a ^ 4.0; elseif (a <= -3e-7) tmp = b ^ 4.0; elseif (a <= -1.46e-61) tmp = -1.0; elseif (a <= -2.65e-145) tmp = b ^ 4.0; elseif (a <= 8.5e-277) tmp = -1.0; elseif (a <= 5.5e+27) tmp = b ^ 4.0; else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -1.8e+28], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[a, -3e-7], N[Power[b, 4.0], $MachinePrecision], If[LessEqual[a, -1.46e-61], -1.0, If[LessEqual[a, -2.65e-145], N[Power[b, 4.0], $MachinePrecision], If[LessEqual[a, 8.5e-277], -1.0, If[LessEqual[a, 5.5e+27], N[Power[b, 4.0], $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.8 \cdot 10^{+28}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;a \leq -3 \cdot 10^{-7}:\\
\;\;\;\;{b}^{4}\\
\mathbf{elif}\;a \leq -1.46 \cdot 10^{-61}:\\
\;\;\;\;-1\\
\mathbf{elif}\;a \leq -2.65 \cdot 10^{-145}:\\
\;\;\;\;{b}^{4}\\
\mathbf{elif}\;a \leq 8.5 \cdot 10^{-277}:\\
\;\;\;\;-1\\
\mathbf{elif}\;a \leq 5.5 \cdot 10^{+27}:\\
\;\;\;\;{b}^{4}\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if a < -1.8e28 or 5.49999999999999966e27 < a Initial program 35.9%
associate--l+35.9%
fma-def35.9%
distribute-rgt-in35.9%
sqr-neg35.9%
distribute-rgt-in35.9%
Simplified40.6%
Taylor expanded in a around inf 95.6%
if -1.8e28 < a < -2.9999999999999999e-7 or -1.46e-61 < a < -2.65e-145 or 8.4999999999999998e-277 < a < 5.49999999999999966e27Initial program 96.2%
associate--l+96.2%
fma-def96.2%
distribute-rgt-in96.2%
sqr-neg96.2%
distribute-rgt-in96.2%
Simplified96.2%
Taylor expanded in b around inf 69.0%
if -2.9999999999999999e-7 < a < -1.46e-61 or -2.65e-145 < a < 8.4999999999999998e-277Initial program 100.0%
associate--l+100.0%
+-commutative100.0%
+-commutative100.0%
sub-neg100.0%
associate-+l+100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in b around 0 68.8%
Taylor expanded in a around 0 68.8%
Final simplification82.3%
(FPCore (a b) :precision binary64 (if (<= b 1.8e+30) (+ (* (pow a 3.0) (+ a 4.0)) -1.0) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if (b <= 1.8e+30) {
tmp = (pow(a, 3.0) * (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 <= 1.8d+30) then
tmp = ((a ** 3.0d0) * (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 <= 1.8e+30) {
tmp = (Math.pow(a, 3.0) * (a + 4.0)) + -1.0;
} else {
tmp = Math.pow(b, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1.8e+30: tmp = (math.pow(a, 3.0) * (a + 4.0)) + -1.0 else: tmp = math.pow(b, 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 1.8e+30) tmp = Float64(Float64((a ^ 3.0) * 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 <= 1.8e+30) tmp = ((a ^ 3.0) * (a + 4.0)) + -1.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1.8e+30], N[(N[(N[Power[a, 3.0], $MachinePrecision] * N[(a + 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.8 \cdot 10^{+30}:\\
\;\;\;\;{a}^{3} \cdot \left(a + 4\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 1.8000000000000001e30Initial program 69.9%
associate--l+69.9%
+-commutative69.9%
+-commutative69.9%
sub-neg69.9%
associate-+l+69.9%
+-commutative69.9%
fma-def69.9%
Simplified72.5%
Taylor expanded in b around 0 58.3%
expm1-log1p-u52.6%
expm1-udef52.6%
unpow252.6%
fma-def52.6%
Applied egg-rr52.6%
expm1-def52.6%
expm1-log1p58.3%
Simplified58.3%
Taylor expanded in a around inf 57.6%
metadata-eval57.6%
pow-sqr57.6%
unpow257.6%
associate-*l*57.6%
unpow257.6%
cube-mult57.6%
distribute-rgt-out78.3%
Simplified78.3%
if 1.8000000000000001e30 < b Initial program 57.1%
associate--l+57.1%
fma-def57.1%
distribute-rgt-in57.1%
sqr-neg57.1%
distribute-rgt-in57.1%
Simplified63.4%
Taylor expanded in b around inf 95.5%
Final simplification82.6%
(FPCore (a b) :precision binary64 (if (or (<= a -0.0012) (not (<= a 3.5e-19))) (pow a 4.0) -1.0))
double code(double a, double b) {
double tmp;
if ((a <= -0.0012) || !(a <= 3.5e-19)) {
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 <= (-0.0012d0)) .or. (.not. (a <= 3.5d-19))) 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 <= -0.0012) || !(a <= 3.5e-19)) {
tmp = Math.pow(a, 4.0);
} else {
tmp = -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (a <= -0.0012) or not (a <= 3.5e-19): tmp = math.pow(a, 4.0) else: tmp = -1.0 return tmp
function code(a, b) tmp = 0.0 if ((a <= -0.0012) || !(a <= 3.5e-19)) tmp = a ^ 4.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((a <= -0.0012) || ~((a <= 3.5e-19))) tmp = a ^ 4.0; else tmp = -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[Or[LessEqual[a, -0.0012], N[Not[LessEqual[a, 3.5e-19]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], -1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.0012 \lor \neg \left(a \leq 3.5 \cdot 10^{-19}\right):\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if a < -0.00119999999999999989 or 3.50000000000000015e-19 < a Initial program 42.9%
associate--l+42.9%
fma-def42.9%
distribute-rgt-in42.9%
sqr-neg42.9%
distribute-rgt-in42.9%
Simplified46.9%
Taylor expanded in a around inf 84.8%
if -0.00119999999999999989 < a < 3.50000000000000015e-19Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
+-commutative99.9%
sub-neg99.9%
associate-+l+99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in b around 0 48.0%
Taylor expanded in a around 0 48.0%
Final simplification69.4%
(FPCore (a b) :precision binary64 (if (<= b 5.8e+30) (+ (pow a 4.0) -1.0) (pow b 4.0)))
double code(double a, double b) {
double tmp;
if (b <= 5.8e+30) {
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 <= 5.8d+30) 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 <= 5.8e+30) {
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 <= 5.8e+30: 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 (b <= 5.8e+30) 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 <= 5.8e+30) tmp = (a ^ 4.0) + -1.0; else tmp = b ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 5.8e+30], 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 \leq 5.8 \cdot 10^{+30}:\\
\;\;\;\;{a}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\end{array}
if b < 5.7999999999999996e30Initial program 69.9%
associate--l+69.9%
+-commutative69.9%
+-commutative69.9%
sub-neg69.9%
associate-+l+69.9%
+-commutative69.9%
fma-def69.9%
Simplified72.5%
Taylor expanded in b around 0 58.3%
Taylor expanded in a around inf 78.2%
if 5.7999999999999996e30 < b Initial program 57.1%
associate--l+57.1%
fma-def57.1%
distribute-rgt-in57.1%
sqr-neg57.1%
distribute-rgt-in57.1%
Simplified63.4%
Taylor expanded in b around inf 95.5%
Final simplification82.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 66.7%
associate--l+66.7%
+-commutative66.7%
+-commutative66.7%
sub-neg66.7%
associate-+l+66.7%
+-commutative66.7%
fma-def66.7%
Simplified69.8%
Taylor expanded in b around 0 48.5%
Taylor expanded in a around 0 20.5%
Final simplification20.5%
herbie shell --seed 2024010
(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))