Closed Bug 1169427 Opened 5 years ago Closed 5 years ago

Android M removes FloatMath

Categories

(Firefox for Android :: General, defect)

34 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 41
Tracking Status
firefox41 --- fixed

People

(Reporter: snorp, Assigned: sebastian)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

java.lang.Math has the same stuff, apparently, so we should just use that instead.
Android Lint also has the following output: `Use java.lang.Math#floor instead of android.util.FloatMath#floor() since it is faster as of API 8`
Assignee: nobody → s.kaspari
Status: NEW → ASSIGNED
Bug 1169427 - Replace FloatMath.*() calls with calls to Math.*(). r?snorp
This patch has been pretty much straight-forward, except for maybe DisplayPortCalculator where I had to explicitly cast from double to float. This is my guinea pig bug to try the review board. ;)
Attachment #8614741 - Flags: review?(snorp)
Attachment #8614741 - Flags: review?(snorp) → review+
Comment on attachment 8614741 [details]
MozReview Request: Bug 1169427 - Replace FloatMath.*() calls with calls to Math.*(). r?snorp

https://reviewboard.mozilla.org/r/10023/#review8811

Looks ok modulo these few things

::: mobile/android/base/gfx/JavaPanZoomController.java:667
(Diff revision 1)
> -    private float panDistance(MotionEvent move) {
> +    private double panDistance(MotionEvent move) {

We use float everywhere, so let's just cast the return value instead

::: mobile/android/base/gfx/JavaPanZoomController.java:800
(Diff revision 1)
> -    private float getVelocity() {
> +    private double getVelocity() {

Same here

::: mobile/android/tests/browser/robocop/MotionEventHelper.java:135
(Diff revision 1)
> -        float distance = FloatMath.sqrt((dx * dx) + (dy * dy));
> +        double distance = Math.sqrt((dx * dx) + (dy * dy));

Again, cast to float
Comment on attachment 8614741 [details]
MozReview Request: Bug 1169427 - Replace FloatMath.*() calls with calls to Math.*(). r?snorp

Bug 1169427 - Replace FloatMath.*() calls with calls to Math.*(). r?snorp
Attachment #8614741 - Flags: review+
Attachment #8614741 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/5c3da7a5e599
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 41
You need to log in before you can comment on or make changes to this bug.