
(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 14 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)
(pow 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 = pow(a, 4.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(a + 1.0)) + Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0)))))) <= Inf) tmp = Float64(fma(4.0, fma(a, fma(a, a, a), Float64(b * Float64(b * fma(a, -3.0, 1.0)))), (hypot(a, b) ^ 4.0)) + -1.0); else tmp = a ^ 4.0; end return tmp end
code[a_, b_] := If[LessEqual[N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(4.0 * N[(a * N[(a * a + a), $MachinePrecision] + N[(b * N[(b * N[(a * -3.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[Power[a, 4.0], $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), b \cdot \left(b \cdot \mathsf{fma}\left(a, -3, 1\right)\right)\right), {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4}\right) + -1\\
\mathbf{else}:\\
\;\;\;\;{a}^{4}\\
\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.7%
sub-neg99.7%
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%
fma-def0.0%
Simplified7.7%
Taylor expanded in a around inf 94.1%
Final simplification98.5%
(FPCore (a b)
:precision binary64
(let* ((t_0
(+
(pow (+ (* a a) (* b b)) 2.0)
(* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))))
(if (<= t_0 INFINITY) (+ t_0 -1.0) (pow a 4.0))))
double code(double a, double b) {
double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 + -1.0;
} else {
tmp = pow(a, 4.0);
}
return tmp;
}
public static double code(double a, double b) {
double t_0 = Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 + -1.0;
} else {
tmp = Math.pow(a, 4.0);
}
return tmp;
}
def code(a, b): t_0 = math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0))))) tmp = 0 if t_0 <= math.inf: tmp = t_0 + -1.0 else: tmp = math.pow(a, 4.0) 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 = 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 = 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[Power[a, 4.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}^{4}\\
\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.7%
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%
fma-def0.0%
Simplified7.7%
Taylor expanded in a around inf 94.1%
Final simplification98.3%
(FPCore (a b)
:precision binary64
(if (<= (* b b) 4e-130)
(+ (pow a 4.0) (+ -1.0 (* (+ a 1.0) (* (* a a) 4.0))))
(if (<= (* b b) 1e-34)
(fma 4.0 (* a a) -1.0)
(if (<= (* b b) 1000000.0) (pow a 4.0) (* (* b b) (+ (* b b) 4.0))))))
double code(double a, double b) {
double tmp;
if ((b * b) <= 4e-130) {
tmp = pow(a, 4.0) + (-1.0 + ((a + 1.0) * ((a * a) * 4.0)));
} else if ((b * b) <= 1e-34) {
tmp = fma(4.0, (a * a), -1.0);
} else if ((b * b) <= 1000000.0) {
tmp = pow(a, 4.0);
} else {
tmp = (b * b) * ((b * b) + 4.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64(b * b) <= 4e-130) tmp = Float64((a ^ 4.0) + Float64(-1.0 + Float64(Float64(a + 1.0) * Float64(Float64(a * a) * 4.0)))); elseif (Float64(b * b) <= 1e-34) tmp = fma(4.0, Float64(a * a), -1.0); elseif (Float64(b * b) <= 1000000.0) tmp = a ^ 4.0; else tmp = Float64(Float64(b * b) * Float64(Float64(b * b) + 4.0)); end return tmp end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 4e-130], N[(N[Power[a, 4.0], $MachinePrecision] + N[(-1.0 + N[(N[(a + 1.0), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * b), $MachinePrecision], 1e-34], N[(4.0 * N[(a * a), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[N[(b * b), $MachinePrecision], 1000000.0], N[Power[a, 4.0], $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 4 \cdot 10^{-130}:\\
\;\;\;\;{a}^{4} + \left(-1 + \left(a + 1\right) \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right)\\
\mathbf{elif}\;b \cdot b \leq 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left(4, a \cdot a, -1\right)\\
\mathbf{elif}\;b \cdot b \leq 1000000:\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b + 4\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 4.0000000000000003e-130Initial program 86.3%
associate--l+86.3%
fma-def86.3%
Simplified86.3%
Taylor expanded in b around 0 86.5%
associate--l+86.5%
associate-*r*86.5%
unpow286.5%
Simplified86.5%
if 4.0000000000000003e-130 < (*.f64 b b) < 9.99999999999999928e-35Initial program 70.8%
associate--l+70.8%
fma-def70.8%
Simplified70.8%
Taylor expanded in b around 0 70.8%
associate--l+70.8%
associate-*r*70.8%
unpow270.8%
Simplified70.8%
Taylor expanded in a around 0 92.4%
fma-neg92.4%
unpow292.4%
metadata-eval92.4%
Simplified92.4%
if 9.99999999999999928e-35 < (*.f64 b b) < 1e6Initial program 62.3%
associate--l+62.3%
fma-def62.3%
Simplified62.3%
Taylor expanded in a around inf 75.8%
if 1e6 < (*.f64 b b) Initial program 65.6%
associate--l+65.6%
fma-def65.6%
Simplified69.8%
Taylor expanded in b around inf 97.7%
*-commutative97.7%
fma-def97.7%
unpow297.7%
+-commutative97.7%
+-commutative97.7%
fma-def97.7%
unpow297.7%
distribute-lft-in97.7%
metadata-eval97.7%
associate-*r*97.7%
metadata-eval97.7%
Simplified97.7%
Taylor expanded in a around 0 90.6%
fma-def90.6%
unpow290.6%
Simplified90.6%
fma-udef90.6%
metadata-eval90.6%
pow-sqr90.5%
pow290.5%
pow290.5%
distribute-rgt-out90.5%
Applied egg-rr90.5%
Final simplification88.6%
(FPCore (a b)
:precision binary64
(let* ((t_0 (fma 4.0 (* a a) -1.0)))
(if (<= (* b b) 1e-286)
t_0
(if (<= (* b b) 1e-180)
(pow a 4.0)
(if (<= (* b b) 1000000.0) t_0 (* (* b b) (+ (* b b) 4.0)))))))
double code(double a, double b) {
double t_0 = fma(4.0, (a * a), -1.0);
double tmp;
if ((b * b) <= 1e-286) {
tmp = t_0;
} else if ((b * b) <= 1e-180) {
tmp = pow(a, 4.0);
} else if ((b * b) <= 1000000.0) {
tmp = t_0;
} else {
tmp = (b * b) * ((b * b) + 4.0);
}
return tmp;
}
function code(a, b) t_0 = fma(4.0, Float64(a * a), -1.0) tmp = 0.0 if (Float64(b * b) <= 1e-286) tmp = t_0; elseif (Float64(b * b) <= 1e-180) tmp = a ^ 4.0; elseif (Float64(b * b) <= 1000000.0) tmp = t_0; else tmp = Float64(Float64(b * b) * Float64(Float64(b * b) + 4.0)); end return tmp end
code[a_, b_] := Block[{t$95$0 = N[(4.0 * N[(a * a), $MachinePrecision] + -1.0), $MachinePrecision]}, If[LessEqual[N[(b * b), $MachinePrecision], 1e-286], t$95$0, If[LessEqual[N[(b * b), $MachinePrecision], 1e-180], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[N[(b * b), $MachinePrecision], 1000000.0], t$95$0, N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(4, a \cdot a, -1\right)\\
\mathbf{if}\;b \cdot b \leq 10^{-286}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;b \cdot b \leq 10^{-180}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;b \cdot b \leq 1000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b + 4\right)\\
\end{array}
\end{array}
if (*.f64 b b) < 1.00000000000000005e-286 or 1e-180 < (*.f64 b b) < 1e6Initial program 82.0%
associate--l+82.0%
fma-def82.0%
Simplified82.0%
Taylor expanded in b around 0 82.0%
associate--l+82.0%
associate-*r*82.0%
unpow282.0%
Simplified82.0%
Taylor expanded in a around 0 73.7%
fma-neg73.7%
unpow273.7%
metadata-eval73.7%
Simplified73.7%
if 1.00000000000000005e-286 < (*.f64 b b) < 1e-180Initial program 83.0%
associate--l+83.0%
fma-def83.0%
Simplified83.0%
Taylor expanded in a around inf 78.3%
if 1e6 < (*.f64 b b) Initial program 65.6%
associate--l+65.6%
fma-def65.6%
Simplified69.8%
Taylor expanded in b around inf 97.7%
*-commutative97.7%
fma-def97.7%
unpow297.7%
+-commutative97.7%
+-commutative97.7%
fma-def97.7%
unpow297.7%
distribute-lft-in97.7%
metadata-eval97.7%
associate-*r*97.7%
metadata-eval97.7%
Simplified97.7%
Taylor expanded in a around 0 90.6%
fma-def90.6%
unpow290.6%
Simplified90.6%
fma-udef90.6%
metadata-eval90.6%
pow-sqr90.5%
pow290.5%
pow290.5%
distribute-rgt-out90.5%
Applied egg-rr90.5%
Final simplification81.9%
(FPCore (a b)
:precision binary64
(if (<= b 1.2e-286)
-1.0
(if (<= b 8.5e-232)
(pow a 4.0)
(if (<= b 3.6e-208)
-1.0
(if (<= b 3200.0) (pow a 4.0) (* (* b b) (+ (* b b) 4.0)))))))
double code(double a, double b) {
double tmp;
if (b <= 1.2e-286) {
tmp = -1.0;
} else if (b <= 8.5e-232) {
tmp = pow(a, 4.0);
} else if (b <= 3.6e-208) {
tmp = -1.0;
} else if (b <= 3200.0) {
tmp = pow(a, 4.0);
} else {
tmp = (b * b) * ((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 <= 1.2d-286) then
tmp = -1.0d0
else if (b <= 8.5d-232) then
tmp = a ** 4.0d0
else if (b <= 3.6d-208) then
tmp = -1.0d0
else if (b <= 3200.0d0) then
tmp = a ** 4.0d0
else
tmp = (b * b) * ((b * b) + 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 1.2e-286) {
tmp = -1.0;
} else if (b <= 8.5e-232) {
tmp = Math.pow(a, 4.0);
} else if (b <= 3.6e-208) {
tmp = -1.0;
} else if (b <= 3200.0) {
tmp = Math.pow(a, 4.0);
} else {
tmp = (b * b) * ((b * b) + 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1.2e-286: tmp = -1.0 elif b <= 8.5e-232: tmp = math.pow(a, 4.0) elif b <= 3.6e-208: tmp = -1.0 elif b <= 3200.0: tmp = math.pow(a, 4.0) else: tmp = (b * b) * ((b * b) + 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 1.2e-286) tmp = -1.0; elseif (b <= 8.5e-232) tmp = a ^ 4.0; elseif (b <= 3.6e-208) tmp = -1.0; elseif (b <= 3200.0) tmp = a ^ 4.0; else tmp = Float64(Float64(b * b) * Float64(Float64(b * b) + 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 1.2e-286) tmp = -1.0; elseif (b <= 8.5e-232) tmp = a ^ 4.0; elseif (b <= 3.6e-208) tmp = -1.0; elseif (b <= 3200.0) tmp = a ^ 4.0; else tmp = (b * b) * ((b * b) + 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1.2e-286], -1.0, If[LessEqual[b, 8.5e-232], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[b, 3.6e-208], -1.0, If[LessEqual[b, 3200.0], N[Power[a, 4.0], $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.2 \cdot 10^{-286}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{-232}:\\
\;\;\;\;{a}^{4}\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{-208}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 3200:\\
\;\;\;\;{a}^{4}\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b + 4\right)\\
\end{array}
\end{array}
if b < 1.19999999999999997e-286 or 8.5e-232 < b < 3.5999999999999998e-208Initial program 78.5%
associate--l+78.5%
fma-def78.5%
Simplified79.9%
Taylor expanded in b around 0 59.8%
associate--l+59.8%
associate-*r*59.8%
unpow259.8%
Simplified59.8%
Taylor expanded in a around 0 30.1%
if 1.19999999999999997e-286 < b < 8.5e-232 or 3.5999999999999998e-208 < b < 3200Initial program 81.4%
associate--l+81.4%
fma-def81.4%
Simplified81.4%
Taylor expanded in a around inf 68.3%
if 3200 < b Initial program 60.4%
associate--l+60.4%
fma-def60.4%
Simplified65.0%
Taylor expanded in b around inf 100.0%
*-commutative100.0%
fma-def100.0%
unpow2100.0%
+-commutative100.0%
+-commutative100.0%
fma-def100.0%
unpow2100.0%
distribute-lft-in100.0%
metadata-eval100.0%
associate-*r*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around 0 91.6%
fma-def91.6%
unpow291.6%
Simplified91.6%
fma-udef91.6%
metadata-eval91.6%
pow-sqr91.4%
pow291.4%
pow291.4%
distribute-rgt-out91.4%
Applied egg-rr91.4%
Final simplification53.2%
(FPCore (a b)
:precision binary64
(if (<= b 3.1e-112)
-1.0
(if (<= b 3400.0)
(* (* b b) (/ (* a (- 144.0 (* (* a a) 4.0))) (+ -12.0 (* a -2.0))))
(* (* b b) (+ (* b b) 4.0)))))
double code(double a, double b) {
double tmp;
if (b <= 3.1e-112) {
tmp = -1.0;
} else if (b <= 3400.0) {
tmp = (b * b) * ((a * (144.0 - ((a * a) * 4.0))) / (-12.0 + (a * -2.0)));
} else {
tmp = (b * b) * ((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 <= 3.1d-112) then
tmp = -1.0d0
else if (b <= 3400.0d0) then
tmp = (b * b) * ((a * (144.0d0 - ((a * a) * 4.0d0))) / ((-12.0d0) + (a * (-2.0d0))))
else
tmp = (b * b) * ((b * b) + 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 3.1e-112) {
tmp = -1.0;
} else if (b <= 3400.0) {
tmp = (b * b) * ((a * (144.0 - ((a * a) * 4.0))) / (-12.0 + (a * -2.0)));
} else {
tmp = (b * b) * ((b * b) + 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 3.1e-112: tmp = -1.0 elif b <= 3400.0: tmp = (b * b) * ((a * (144.0 - ((a * a) * 4.0))) / (-12.0 + (a * -2.0))) else: tmp = (b * b) * ((b * b) + 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 3.1e-112) tmp = -1.0; elseif (b <= 3400.0) tmp = Float64(Float64(b * b) * Float64(Float64(a * Float64(144.0 - Float64(Float64(a * a) * 4.0))) / Float64(-12.0 + Float64(a * -2.0)))); else tmp = Float64(Float64(b * b) * Float64(Float64(b * b) + 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 3.1e-112) tmp = -1.0; elseif (b <= 3400.0) tmp = (b * b) * ((a * (144.0 - ((a * a) * 4.0))) / (-12.0 + (a * -2.0))); else tmp = (b * b) * ((b * b) + 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 3.1e-112], -1.0, If[LessEqual[b, 3400.0], N[(N[(b * b), $MachinePrecision] * N[(N[(a * N[(144.0 - N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-12.0 + N[(a * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.1 \cdot 10^{-112}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 3400:\\
\;\;\;\;\left(b \cdot b\right) \cdot \frac{a \cdot \left(144 - \left(a \cdot a\right) \cdot 4\right)}{-12 + a \cdot -2}\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b + 4\right)\\
\end{array}
\end{array}
if b < 3.0999999999999998e-112Initial program 79.9%
associate--l+79.9%
fma-def79.9%
Simplified81.0%
Taylor expanded in b around 0 64.5%
associate--l+64.5%
associate-*r*64.5%
unpow264.5%
Simplified64.5%
Taylor expanded in a around 0 30.2%
if 3.0999999999999998e-112 < b < 3400Initial program 73.6%
associate--l+73.6%
fma-def73.6%
Simplified73.6%
Taylor expanded in b around inf 44.0%
*-commutative44.0%
fma-def44.0%
unpow244.0%
+-commutative44.0%
+-commutative44.0%
fma-def44.0%
unpow244.0%
distribute-lft-in44.0%
metadata-eval44.0%
associate-*r*44.0%
metadata-eval44.0%
Simplified44.0%
Taylor expanded in a around inf 44.3%
associate-*r*44.3%
*-commutative44.3%
unpow244.3%
associate-*r*44.3%
*-commutative44.3%
distribute-rgt-out44.3%
unpow244.3%
associate-*l*44.3%
distribute-lft-out44.3%
Simplified44.3%
*-commutative44.3%
flip-+44.3%
associate-*l/49.1%
metadata-eval49.1%
*-commutative49.1%
*-commutative49.1%
swap-sqr49.1%
metadata-eval49.1%
*-commutative49.1%
cancel-sign-sub-inv49.1%
metadata-eval49.1%
Applied egg-rr49.1%
if 3400 < b Initial program 60.4%
associate--l+60.4%
fma-def60.4%
Simplified65.0%
Taylor expanded in b around inf 100.0%
*-commutative100.0%
fma-def100.0%
unpow2100.0%
+-commutative100.0%
+-commutative100.0%
fma-def100.0%
unpow2100.0%
distribute-lft-in100.0%
metadata-eval100.0%
associate-*r*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around 0 91.6%
fma-def91.6%
unpow291.6%
Simplified91.6%
fma-udef91.6%
metadata-eval91.6%
pow-sqr91.4%
pow291.4%
pow291.4%
distribute-rgt-out91.4%
Applied egg-rr91.4%
Final simplification47.4%
(FPCore (a b)
:precision binary64
(if (<= b 2.05e-68)
-1.0
(if (<= b 1.08e-51)
(* (* b b) (* a (* a 2.0)))
(if (<= b 9.8e-45) -1.0 (* a (* (* b b) (* a 2.0)))))))
double code(double a, double b) {
double tmp;
if (b <= 2.05e-68) {
tmp = -1.0;
} else if (b <= 1.08e-51) {
tmp = (b * b) * (a * (a * 2.0));
} else if (b <= 9.8e-45) {
tmp = -1.0;
} else {
tmp = a * ((b * b) * (a * 2.0));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 2.05d-68) then
tmp = -1.0d0
else if (b <= 1.08d-51) then
tmp = (b * b) * (a * (a * 2.0d0))
else if (b <= 9.8d-45) then
tmp = -1.0d0
else
tmp = a * ((b * b) * (a * 2.0d0))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 2.05e-68) {
tmp = -1.0;
} else if (b <= 1.08e-51) {
tmp = (b * b) * (a * (a * 2.0));
} else if (b <= 9.8e-45) {
tmp = -1.0;
} else {
tmp = a * ((b * b) * (a * 2.0));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 2.05e-68: tmp = -1.0 elif b <= 1.08e-51: tmp = (b * b) * (a * (a * 2.0)) elif b <= 9.8e-45: tmp = -1.0 else: tmp = a * ((b * b) * (a * 2.0)) return tmp
function code(a, b) tmp = 0.0 if (b <= 2.05e-68) tmp = -1.0; elseif (b <= 1.08e-51) tmp = Float64(Float64(b * b) * Float64(a * Float64(a * 2.0))); elseif (b <= 9.8e-45) tmp = -1.0; else tmp = Float64(a * Float64(Float64(b * b) * Float64(a * 2.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 2.05e-68) tmp = -1.0; elseif (b <= 1.08e-51) tmp = (b * b) * (a * (a * 2.0)); elseif (b <= 9.8e-45) tmp = -1.0; else tmp = a * ((b * b) * (a * 2.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 2.05e-68], -1.0, If[LessEqual[b, 1.08e-51], N[(N[(b * b), $MachinePrecision] * N[(a * N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.8e-45], -1.0, N[(a * N[(N[(b * b), $MachinePrecision] * N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.05 \cdot 10^{-68}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 1.08 \cdot 10^{-51}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(a \cdot \left(a \cdot 2\right)\right)\\
\mathbf{elif}\;b \leq 9.8 \cdot 10^{-45}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(b \cdot b\right) \cdot \left(a \cdot 2\right)\right)\\
\end{array}
\end{array}
if b < 2.05000000000000011e-68 or 1.08000000000000004e-51 < b < 9.7999999999999996e-45Initial program 79.5%
associate--l+79.5%
fma-def79.5%
Simplified80.7%
Taylor expanded in b around 0 64.8%
associate--l+64.8%
associate-*r*64.8%
unpow264.8%
Simplified64.8%
Taylor expanded in a around 0 31.2%
if 2.05000000000000011e-68 < b < 1.08000000000000004e-51Initial program 74.8%
associate--l+74.8%
fma-def74.8%
Simplified74.8%
Taylor expanded in b around inf 51.3%
*-commutative51.3%
fma-def51.3%
unpow251.3%
+-commutative51.3%
+-commutative51.3%
fma-def51.3%
unpow251.3%
distribute-lft-in51.3%
metadata-eval51.3%
associate-*r*51.3%
metadata-eval51.3%
Simplified51.3%
Taylor expanded in a around inf 51.7%
unpow251.7%
associate-*r*51.7%
*-commutative51.7%
associate-*l*51.7%
unpow251.7%
Simplified51.7%
if 9.7999999999999996e-45 < b Initial program 61.3%
associate--l+61.3%
fma-def61.3%
Simplified65.5%
Taylor expanded in b around inf 95.9%
*-commutative95.9%
fma-def95.9%
unpow295.9%
+-commutative95.9%
+-commutative95.9%
fma-def95.9%
unpow295.9%
distribute-lft-in95.9%
metadata-eval95.9%
associate-*r*95.9%
metadata-eval95.9%
Simplified95.9%
Taylor expanded in a around inf 60.0%
unpow260.0%
associate-*r*60.0%
*-commutative60.0%
associate-*l*60.0%
associate-*l*65.7%
unpow265.7%
Simplified65.7%
Final simplification41.3%
(FPCore (a b)
:precision binary64
(if (<= b 2.1e-68)
-1.0
(if (<= b 6.8e-9)
(* (* b b) (* a (* a 2.0)))
(if (<= b 0.48) -1.0 (* (* b b) (+ (* b b) 4.0))))))
double code(double a, double b) {
double tmp;
if (b <= 2.1e-68) {
tmp = -1.0;
} else if (b <= 6.8e-9) {
tmp = (b * b) * (a * (a * 2.0));
} else if (b <= 0.48) {
tmp = -1.0;
} else {
tmp = (b * b) * ((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 <= 2.1d-68) then
tmp = -1.0d0
else if (b <= 6.8d-9) then
tmp = (b * b) * (a * (a * 2.0d0))
else if (b <= 0.48d0) then
tmp = -1.0d0
else
tmp = (b * b) * ((b * b) + 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 2.1e-68) {
tmp = -1.0;
} else if (b <= 6.8e-9) {
tmp = (b * b) * (a * (a * 2.0));
} else if (b <= 0.48) {
tmp = -1.0;
} else {
tmp = (b * b) * ((b * b) + 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 2.1e-68: tmp = -1.0 elif b <= 6.8e-9: tmp = (b * b) * (a * (a * 2.0)) elif b <= 0.48: tmp = -1.0 else: tmp = (b * b) * ((b * b) + 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 2.1e-68) tmp = -1.0; elseif (b <= 6.8e-9) tmp = Float64(Float64(b * b) * Float64(a * Float64(a * 2.0))); elseif (b <= 0.48) tmp = -1.0; else tmp = Float64(Float64(b * b) * Float64(Float64(b * b) + 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 2.1e-68) tmp = -1.0; elseif (b <= 6.8e-9) tmp = (b * b) * (a * (a * 2.0)); elseif (b <= 0.48) tmp = -1.0; else tmp = (b * b) * ((b * b) + 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 2.1e-68], -1.0, If[LessEqual[b, 6.8e-9], N[(N[(b * b), $MachinePrecision] * N[(a * N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 0.48], -1.0, N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.1 \cdot 10^{-68}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 6.8 \cdot 10^{-9}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(a \cdot \left(a \cdot 2\right)\right)\\
\mathbf{elif}\;b \leq 0.48:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b + 4\right)\\
\end{array}
\end{array}
if b < 2.10000000000000008e-68 or 6.7999999999999997e-9 < b < 0.47999999999999998Initial program 79.5%
associate--l+79.5%
fma-def79.5%
Simplified80.7%
Taylor expanded in b around 0 64.8%
associate--l+64.8%
associate-*r*64.8%
unpow264.8%
Simplified64.8%
Taylor expanded in a around 0 31.2%
if 2.10000000000000008e-68 < b < 6.7999999999999997e-9Initial program 81.7%
associate--l+81.7%
fma-def81.7%
Simplified81.7%
Taylor expanded in b around inf 47.3%
*-commutative47.3%
fma-def47.3%
unpow247.3%
+-commutative47.3%
+-commutative47.3%
fma-def47.3%
unpow247.3%
distribute-lft-in47.3%
metadata-eval47.3%
associate-*r*47.3%
metadata-eval47.3%
Simplified47.3%
Taylor expanded in a around inf 47.5%
unpow247.5%
associate-*r*47.5%
*-commutative47.5%
associate-*l*47.5%
unpow247.5%
Simplified47.5%
if 0.47999999999999998 < b Initial program 59.5%
associate--l+59.5%
fma-def59.5%
Simplified64.0%
Taylor expanded in b around inf 98.6%
*-commutative98.6%
fma-def98.6%
unpow298.6%
+-commutative98.6%
+-commutative98.6%
fma-def98.6%
unpow298.6%
distribute-lft-in98.6%
metadata-eval98.6%
associate-*r*98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in a around 0 90.3%
fma-def90.3%
unpow290.3%
Simplified90.3%
fma-udef90.3%
metadata-eval90.3%
pow-sqr90.1%
pow290.1%
pow290.1%
distribute-rgt-out90.1%
Applied egg-rr90.1%
Final simplification47.3%
(FPCore (a b)
:precision binary64
(if (<= b 4.1e-69)
-1.0
(if (<= b 8e-10)
(* (* b b) (* a (+ -12.0 (* a 2.0))))
(if (<= b 0.48) -1.0 (* (* b b) (+ (* b b) 4.0))))))
double code(double a, double b) {
double tmp;
if (b <= 4.1e-69) {
tmp = -1.0;
} else if (b <= 8e-10) {
tmp = (b * b) * (a * (-12.0 + (a * 2.0)));
} else if (b <= 0.48) {
tmp = -1.0;
} else {
tmp = (b * b) * ((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 <= 4.1d-69) then
tmp = -1.0d0
else if (b <= 8d-10) then
tmp = (b * b) * (a * ((-12.0d0) + (a * 2.0d0)))
else if (b <= 0.48d0) then
tmp = -1.0d0
else
tmp = (b * b) * ((b * b) + 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 4.1e-69) {
tmp = -1.0;
} else if (b <= 8e-10) {
tmp = (b * b) * (a * (-12.0 + (a * 2.0)));
} else if (b <= 0.48) {
tmp = -1.0;
} else {
tmp = (b * b) * ((b * b) + 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 4.1e-69: tmp = -1.0 elif b <= 8e-10: tmp = (b * b) * (a * (-12.0 + (a * 2.0))) elif b <= 0.48: tmp = -1.0 else: tmp = (b * b) * ((b * b) + 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 4.1e-69) tmp = -1.0; elseif (b <= 8e-10) tmp = Float64(Float64(b * b) * Float64(a * Float64(-12.0 + Float64(a * 2.0)))); elseif (b <= 0.48) tmp = -1.0; else tmp = Float64(Float64(b * b) * Float64(Float64(b * b) + 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 4.1e-69) tmp = -1.0; elseif (b <= 8e-10) tmp = (b * b) * (a * (-12.0 + (a * 2.0))); elseif (b <= 0.48) tmp = -1.0; else tmp = (b * b) * ((b * b) + 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 4.1e-69], -1.0, If[LessEqual[b, 8e-10], N[(N[(b * b), $MachinePrecision] * N[(a * N[(-12.0 + N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 0.48], -1.0, N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.1 \cdot 10^{-69}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 8 \cdot 10^{-10}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(a \cdot \left(-12 + a \cdot 2\right)\right)\\
\mathbf{elif}\;b \leq 0.48:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b + 4\right)\\
\end{array}
\end{array}
if b < 4.0999999999999999e-69 or 8.00000000000000029e-10 < b < 0.47999999999999998Initial program 79.5%
associate--l+79.5%
fma-def79.5%
Simplified80.7%
Taylor expanded in b around 0 64.8%
associate--l+64.8%
associate-*r*64.8%
unpow264.8%
Simplified64.8%
Taylor expanded in a around 0 31.2%
if 4.0999999999999999e-69 < b < 8.00000000000000029e-10Initial program 81.7%
associate--l+81.7%
fma-def81.7%
Simplified81.7%
Taylor expanded in b around inf 47.3%
*-commutative47.3%
fma-def47.3%
unpow247.3%
+-commutative47.3%
+-commutative47.3%
fma-def47.3%
unpow247.3%
distribute-lft-in47.3%
metadata-eval47.3%
associate-*r*47.3%
metadata-eval47.3%
Simplified47.3%
Taylor expanded in a around inf 47.5%
associate-*r*47.5%
*-commutative47.5%
unpow247.5%
associate-*r*47.5%
*-commutative47.5%
distribute-rgt-out47.5%
unpow247.5%
associate-*l*47.5%
distribute-lft-out47.5%
Simplified47.5%
if 0.47999999999999998 < b Initial program 59.5%
associate--l+59.5%
fma-def59.5%
Simplified64.0%
Taylor expanded in b around inf 98.6%
*-commutative98.6%
fma-def98.6%
unpow298.6%
+-commutative98.6%
+-commutative98.6%
fma-def98.6%
unpow298.6%
distribute-lft-in98.6%
metadata-eval98.6%
associate-*r*98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in a around 0 90.3%
fma-def90.3%
unpow290.3%
Simplified90.3%
fma-udef90.3%
metadata-eval90.3%
pow-sqr90.1%
pow290.1%
pow290.1%
distribute-rgt-out90.1%
Applied egg-rr90.1%
Final simplification47.3%
(FPCore (a b) :precision binary64 (if (<= b 9.8e-45) -1.0 (if (<= b 6.8e+153) (* 2.0 (* a (* b (* a b)))) (* b (* b 4.0)))))
double code(double a, double b) {
double tmp;
if (b <= 9.8e-45) {
tmp = -1.0;
} else if (b <= 6.8e+153) {
tmp = 2.0 * (a * (b * (a * b)));
} 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 <= 9.8d-45) then
tmp = -1.0d0
else if (b <= 6.8d+153) then
tmp = 2.0d0 * (a * (b * (a * b)))
else
tmp = b * (b * 4.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 9.8e-45) {
tmp = -1.0;
} else if (b <= 6.8e+153) {
tmp = 2.0 * (a * (b * (a * b)));
} else {
tmp = b * (b * 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 9.8e-45: tmp = -1.0 elif b <= 6.8e+153: tmp = 2.0 * (a * (b * (a * b))) else: tmp = b * (b * 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 9.8e-45) tmp = -1.0; elseif (b <= 6.8e+153) tmp = Float64(2.0 * Float64(a * Float64(b * Float64(a * b)))); else tmp = Float64(b * Float64(b * 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 9.8e-45) tmp = -1.0; elseif (b <= 6.8e+153) tmp = 2.0 * (a * (b * (a * b))); else tmp = b * (b * 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 9.8e-45], -1.0, If[LessEqual[b, 6.8e+153], N[(2.0 * N[(a * N[(b * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * N[(b * 4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.8 \cdot 10^{-45}:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 6.8 \cdot 10^{+153}:\\
\;\;\;\;2 \cdot \left(a \cdot \left(b \cdot \left(a \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot 4\right)\\
\end{array}
\end{array}
if b < 9.7999999999999996e-45Initial program 79.3%
associate--l+79.3%
fma-def79.3%
Simplified80.4%
Taylor expanded in b around 0 65.2%
associate--l+65.2%
associate-*r*65.2%
unpow265.2%
Simplified65.2%
Taylor expanded in a around 0 31.5%
if 9.7999999999999996e-45 < b < 6.7999999999999995e153Initial program 77.2%
associate--l+77.2%
fma-def77.2%
Simplified79.7%
Taylor expanded in b around inf 92.9%
*-commutative92.9%
fma-def92.9%
unpow292.9%
+-commutative92.9%
+-commutative92.9%
fma-def92.9%
unpow292.9%
distribute-lft-in92.9%
metadata-eval92.9%
associate-*r*92.9%
metadata-eval92.9%
Simplified92.9%
Taylor expanded in a around inf 37.1%
associate-*r*37.1%
*-commutative37.1%
unpow237.1%
associate-*r*37.1%
*-commutative37.1%
distribute-rgt-out39.6%
unpow239.6%
associate-*l*39.6%
distribute-lft-out39.6%
Simplified39.6%
*-commutative39.6%
flip-+39.6%
associate-*l/41.9%
metadata-eval41.9%
*-commutative41.9%
*-commutative41.9%
swap-sqr41.9%
metadata-eval41.9%
*-commutative41.9%
cancel-sign-sub-inv41.9%
metadata-eval41.9%
Applied egg-rr41.9%
Taylor expanded in a around inf 40.0%
unpow240.0%
unpow240.0%
associate-*l*40.0%
*-commutative40.0%
associate-*l*40.0%
Simplified40.0%
if 6.7999999999999995e153 < b Initial program 40.0%
associate--l+40.0%
fma-def40.0%
Simplified46.7%
Taylor expanded in b around inf 100.0%
*-commutative100.0%
fma-def100.0%
unpow2100.0%
+-commutative100.0%
+-commutative100.0%
fma-def100.0%
unpow2100.0%
distribute-lft-in100.0%
metadata-eval100.0%
associate-*r*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around 0 100.0%
fma-def100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in b around 0 100.0%
unpow2100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification40.9%
(FPCore (a b) :precision binary64 (if (<= b 0.48) -1.0 (if (<= b 6.8e+153) (* a (* (* b b) -12.0)) (* b (* b 4.0)))))
double code(double a, double b) {
double tmp;
if (b <= 0.48) {
tmp = -1.0;
} else if (b <= 6.8e+153) {
tmp = a * ((b * b) * -12.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.48d0) then
tmp = -1.0d0
else if (b <= 6.8d+153) then
tmp = a * ((b * b) * (-12.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.48) {
tmp = -1.0;
} else if (b <= 6.8e+153) {
tmp = a * ((b * b) * -12.0);
} else {
tmp = b * (b * 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 0.48: tmp = -1.0 elif b <= 6.8e+153: tmp = a * ((b * b) * -12.0) else: tmp = b * (b * 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 0.48) tmp = -1.0; elseif (b <= 6.8e+153) tmp = Float64(a * Float64(Float64(b * b) * -12.0)); else tmp = Float64(b * Float64(b * 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 0.48) tmp = -1.0; elseif (b <= 6.8e+153) tmp = a * ((b * b) * -12.0); else tmp = b * (b * 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 0.48], -1.0, If[LessEqual[b, 6.8e+153], N[(a * N[(N[(b * b), $MachinePrecision] * -12.0), $MachinePrecision]), $MachinePrecision], N[(b * N[(b * 4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.48:\\
\;\;\;\;-1\\
\mathbf{elif}\;b \leq 6.8 \cdot 10^{+153}:\\
\;\;\;\;a \cdot \left(\left(b \cdot b\right) \cdot -12\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot 4\right)\\
\end{array}
\end{array}
if b < 0.47999999999999998Initial program 79.7%
associate--l+79.7%
fma-def79.7%
Simplified80.7%
Taylor expanded in b around 0 65.8%
associate--l+65.8%
associate-*r*65.8%
unpow265.8%
Simplified65.8%
Taylor expanded in a around 0 31.0%
if 0.47999999999999998 < b < 6.7999999999999995e153Initial program 75.3%
associate--l+75.3%
fma-def75.3%
Simplified78.0%
Taylor expanded in b around inf 97.5%
*-commutative97.5%
fma-def97.5%
unpow297.5%
+-commutative97.5%
+-commutative97.5%
fma-def97.5%
unpow297.5%
distribute-lft-in97.5%
metadata-eval97.5%
associate-*r*97.5%
metadata-eval97.5%
Simplified97.5%
Taylor expanded in a around inf 37.2%
associate-*r*37.2%
*-commutative37.2%
unpow237.2%
associate-*r*37.2%
*-commutative37.2%
distribute-rgt-out39.9%
unpow239.9%
associate-*l*39.9%
distribute-lft-out39.9%
Simplified39.9%
Taylor expanded in a around 0 24.2%
unpow224.2%
*-commutative24.2%
associate-*l*24.2%
Simplified24.2%
if 6.7999999999999995e153 < b Initial program 40.0%
associate--l+40.0%
fma-def40.0%
Simplified46.7%
Taylor expanded in b around inf 100.0%
*-commutative100.0%
fma-def100.0%
unpow2100.0%
+-commutative100.0%
+-commutative100.0%
fma-def100.0%
unpow2100.0%
distribute-lft-in100.0%
metadata-eval100.0%
associate-*r*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around 0 100.0%
fma-def100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in b around 0 100.0%
unpow2100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification38.1%
(FPCore (a b) :precision binary64 (if (<= b 9.8e-45) -1.0 (* a (* (* b b) (* a 2.0)))))
double code(double a, double b) {
double tmp;
if (b <= 9.8e-45) {
tmp = -1.0;
} else {
tmp = a * ((b * b) * (a * 2.0));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 9.8d-45) then
tmp = -1.0d0
else
tmp = a * ((b * b) * (a * 2.0d0))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 9.8e-45) {
tmp = -1.0;
} else {
tmp = a * ((b * b) * (a * 2.0));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 9.8e-45: tmp = -1.0 else: tmp = a * ((b * b) * (a * 2.0)) return tmp
function code(a, b) tmp = 0.0 if (b <= 9.8e-45) tmp = -1.0; else tmp = Float64(a * Float64(Float64(b * b) * Float64(a * 2.0))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 9.8e-45) tmp = -1.0; else tmp = a * ((b * b) * (a * 2.0)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 9.8e-45], -1.0, N[(a * N[(N[(b * b), $MachinePrecision] * N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 9.8 \cdot 10^{-45}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(b \cdot b\right) \cdot \left(a \cdot 2\right)\right)\\
\end{array}
\end{array}
if b < 9.7999999999999996e-45Initial program 79.3%
associate--l+79.3%
fma-def79.3%
Simplified80.4%
Taylor expanded in b around 0 65.2%
associate--l+65.2%
associate-*r*65.2%
unpow265.2%
Simplified65.2%
Taylor expanded in a around 0 31.5%
if 9.7999999999999996e-45 < b Initial program 61.3%
associate--l+61.3%
fma-def61.3%
Simplified65.5%
Taylor expanded in b around inf 95.9%
*-commutative95.9%
fma-def95.9%
unpow295.9%
+-commutative95.9%
+-commutative95.9%
fma-def95.9%
unpow295.9%
distribute-lft-in95.9%
metadata-eval95.9%
associate-*r*95.9%
metadata-eval95.9%
Simplified95.9%
Taylor expanded in a around inf 60.0%
unpow260.0%
associate-*r*60.0%
*-commutative60.0%
associate-*l*60.0%
associate-*l*65.7%
unpow265.7%
Simplified65.7%
Final simplification40.9%
(FPCore (a b) :precision binary64 (if (<= b 0.48) -1.0 (* b (* b 4.0))))
double code(double a, double b) {
double tmp;
if (b <= 0.48) {
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.48d0) 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.48) {
tmp = -1.0;
} else {
tmp = b * (b * 4.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 0.48: tmp = -1.0 else: tmp = b * (b * 4.0) return tmp
function code(a, b) tmp = 0.0 if (b <= 0.48) tmp = -1.0; else tmp = Float64(b * Float64(b * 4.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 0.48) tmp = -1.0; else tmp = b * (b * 4.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 0.48], -1.0, N[(b * N[(b * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.48:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot 4\right)\\
\end{array}
\end{array}
if b < 0.47999999999999998Initial program 79.7%
associate--l+79.7%
fma-def79.7%
Simplified80.7%
Taylor expanded in b around 0 65.8%
associate--l+65.8%
associate-*r*65.8%
unpow265.8%
Simplified65.8%
Taylor expanded in a around 0 31.0%
if 0.47999999999999998 < b Initial program 59.5%
associate--l+59.5%
fma-def59.5%
Simplified64.0%
Taylor expanded in b around inf 98.6%
*-commutative98.6%
fma-def98.6%
unpow298.6%
+-commutative98.6%
+-commutative98.6%
fma-def98.6%
unpow298.6%
distribute-lft-in98.6%
metadata-eval98.6%
associate-*r*98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in a around 0 90.3%
fma-def90.3%
unpow290.3%
Simplified90.3%
Taylor expanded in b around 0 48.2%
unpow248.2%
*-commutative48.2%
associate-*l*48.2%
Simplified48.2%
Final simplification35.5%
(FPCore (a b) :precision binary64 -1.0)
double code(double a, double b) {
return -1.0;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = -1.0d0
end function
public static double code(double a, double b) {
return -1.0;
}
def code(a, b): return -1.0
function code(a, b) return -1.0 end
function tmp = code(a, b) tmp = -1.0; end
code[a_, b_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 74.4%
associate--l+74.4%
fma-def74.4%
Simplified76.3%
Taylor expanded in b around 0 55.0%
associate--l+55.0%
associate-*r*55.0%
unpow255.0%
Simplified55.0%
Taylor expanded in a around 0 23.1%
Final simplification23.1%
herbie shell --seed 2023222
(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))