Math FPCore C Julia Wolfram TeX \[\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
\]
↓
\[\mathsf{fma}\left(4, \mathsf{fma}\left(a, a, \mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(a, -3, 1\right), {a}^{3}\right)\right), {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4}\right) + -1
\]
(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)) ↓
(FPCore (a b)
:precision binary64
(+
(fma
4.0
(fma a a (fma (* b b) (fma a -3.0 1.0) (pow a 3.0)))
(pow (hypot a b) 4.0))
-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;
}
↓
double code(double a, double b) {
return fma(4.0, fma(a, a, fma((b * b), fma(a, -3.0, 1.0), pow(a, 3.0))), pow(hypot(a, b), 4.0)) + -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 code(a, b)
return Float64(fma(4.0, fma(a, a, fma(Float64(b * b), fma(a, -3.0, 1.0), (a ^ 3.0))), (hypot(a, b) ^ 4.0)) + -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]
↓
code[a_, b_] := N[(N[(4.0 * N[(a * a + N[(N[(b * b), $MachinePrecision] * N[(a * -3.0 + 1.0), $MachinePrecision] + N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\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
↓
\mathsf{fma}\left(4, \mathsf{fma}\left(a, a, \mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(a, -3, 1\right), {a}^{3}\right)\right), {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4}\right) + -1
Alternatives Alternative 1 Accuracy 99.9% Cost 14016
\[-1 + \left({\left(\mathsf{hypot}\left(b, a\right)\right)}^{4} + 4 \cdot \left(b \cdot b + \left(a \cdot a\right) \cdot \left(a + 1\right)\right)\right)
\]
Alternative 2 Accuracy 99.7% Cost 7940
\[\begin{array}{l}
t_0 := b \cdot b + a \cdot a\\
\mathbf{if}\;b \cdot b \leq 10^{-24}:\\
\;\;\;\;-1 + \left({a}^{4} + \frac{4 \cdot \left(a \cdot a\right)}{\frac{1}{a + 1}}\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left({t_0}^{2} + 4 \cdot t_0\right)\\
\end{array}
\]
Alternative 3 Accuracy 99.6% Cost 7936
\[-1 + \left(4 \cdot \left(b \cdot b + \left(a \cdot a\right) \cdot \left(a + 1\right)\right) + {\left(b \cdot b + a \cdot a\right)}^{2}\right)
\]
Alternative 4 Accuracy 97.3% Cost 7688
\[\begin{array}{l}
t_0 := 4 \cdot \left(a \cdot a\right)\\
\mathbf{if}\;a \leq -8.5 \cdot 10^{-7}:\\
\;\;\;\;-1 + \left({a}^{4} + \left(a + 1\right) \cdot t_0\right)\\
\mathbf{elif}\;a \leq 0.019:\\
\;\;\;\;-1 + \left({b}^{4} + b \cdot \left(4 \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left({a}^{4} + \frac{t_0}{\frac{1}{a + 1}}\right)\\
\end{array}
\]
Alternative 5 Accuracy 97.3% Cost 7561
\[\begin{array}{l}
\mathbf{if}\;a \leq -8.2 \cdot 10^{-7} \lor \neg \left(a \leq 0.019\right):\\
\;\;\;\;-1 + \left({a}^{4} + \left(a + 1\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left({b}^{4} + b \cdot \left(4 \cdot b\right)\right)\\
\end{array}
\]
Alternative 6 Accuracy 96.3% Cost 7305
\[\begin{array}{l}
\mathbf{if}\;a \leq -4.8 \lor \neg \left(a \leq 2000\right):\\
\;\;\;\;-1 + {a}^{3} \cdot \left(4 + a\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left({b}^{4} + b \cdot \left(4 \cdot b\right)\right)\\
\end{array}
\]
Alternative 7 Accuracy 96.2% Cost 7177
\[\begin{array}{l}
\mathbf{if}\;a \leq -4.9 \lor \neg \left(a \leq 12\right):\\
\;\;\;\;-1 + {a}^{3} \cdot \left(4 + a\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot \left(b \cdot \left(4 + b \cdot b\right)\right) + b \cdot \left(b \cdot \left(a \cdot -12\right)\right)\right)\\
\end{array}
\]
Alternative 8 Accuracy 95.5% Cost 6921
\[\begin{array}{l}
\mathbf{if}\;a \leq -0.038 \lor \neg \left(a \leq 8.5\right):\\
\;\;\;\;-1 + {a}^{4}\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot \left(b \cdot \left(4 + b \cdot b\right)\right) + b \cdot \left(b \cdot \left(a \cdot -12\right)\right)\right)\\
\end{array}
\]
Alternative 9 Accuracy 81.5% Cost 1344
\[-1 + \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) + \left(b \cdot b\right) \cdot \left(4 + \left(a \cdot a\right) \cdot 2\right)\right)
\]
Alternative 10 Accuracy 81.4% Cost 1216
\[-1 + \left(b \cdot \left(b \cdot \left(4 + b \cdot b\right)\right) + b \cdot \left(b \cdot \left(a \cdot -12\right)\right)\right)
\]
Alternative 11 Accuracy 81.3% Cost 704
\[-1 + \left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)
\]
Alternative 12 Accuracy 63.3% Cost 576
\[-1 + -12 \cdot \left(a \cdot \left(b \cdot b\right)\right)
\]
Alternative 13 Accuracy 80.1% Cost 576
\[-1 + \left(b \cdot b\right) \cdot \left(b \cdot b\right)
\]
Alternative 14 Accuracy 63.1% Cost 64
\[-1
\]