I'm using the new Android Marshmallow SDK and the method FloatMath.sqrt()
is gone. What should I use now?
Asked
Active
Viewed 4.8k times
89

rekire
- 47,260
- 30
- 167
- 264
1 Answers
244
The documentations say this:
Historically these methods were faster than the equivalent double-based java.lang.Math methods. On versions of Android with a JIT they became slower and have since been re-implemented to wrap calls to java.lang.Math. java.lang.Math should be used in preference.
All methods were removed from the public API in version 23.
@deprecated Use java.lang.Math instead.
This means the solution is to use the Math class:
(float)Math.sqrt(...)

rekire
- 47,260
- 30
- 167
- 264
-
1Ok, but what if it is referenced from a library, and Proguard is complaining? – manfcas May 24 '16 at 14:45
-
I patched that library since I had it as part of my project. However you can implement a wrapper by your own, where you call the existing method. – rekire May 24 '16 at 15:51