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(3 + a\right)\right)\right) - 1
\]
↓
\[{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(4, \mathsf{fma}\left(b \cdot b, a + 3, a \cdot a\right) - {a}^{3}, -1\right)
\]
(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)) ↓
(FPCore (a b)
:precision binary64
(+
(pow (hypot a b) 4.0)
(fma 4.0 (- (fma (* b b) (+ a 3.0) (* a a)) (pow a 3.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) * (3.0 + a))))) - 1.0;
}
↓
double code(double a, double b) {
return pow(hypot(a, b), 4.0) + fma(4.0, (fma((b * b), (a + 3.0), (a * a)) - pow(a, 3.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(3.0 + a))))) - 1.0)
end
↓
function code(a, b)
return Float64((hypot(a, b) ^ 4.0) + fma(4.0, Float64(fma(Float64(b * b), Float64(a + 3.0), Float64(a * a)) - (a ^ 3.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[(3.0 + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
↓
code[a_, b_] := N[(N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision] - N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $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(3 + a\right)\right)\right) - 1
↓
{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(4, \mathsf{fma}\left(b \cdot b, a + 3, a \cdot a\right) - {a}^{3}, -1\right)
Alternatives Alternative 1 Accuracy 99.8% Cost 27456
\[-1 + \left(\mathsf{hypot}\left(b, a\right) \cdot \left(\mathsf{hypot}\left(b, a\right) \cdot {\left(\mathsf{hypot}\left(b, a\right)\right)}^{2}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right)
\]
Alternative 2 Accuracy 99.7% Cost 27008
\[{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \mathsf{fma}\left(4, \mathsf{fma}\left(a, a \cdot \left(1 - a\right), b \cdot \left(b \cdot \left(a + 3\right)\right)\right), -1\right)
\]
Alternative 3 Accuracy 99.7% Cost 8192
\[-1 + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) + {\left(b \cdot b + a \cdot a\right)}^{2}\right)
\]
Alternative 4 Accuracy 97.4% Cost 7561
\[\begin{array}{l}
\mathbf{if}\;a \leq -0.0029 \lor \neg \left(a \leq 0.000112\right):\\
\;\;\;\;-1 + \left({a}^{4} + \left(1 - a\right) \cdot \left(a \cdot \left(a \cdot 4\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot \left(b \cdot 12\right) + {b}^{4}\right)\\
\end{array}
\]
Alternative 5 Accuracy 97.4% Cost 7496
\[\begin{array}{l}
\mathbf{if}\;b \leq -1.32 \cdot 10^{-8}:\\
\;\;\;\;-1 + \left({b}^{4} + \left(b \cdot b\right) \cdot \left(12 + a \cdot 4\right)\right)\\
\mathbf{elif}\;b \leq 0.00165:\\
\;\;\;\;-1 + \left(a \cdot a\right) \cdot \mathsf{fma}\left(4, 1 - a, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(b \cdot \left(b \cdot 12\right) + {b}^{4}\right)\\
\end{array}
\]
Alternative 6 Accuracy 97.5% Cost 7424
\[-1 + \left({\left(b \cdot b + a \cdot a\right)}^{2} + b \cdot \left(b \cdot 12\right)\right)
\]
Alternative 7 Accuracy 97.2% Cost 7364
\[\begin{array}{l}
\mathbf{if}\;a \leq -0.011:\\
\;\;\;\;-1 + \left(a \cdot a\right) \cdot \mathsf{fma}\left(4, 1 - a, a \cdot a\right)\\
\mathbf{elif}\;a \leq 7 \cdot 10^{-6}:\\
\;\;\;\;-1 + \left(b \cdot \left(b \cdot 12\right) + {b}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(\left(1 - a\right) \cdot \left(a \cdot \left(a \cdot 4\right)\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right)\\
\end{array}
\]
Alternative 8 Accuracy 97.4% Cost 7305
\[\begin{array}{l}
\mathbf{if}\;b \leq -1.4 \cdot 10^{-8} \lor \neg \left(b \leq 0.00165\right):\\
\;\;\;\;-1 + \left(b \cdot \left(b \cdot 12\right) + {b}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(\left(1 - a\right) \cdot \left(a \cdot \left(a \cdot 4\right)\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right)\\
\end{array}
\]
Alternative 9 Accuracy 97.2% Cost 7241
\[\begin{array}{l}
\mathbf{if}\;a \leq -0.0029 \lor \neg \left(a \leq 9.2 \cdot 10^{-7}\right):\\
\;\;\;\;-1 + \left(\left(1 - a\right) \cdot \left(a \cdot \left(a \cdot 4\right)\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot b, b \cdot b + 12, -1\right)\\
\end{array}
\]
Alternative 10 Accuracy 96.4% Cost 7108
\[\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 5 \cdot 10^{-6}:\\
\;\;\;\;-1 + \left(\left(1 - a\right) \cdot \left(a \cdot \left(a \cdot 4\right)\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 12\right)\right)\\
\end{array}
\]
Alternative 11 Accuracy 94.9% Cost 6792
\[\begin{array}{l}
\mathbf{if}\;b \leq -10:\\
\;\;\;\;{b}^{4}\\
\mathbf{elif}\;b \leq 1.4 \cdot 10^{+21}:\\
\;\;\;\;-1 + \left(\left(1 - a\right) \cdot \left(a \cdot \left(a \cdot 4\right)\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{b}^{4}\\
\end{array}
\]
Alternative 12 Accuracy 81.5% Cost 1216
\[-1 + \left(\left(1 - a\right) \cdot \left(a \cdot \left(a \cdot 4\right)\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right)
\]
Alternative 13 Accuracy 80.1% Cost 704
\[-1 + \left(a \cdot \left(a \cdot a\right)\right) \cdot \left(a + -4\right)
\]
Alternative 14 Accuracy 64.5% Cost 448
\[-1 + a \cdot \left(a \cdot 4\right)
\]
Alternative 15 Accuracy 64.7% Cost 448
\[-1 + b \cdot \left(b \cdot 12\right)
\]
Alternative 16 Accuracy 63.2% Cost 64
\[-1
\]