
(FPCore (a b) :precision binary64 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 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 * (b * b))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(b * b))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (b * b))) - 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[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\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 (* b b))) 1.0))
double code(double a, double b) {
return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 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 * (b * b))) - 1.0d0
end function
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0
function code(a, b) return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(b * b))) - 1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (b * b))) - 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[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\end{array}
(FPCore (a b) :precision binary64 (+ (+ (* (hypot a b) (* (hypot a b) (pow (hypot a b) 2.0))) (* 4.0 (* b b))) -1.0))
double code(double a, double b) {
return ((hypot(a, b) * (hypot(a, b) * pow(hypot(a, b), 2.0))) + (4.0 * (b * b))) + -1.0;
}
public static double code(double a, double b) {
return ((Math.hypot(a, b) * (Math.hypot(a, b) * Math.pow(Math.hypot(a, b), 2.0))) + (4.0 * (b * b))) + -1.0;
}
def code(a, b): return ((math.hypot(a, b) * (math.hypot(a, b) * math.pow(math.hypot(a, b), 2.0))) + (4.0 * (b * b))) + -1.0
function code(a, b) return Float64(Float64(Float64(hypot(a, b) * Float64(hypot(a, b) * (hypot(a, b) ^ 2.0))) + Float64(4.0 * Float64(b * b))) + -1.0) end
function tmp = code(a, b) tmp = ((hypot(a, b) * (hypot(a, b) * (hypot(a, b) ^ 2.0))) + (4.0 * (b * b))) + -1.0; end
code[a_, b_] := N[(N[(N[(N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision] * N[(N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision] * N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{hypot}\left(a, b\right) \cdot \left(\mathsf{hypot}\left(a, b\right) \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right) + 4 \cdot \left(b \cdot b\right)\right) + -1
\end{array}
Initial program 99.8%
unpow299.8%
add-sqr-sqrt99.8%
associate-*l*99.9%
hypot-define99.9%
hypot-define99.9%
add-sqr-sqrt99.9%
pow299.9%
hypot-define99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (a b) :precision binary64 (if (<= (* b b) 0.5) (+ (+ (* 4.0 (* b b)) (pow a 4.0)) -1.0) (* (pow b 4.0) (+ 1.0 (/ 4.0 (* b b))))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = ((4.0 * (b * b)) + pow(a, 4.0)) + -1.0;
} else {
tmp = pow(b, 4.0) * (1.0 + (4.0 / (b * b)));
}
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 = ((4.0d0 * (b * b)) + (a ** 4.0d0)) + (-1.0d0)
else
tmp = (b ** 4.0d0) * (1.0d0 + (4.0d0 / (b * b)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 0.5) {
tmp = ((4.0 * (b * b)) + Math.pow(a, 4.0)) + -1.0;
} else {
tmp = Math.pow(b, 4.0) * (1.0 + (4.0 / (b * b)));
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 0.5: tmp = ((4.0 * (b * b)) + math.pow(a, 4.0)) + -1.0 else: tmp = math.pow(b, 4.0) * (1.0 + (4.0 / (b * b))) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 0.5) tmp = Float64(Float64(Float64(4.0 * Float64(b * b)) + (a ^ 4.0)) + -1.0); else tmp = Float64((b ^ 4.0) * Float64(1.0 + Float64(4.0 / Float64(b * b)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 0.5) tmp = ((4.0 * (b * b)) + (a ^ 4.0)) + -1.0; else tmp = (b ^ 4.0) * (1.0 + (4.0 / (b * b))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 0.5], N[(N[(N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision] + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[b, 4.0], $MachinePrecision] * N[(1.0 + N[(4.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 0.5:\\
\;\;\;\;\left(4 \cdot \left(b \cdot b\right) + {a}^{4}\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} \cdot \left(1 + \frac{4}{b \cdot b}\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 0.5Initial program 99.8%
Taylor expanded in a around inf 99.8%
if 0.5 < (*.f64 b b) Initial program 99.7%
Taylor expanded in a around 0 90.4%
Taylor expanded in b around inf 90.4%
associate-*r/90.4%
metadata-eval90.4%
Simplified90.4%
pow290.4%
Applied egg-rr90.4%
Final simplification95.2%
(FPCore (a b) :precision binary64 (if (<= (* b b) 0.5) (+ (pow a 4.0) -1.0) (* (pow b 4.0) (+ 1.0 (/ 4.0 (* b b))))))
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) * (1.0 + (4.0 / (b * b)));
}
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) * (1.0d0 + (4.0d0 / (b * b)))
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) * (1.0 + (4.0 / (b * b)));
}
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) * (1.0 + (4.0 / (b * b))) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 0.5) tmp = Float64((a ^ 4.0) + -1.0); else tmp = Float64((b ^ 4.0) * Float64(1.0 + Float64(4.0 / Float64(b * b)))); 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) * (1.0 + (4.0 / (b * b))); 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[(N[Power[b, 4.0], $MachinePrecision] * N[(1.0 + N[(4.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 0.5:\\
\;\;\;\;{a}^{4} + -1\\
\mathbf{else}:\\
\;\;\;\;{b}^{4} \cdot \left(1 + \frac{4}{b \cdot b}\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 0.5Initial program 99.8%
unpow299.8%
add-sqr-sqrt99.8%
associate-*l*99.9%
hypot-define99.9%
hypot-define99.9%
add-sqr-sqrt99.9%
pow299.9%
hypot-define99.9%
Applied egg-rr99.9%
Taylor expanded in b around 0 99.2%
if 0.5 < (*.f64 b b) Initial program 99.7%
Taylor expanded in a around 0 90.4%
Taylor expanded in b around inf 90.4%
associate-*r/90.4%
metadata-eval90.4%
Simplified90.4%
pow290.4%
Applied egg-rr90.4%
Final simplification94.9%
(FPCore (a b) :precision binary64 (+ (+ (* 4.0 (* b b)) (pow (+ (* b b) (* a a)) 2.0)) -1.0))
double code(double a, double b) {
return ((4.0 * (b * b)) + pow(((b * b) + (a * a)), 2.0)) + -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((4.0d0 * (b * b)) + (((b * b) + (a * a)) ** 2.0d0)) + (-1.0d0)
end function
public static double code(double a, double b) {
return ((4.0 * (b * b)) + Math.pow(((b * b) + (a * a)), 2.0)) + -1.0;
}
def code(a, b): return ((4.0 * (b * b)) + math.pow(((b * b) + (a * a)), 2.0)) + -1.0
function code(a, b) return Float64(Float64(Float64(4.0 * Float64(b * b)) + (Float64(Float64(b * b) + Float64(a * a)) ^ 2.0)) + -1.0) end
function tmp = code(a, b) tmp = ((4.0 * (b * b)) + (((b * b) + (a * a)) ^ 2.0)) + -1.0; end
code[a_, b_] := N[(N[(N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(b * b), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(4 \cdot \left(b \cdot b\right) + {\left(b \cdot b + a \cdot a\right)}^{2}\right) + -1
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* 4.0 (* b b))))
(if (<= a 800000000.0)
(+ (+ t_0 (pow b 4.0)) -1.0)
(+ (+ t_0 (pow a 4.0)) -1.0))))
double code(double a, double b) {
double t_0 = 4.0 * (b * b);
double tmp;
if (a <= 800000000.0) {
tmp = (t_0 + pow(b, 4.0)) + -1.0;
} else {
tmp = (t_0 + pow(a, 4.0)) + -1.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) :: tmp
t_0 = 4.0d0 * (b * b)
if (a <= 800000000.0d0) then
tmp = (t_0 + (b ** 4.0d0)) + (-1.0d0)
else
tmp = (t_0 + (a ** 4.0d0)) + (-1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = 4.0 * (b * b);
double tmp;
if (a <= 800000000.0) {
tmp = (t_0 + Math.pow(b, 4.0)) + -1.0;
} else {
tmp = (t_0 + Math.pow(a, 4.0)) + -1.0;
}
return tmp;
}
def code(a, b): t_0 = 4.0 * (b * b) tmp = 0 if a <= 800000000.0: tmp = (t_0 + math.pow(b, 4.0)) + -1.0 else: tmp = (t_0 + math.pow(a, 4.0)) + -1.0 return tmp
function code(a, b) t_0 = Float64(4.0 * Float64(b * b)) tmp = 0.0 if (a <= 800000000.0) tmp = Float64(Float64(t_0 + (b ^ 4.0)) + -1.0); else tmp = Float64(Float64(t_0 + (a ^ 4.0)) + -1.0); end return tmp end
function tmp_2 = code(a, b) t_0 = 4.0 * (b * b); tmp = 0.0; if (a <= 800000000.0) tmp = (t_0 + (b ^ 4.0)) + -1.0; else tmp = (t_0 + (a ^ 4.0)) + -1.0; end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 800000000.0], N[(N[(t$95$0 + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(t$95$0 + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \left(b \cdot b\right)\\
\mathbf{if}\;a \leq 800000000:\\
\;\;\;\;\left(t\_0 + {b}^{4}\right) + -1\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 + {a}^{4}\right) + -1\\
\end{array}
\end{array}
if a < 8e8Initial program 99.8%
Taylor expanded in a around 0 80.9%
if 8e8 < a Initial program 99.8%
Taylor expanded in a around inf 97.1%
Final simplification85.0%
(FPCore (a b) :precision binary64 (if (<= a 2.05e-32) (+ (* 4.0 (* b b)) -1.0) (if (<= a 85000000000.0) (pow b 4.0) (pow a 4.0))))
double code(double a, double b) {
double tmp;
if (a <= 2.05e-32) {
tmp = (4.0 * (b * b)) + -1.0;
} else if (a <= 85000000000.0) {
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 <= 2.05d-32) then
tmp = (4.0d0 * (b * b)) + (-1.0d0)
else if (a <= 85000000000.0d0) 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 <= 2.05e-32) {
tmp = (4.0 * (b * b)) + -1.0;
} else if (a <= 85000000000.0) {
tmp = Math.pow(b, 4.0);
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= 2.05e-32: tmp = (4.0 * (b * b)) + -1.0 elif a <= 85000000000.0: tmp = math.pow(b, 4.0) else: tmp = math.pow(a, 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= 2.05e-32) tmp = Float64(Float64(4.0 * Float64(b * b)) + -1.0); elseif (a <= 85000000000.0) tmp = b ^ 4.0; else tmp = a ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= 2.05e-32) tmp = (4.0 * (b * b)) + -1.0; elseif (a <= 85000000000.0) tmp = b ^ 4.0; else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, 2.05e-32], N[(N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[a, 85000000000.0], N[Power[b, 4.0], $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.05 \cdot 10^{-32}:\\
\;\;\;\;4 \cdot \left(b \cdot b\right) + -1\\
\mathbf{elif}\;a \leq 85000000000:\\
\;\;\;\;{b}^{4}\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if a < 2.04999999999999988e-32Initial program 99.8%
Taylor expanded in a around inf 79.9%
Taylor expanded in a around 0 58.2%
pow244.2%
Applied egg-rr58.2%
if 2.04999999999999988e-32 < a < 8.5e10Initial program 99.7%
Taylor expanded in a around 0 99.6%
Taylor expanded in b around inf 90.2%
associate-*r/90.2%
metadata-eval90.2%
Simplified90.2%
Taylor expanded in b around inf 90.2%
if 8.5e10 < a Initial program 99.8%
unpow299.8%
add-sqr-sqrt99.8%
associate-*l*99.9%
hypot-define99.9%
hypot-define99.9%
add-sqr-sqrt99.8%
pow299.9%
hypot-define99.9%
Applied egg-rr99.9%
Taylor expanded in b around 0 91.3%
Taylor expanded in a around inf 91.3%
Final simplification67.8%
(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 99.8%
unpow299.8%
add-sqr-sqrt99.8%
associate-*l*99.9%
hypot-define99.9%
hypot-define99.9%
add-sqr-sqrt99.9%
pow299.9%
hypot-define99.9%
Applied egg-rr99.9%
Taylor expanded in b around 0 99.2%
if 0.5 < (*.f64 b b) Initial program 99.7%
Taylor expanded in a around 0 90.4%
Taylor expanded in b around inf 90.4%
associate-*r/90.4%
metadata-eval90.4%
Simplified90.4%
Taylor expanded in b around inf 90.4%
Final simplification94.9%
(FPCore (a b) :precision binary64 (if (<= a 75000000000.0) (+ (* 4.0 (* b b)) -1.0) (pow a 4.0)))
double code(double a, double b) {
double tmp;
if (a <= 75000000000.0) {
tmp = (4.0 * (b * b)) + -1.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 <= 75000000000.0d0) then
tmp = (4.0d0 * (b * b)) + (-1.0d0)
else
tmp = a ** 4.0d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= 75000000000.0) {
tmp = (4.0 * (b * b)) + -1.0;
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= 75000000000.0: tmp = (4.0 * (b * b)) + -1.0 else: tmp = math.pow(a, 4.0) return tmp
function code(a, b) tmp = 0.0 if (a <= 75000000000.0) tmp = Float64(Float64(4.0 * Float64(b * b)) + -1.0); else tmp = a ^ 4.0; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= 75000000000.0) tmp = (4.0 * (b * b)) + -1.0; else tmp = a ^ 4.0; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, 75000000000.0], N[(N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 75000000000:\\
\;\;\;\;4 \cdot \left(b \cdot b\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\end{array}
\end{array}
if a < 7.5e10Initial program 99.8%
Taylor expanded in a around inf 78.0%
Taylor expanded in a around 0 57.5%
pow246.6%
Applied egg-rr57.5%
if 7.5e10 < a Initial program 99.8%
unpow299.8%
add-sqr-sqrt99.8%
associate-*l*99.9%
hypot-define99.9%
hypot-define99.9%
add-sqr-sqrt99.8%
pow299.9%
hypot-define99.9%
Applied egg-rr99.9%
Taylor expanded in b around 0 91.3%
Taylor expanded in a around inf 91.3%
Final simplification65.9%
(FPCore (a b) :precision binary64 (if (<= (* b b) 0.0125) -1.0 (* 4.0 (* b b))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 0.0125) {
tmp = -1.0;
} else {
tmp = 4.0 * (b * b);
}
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.0125d0) then
tmp = -1.0d0
else
tmp = 4.0d0 * (b * b)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if ((b * b) <= 0.0125) {
tmp = -1.0;
} else {
tmp = 4.0 * (b * b);
}
return tmp;
}
def code(a, b): tmp = 0 if (b * b) <= 0.0125: tmp = -1.0 else: tmp = 4.0 * (b * b) return tmp
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 0.0125) tmp = -1.0; else tmp = Float64(4.0 * Float64(b * b)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if ((b * b) <= 0.0125) tmp = -1.0; else tmp = 4.0 * (b * b); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 0.0125], -1.0, N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 0.0125:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \left(b \cdot b\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 0.012500000000000001Initial program 99.8%
Taylor expanded in a around 0 52.3%
Taylor expanded in b around 0 51.5%
if 0.012500000000000001 < (*.f64 b b) Initial program 99.7%
Taylor expanded in a around inf 65.5%
Taylor expanded in b around inf 49.8%
pow289.1%
Applied egg-rr49.8%
(FPCore (a b) :precision binary64 (+ (* 4.0 (* b b)) -1.0))
double code(double a, double b) {
return (4.0 * (b * b)) + -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (4.0d0 * (b * b)) + (-1.0d0)
end function
public static double code(double a, double b) {
return (4.0 * (b * b)) + -1.0;
}
def code(a, b): return (4.0 * (b * b)) + -1.0
function code(a, b) return Float64(Float64(4.0 * Float64(b * b)) + -1.0) end
function tmp = code(a, b) tmp = (4.0 * (b * b)) + -1.0; end
code[a_, b_] := N[(N[(4.0 * N[(b * b), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \left(b \cdot b\right) + -1
\end{array}
Initial program 99.8%
Taylor expanded in a around inf 82.8%
Taylor expanded in a around 0 50.9%
pow244.9%
Applied egg-rr50.9%
Final simplification50.9%
(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 99.8%
Taylor expanded in a around 0 70.5%
Taylor expanded in b around 0 26.3%
herbie shell --seed 2024163
(FPCore (a b)
:name "Bouland and Aaronson, Equation (26)"
:precision binary64
(- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))