
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 3.0 a))))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (((a * a) * (1.0d0 - a)) + ((b * b) * (3.0d0 + a))))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 - a)) + Float64(Float64(b * b) * Float64(3.0 + a))))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0; end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(3.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 3.0 a))))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (((a * a) * (1.0d0 - a)) + ((b * b) * (3.0d0 + a))))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 - a)) + Float64(Float64(b * b) * Float64(3.0 + a))))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0; end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(3.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1
\end{array}
(FPCore (a b) :precision binary64 (if (<= (* b b) 1e+154) (+ (pow a 4.0) (+ (* a (* a 4.0)) -1.0)) (+ (pow b 4.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 1e+154) {
tmp = pow(a, 4.0) + ((a * (a * 4.0)) + -1.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 ((b * b) <= 1d+154) then
tmp = (a ** 4.0d0) + ((a * (a * 4.0d0)) + (-1.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 ((b * b) <= 1e+154) {
tmp = Math.pow(a, 4.0) + ((a * (a * 4.0)) + -1.0);
} else {
tmp = Math.pow(b, 4.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 1e+154: tmp = math.pow(a, 4.0) + ((a * (a * 4.0)) + -1.0) else: tmp = math.pow(b, 4.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 1e+154) tmp = Float64((a ^ 4.0) + Float64(Float64(a * Float64(a * 4.0)) + -1.0)); else tmp = Float64((b ^ 4.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 1e+154) tmp = (a ^ 4.0) + ((a * (a * 4.0)) + -1.0); else tmp = (b ^ 4.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 1e+154], N[(N[Power[a, 4.0], $MachinePrecision] + N[(N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 10^{+154}:\\
\;\;\;\;{a}^{4} + \left(a \cdot \left(a \cdot 4\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} + -1\\
\end{array}
\end{array}
if (*.f64 b b) < 1.00000000000000004e154Initial program 77.7%
associate--l+77.7%
fma-def77.7%
fma-neg77.7%
associate-*l*77.7%
fma-def77.7%
+-commutative77.7%
metadata-eval77.7%
Simplified77.7%
Taylor expanded in b around 0 77.0%
associate--l+77.0%
unpow277.0%
Simplified77.0%
Taylor expanded in a around 0 94.6%
*-commutative94.6%
unpow294.6%
associate-*l*94.6%
Simplified94.6%
if 1.00000000000000004e154 < (*.f64 b b) Initial program 51.5%
sub-neg51.5%
fma-def51.5%
fma-def54.4%
+-commutative54.4%
metadata-eval54.4%
Simplified54.4%
Taylor expanded in b around inf 100.0%
Final simplification96.7%
(FPCore (a b) :precision binary64 (if (<= (* b b) 1e+154) (+ (* (* a a) (+ 4.0 (* a a))) -1.0) (+ (pow b 4.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 1e+154) {
tmp = ((a * a) * (4.0 + (a * a))) + -1.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 ((b * b) <= 1d+154) then
tmp = ((a * a) * (4.0d0 + (a * a))) + (-1.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 ((b * b) <= 1e+154) {
tmp = ((a * a) * (4.0 + (a * a))) + -1.0;
} else {
tmp = Math.pow(b, 4.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 1e+154: tmp = ((a * a) * (4.0 + (a * a))) + -1.0 else: tmp = math.pow(b, 4.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 1e+154) tmp = Float64(Float64(Float64(a * a) * Float64(4.0 + Float64(a * a))) + -1.0); else tmp = Float64((b ^ 4.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 1e+154) tmp = ((a * a) * (4.0 + (a * a))) + -1.0; else tmp = (b ^ 4.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 1e+154], N[(N[(N[(a * a), $MachinePrecision] * N[(4.0 + N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[b, 4.0], $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 10^{+154}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(4 + a \cdot a\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} + -1\\
\end{array}
\end{array}
if (*.f64 b b) < 1.00000000000000004e154Initial program 77.7%
associate--l+77.7%
fma-def77.7%
fma-neg77.7%
associate-*l*77.7%
fma-def77.7%
+-commutative77.7%
metadata-eval77.7%
Simplified77.7%
Taylor expanded in b around 0 77.0%
associate--l+77.0%
unpow277.0%
Simplified77.0%
Taylor expanded in a around 0 94.6%
*-commutative94.6%
unpow294.6%
associate-*l*94.6%
Simplified94.6%
associate-+r-94.6%
sqr-pow94.5%
metadata-eval94.5%
pow294.5%
metadata-eval94.5%
pow294.5%
associate-*r*94.5%
distribute-lft-out94.5%
Applied egg-rr94.5%
if 1.00000000000000004e154 < (*.f64 b b) Initial program 51.5%
sub-neg51.5%
fma-def51.5%
fma-def54.4%
+-commutative54.4%
metadata-eval54.4%
Simplified54.4%
Taylor expanded in b around inf 100.0%
Final simplification96.7%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e+290) (* (+ 1.0 (* a a)) (+ (* a a) -1.0)) (+ (* (* b b) 12.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+290) {
tmp = (1.0 + (a * a)) * ((a * a) + -1.0);
} else {
tmp = ((b * b) * 12.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 ((b * b) <= 2d+290) then
tmp = (1.0d0 + (a * a)) * ((a * a) + (-1.0d0))
else
tmp = ((b * b) * 12.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+290) {
tmp = (1.0 + (a * a)) * ((a * a) + -1.0);
} else {
tmp = ((b * b) * 12.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e+290: tmp = (1.0 + (a * a)) * ((a * a) + -1.0) else: tmp = ((b * b) * 12.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+290) tmp = Float64(Float64(1.0 + Float64(a * a)) * Float64(Float64(a * a) + -1.0)); else tmp = Float64(Float64(Float64(b * b) * 12.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e+290) tmp = (1.0 + (a * a)) * ((a * a) + -1.0); else tmp = ((b * b) * 12.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+290], N[(N[(1.0 + N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+290}:\\
\;\;\;\;\left(1 + a \cdot a\right) \cdot \left(a \cdot a + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 12 + -1\\
\end{array}
\end{array}
if (*.f64 b b) < 2.00000000000000012e290Initial program 73.1%
sub-neg73.1%
fma-def73.1%
fma-def73.1%
+-commutative73.1%
metadata-eval73.1%
Simplified73.1%
Taylor expanded in a around inf 86.4%
metadata-eval86.4%
pow-prod-up86.4%
pow286.4%
pow286.4%
fma-def86.4%
Applied egg-rr86.4%
fma-udef86.4%
difference-of-sqr--186.4%
Applied egg-rr86.4%
if 2.00000000000000012e290 < (*.f64 b b) Initial program 51.4%
sub-neg51.4%
fma-def51.4%
fma-def55.7%
+-commutative55.7%
metadata-eval55.7%
Simplified55.7%
Taylor expanded in a around 0 38.6%
associate-+r+38.6%
+-commutative38.6%
associate-*r*38.6%
distribute-rgt-out65.7%
unpow265.7%
Simplified65.7%
Taylor expanded in b around 0 62.0%
+-commutative62.0%
*-commutative62.0%
fma-udef62.0%
*-commutative62.0%
unpow262.0%
Simplified62.0%
Taylor expanded in a around 0 96.3%
unpow296.3%
*-commutative96.3%
associate-*l*96.3%
Simplified96.3%
Taylor expanded in b around 0 96.3%
unpow296.3%
Simplified96.3%
Final simplification89.1%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e+290) (+ (* (* a a) (+ 4.0 (* a a))) -1.0) (+ (* (* b b) 12.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+290) {
tmp = ((a * a) * (4.0 + (a * a))) + -1.0;
} else {
tmp = ((b * b) * 12.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 ((b * b) <= 2d+290) then
tmp = ((a * a) * (4.0d0 + (a * a))) + (-1.0d0)
else
tmp = ((b * b) * 12.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+290) {
tmp = ((a * a) * (4.0 + (a * a))) + -1.0;
} else {
tmp = ((b * b) * 12.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e+290: tmp = ((a * a) * (4.0 + (a * a))) + -1.0 else: tmp = ((b * b) * 12.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+290) tmp = Float64(Float64(Float64(a * a) * Float64(4.0 + Float64(a * a))) + -1.0); else tmp = Float64(Float64(Float64(b * b) * 12.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e+290) tmp = ((a * a) * (4.0 + (a * a))) + -1.0; else tmp = ((b * b) * 12.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+290], N[(N[(N[(a * a), $MachinePrecision] * N[(4.0 + N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+290}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(4 + a \cdot a\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 12 + -1\\
\end{array}
\end{array}
if (*.f64 b b) < 2.00000000000000012e290Initial program 73.1%
associate--l+73.1%
fma-def73.1%
fma-neg73.1%
associate-*l*73.1%
fma-def73.1%
+-commutative73.1%
metadata-eval73.1%
Simplified73.1%
Taylor expanded in b around 0 67.8%
associate--l+67.8%
unpow267.8%
Simplified67.8%
Taylor expanded in a around 0 86.5%
*-commutative86.5%
unpow286.5%
associate-*l*86.5%
Simplified86.5%
associate-+r-86.5%
sqr-pow86.5%
metadata-eval86.5%
pow286.5%
metadata-eval86.5%
pow286.5%
associate-*r*86.5%
distribute-lft-out86.5%
Applied egg-rr86.5%
if 2.00000000000000012e290 < (*.f64 b b) Initial program 51.4%
sub-neg51.4%
fma-def51.4%
fma-def55.7%
+-commutative55.7%
metadata-eval55.7%
Simplified55.7%
Taylor expanded in a around 0 38.6%
associate-+r+38.6%
+-commutative38.6%
associate-*r*38.6%
distribute-rgt-out65.7%
unpow265.7%
Simplified65.7%
Taylor expanded in b around 0 62.0%
+-commutative62.0%
*-commutative62.0%
fma-udef62.0%
*-commutative62.0%
unpow262.0%
Simplified62.0%
Taylor expanded in a around 0 96.3%
unpow296.3%
*-commutative96.3%
associate-*l*96.3%
Simplified96.3%
Taylor expanded in b around 0 96.3%
unpow296.3%
Simplified96.3%
Final simplification89.2%
(FPCore (a b) :precision binary64 (if (<= (* b b) 2e+281) (+ (* 4.0 (* a a)) -1.0) (+ (* (* b b) 12.0) -1.0)))
double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+281) {
tmp = (4.0 * (a * a)) + -1.0;
} else {
tmp = ((b * b) * 12.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 ((b * b) <= 2d+281) then
tmp = (4.0d0 * (a * a)) + (-1.0d0)
else
tmp = ((b * b) * 12.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 2e+281) {
tmp = (4.0 * (a * a)) + -1.0;
} else {
tmp = ((b * b) * 12.0) + -1.0;
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 2e+281: tmp = (4.0 * (a * a)) + -1.0 else: tmp = ((b * b) * 12.0) + -1.0 return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 2e+281) tmp = Float64(Float64(4.0 * Float64(a * a)) + -1.0); else tmp = Float64(Float64(Float64(b * b) * 12.0) + -1.0); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 2e+281) tmp = (4.0 * (a * a)) + -1.0; else tmp = ((b * b) * 12.0) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+281], N[(N[(4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+281}:\\
\;\;\;\;4 \cdot \left(a \cdot a\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot 12 + -1\\
\end{array}
\end{array}
if (*.f64 b b) < 2.0000000000000001e281Initial program 73.3%
associate--l+73.3%
fma-def73.3%
fma-neg73.3%
associate-*l*73.3%
fma-def73.3%
+-commutative73.3%
metadata-eval73.3%
Simplified73.3%
Taylor expanded in b around 0 68.0%
associate--l+68.0%
unpow268.0%
Simplified68.0%
Taylor expanded in a around 0 86.9%
*-commutative86.9%
unpow286.9%
associate-*l*86.9%
Simplified86.9%
associate-+r-86.9%
sqr-pow86.9%
metadata-eval86.9%
pow286.9%
metadata-eval86.9%
pow286.9%
associate-*r*86.9%
distribute-lft-out86.9%
Applied egg-rr86.9%
Taylor expanded in a around 0 74.2%
unpow274.2%
Simplified74.2%
if 2.0000000000000001e281 < (*.f64 b b) Initial program 51.4%
sub-neg51.4%
fma-def51.4%
fma-def55.6%
+-commutative55.6%
metadata-eval55.6%
Simplified55.6%
Taylor expanded in a around 0 38.9%
associate-+r+38.9%
+-commutative38.9%
associate-*r*38.9%
distribute-rgt-out65.3%
unpow265.3%
Simplified65.3%
Taylor expanded in b around 0 60.4%
+-commutative60.4%
*-commutative60.4%
fma-udef60.4%
*-commutative60.4%
unpow260.4%
Simplified60.4%
Taylor expanded in a around 0 93.9%
unpow293.9%
*-commutative93.9%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in b around 0 93.9%
unpow293.9%
Simplified93.9%
Final simplification79.7%
(FPCore (a b) :precision binary64 (+ (* (* b b) 12.0) -1.0))
double code(double a, double b) {
return ((b * b) * 12.0) + -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((b * b) * 12.0d0) + (-1.0d0)
end function
public static double code(double a, double b) {
return ((b * b) * 12.0) + -1.0;
}
def code(a, b): return ((b * b) * 12.0) + -1.0
function code(a, b) return Float64(Float64(Float64(b * b) * 12.0) + -1.0) end
function tmp = code(a, b) tmp = ((b * b) * 12.0) + -1.0; end
code[a_, b_] := N[(N[(N[(b * b), $MachinePrecision] * 12.0), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(b \cdot b\right) \cdot 12 + -1
\end{array}
Initial program 67.2%
sub-neg67.2%
fma-def67.2%
fma-def68.3%
+-commutative68.3%
metadata-eval68.3%
Simplified68.3%
Taylor expanded in a around 0 52.2%
associate-+r+52.2%
+-commutative52.2%
associate-*r*52.2%
distribute-rgt-out59.6%
unpow259.6%
Simplified59.6%
Taylor expanded in b around 0 50.3%
+-commutative50.3%
*-commutative50.3%
fma-udef50.3%
*-commutative50.3%
unpow250.3%
Simplified50.3%
Taylor expanded in a around 0 57.0%
unpow257.0%
*-commutative57.0%
associate-*l*57.0%
Simplified57.0%
Taylor expanded in b around 0 57.0%
unpow257.0%
Simplified57.0%
Final simplification57.0%
(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 67.2%
sub-neg67.2%
fma-def67.2%
fma-def68.3%
+-commutative68.3%
metadata-eval68.3%
Simplified68.3%
Taylor expanded in a around inf 72.9%
Taylor expanded in a around 0 29.4%
Final simplification29.4%
herbie shell --seed 2023250
(FPCore (a b)
:name "Bouland and Aaronson, Equation (24)"
:precision binary64
(- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 3.0 a))))) 1.0))