History log of /frameworks/base/core/java/android/util/MathUtils.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2b4dc1156695ae0a7498bf8fe7cd6b82941026d3 02-Oct-2015 Alan Viverette <alanv@google.com> Animate radial time picker selector during hour/minute transition

Also propagates XML attrs from time picker to radial view during
construction, which allows the hour colors & etc. to be changed
inline without needing to set the timePickerStyle theme attribute.

Bug: 20333885
Change-Id: Ib42b9f5b93b5d6ce1dcbaa05f99cef40c9f9a9d3
/frameworks/base/core/java/android/util/MathUtils.java
1619ed4706a0bf906d967ab7987cd4c475ac3462 22-Sep-2015 Adam Lesinski <adamlesinski@google.com> Fix security issues when using Parcel.setDataPosition() with untrusted input

When seeking forward in the Parcel, adding the extracted size to the Parcel.dataPosition()
can result in an overflow. Guard against this.

Bug:23909429
Change-Id: If37cdebbf05a92810300363d1a6ecd8b42b6da26
/frameworks/base/core/java/android/util/MathUtils.java
9af77a4ce22540726fbddd275f89e65fd1a1edf8 02-Apr-2015 ztenghui <ztenghui@google.com> Add group scaling factor into stroke width.

Originally, stroke width is independent of group scaling.
But that is a bug and causing animation trouble.

b/19501782

Change-Id: I33d5e44f2f8b2a82fee1a5a326223a39aaffa86c
/frameworks/base/core/java/android/util/MathUtils.java
33253a4baa6279f81a73425b49dfb6abe5f5416e 01-Oct-2014 Neil Fuller <nfuller@google.com> Switch from FloatMath -> Math and Math.hypot where possible

The motivation is an API change: FloatMath is going to be
deprecated and/or removed. Performance is not the goal of
this change.

That said...

Math is faster than FloatMath with AOT compilation.

While making the change, occurances of:

{Float}Math.sqrt(x * x + y * y) and
{Float}Math.sqrt({Float}Math.pow(x, 2) + {Float}Math.pow(y, 2))

have been replaced with:

{(float)} Math.hypot(x, y)

Right now there is no runtime intrinsic for hypot so is not faster
in all cases for AOT compilation:

Math.sqrt(x * x + y * y) is faster than Math.hypot(x, y) with
AOT, but all other combinations of FloatMath, use of pow() etc.
are slower than hypot().

hypot() has the advantage of being self documenting and
could be optimized in future. None of the behavior differences
around NaN and rounding appear to be important for the cases
looked at: they all assume results and arguments are in range
and usually the results are cast to float.

Different implementations measured on hammerhead / L:

AOT compiled:

[FloatMath.hypot(x, y)]
benchmark=Hypot_FloatMathHypot} 633.85 ns; σ=0.32 ns @ 3 trials

[FloatMath.sqrt(x*x + y*y)]
benchmark=Hypot_FloatMathSqrtMult} 684.17 ns; σ=4.83 ns @ 3 trials

[FloatMath.sqrt(FloatMath.pow(x, 2) + FloatMath.pow(y, 2))]
benchmark=Hypot_FloatMathSqrtPow} 1270.65 ns; σ=12.20 ns @ 6 trials

[(float) Math.hypot(x, y)]
benchmark=Hypot_MathHypot} 96.80 ns; σ=0.05 ns @ 3 trials

[(float) Math.sqrt(x*x + y*y)]
benchmark=Hypot_MathSqrtMult} 23.97 ns; σ=0.01 ns @ 3 trials

[(float) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))]
benchmark=Hypot_MathSqrtPow} 156.19 ns; σ=0.12 ns @ 3 trials

Interpreter:

benchmark=Hypot_FloatMathHypot} 1180.54 ns; σ=5.13 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtMult} 1121.05 ns; σ=3.80 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtPow} 3327.14 ns; σ=7.33 ns @ 3 trials
benchmark=Hypot_MathHypot} 856.57 ns; σ=1.41 ns @ 3 trials
benchmark=Hypot_MathSqrtMult} 1028.92 ns; σ=9.11 ns @ 3 trials
benchmark=Hypot_MathSqrtPow} 2539.47 ns; σ=24.44 ns @ 3 trials

Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: I06c91f682095e627cb547d60d936ef87941be692
/frameworks/base/core/java/android/util/MathUtils.java
ac3fcb1590e1da21324c13ce237ec48f2bf488bf 03-May-2012 Jeff Sharkey <jsharkey@android.com> Reduce persist threshold for lower warning/limit.

Default is 2MB persist threshold, but even that can be substantial
for devices on 100MB/month plans. This change gradually reduces the
persist threshold up to 8x lower (256kb outstanding) based on lowest
active policy.

Bug: 5382676
Change-Id: Ief4e8cdb169bfb151a3d1b45722a8eaa01926508
/frameworks/base/core/java/android/util/MathUtils.java
e85c5aa67ea27f930b573c0c6662ef6bd6314d54 13-Aug-2009 Romain Guy <romainguy@android.com> Add norm() and map() to MathUtils.
/frameworks/base/core/java/android/util/MathUtils.java
a9d2d5ed2840bc3331e1a387b26efc44c6211623 10-Aug-2009 Romain Guy <romainguy@android.com> Make the laves follow the ripples
/frameworks/base/core/java/android/util/MathUtils.java
a32d100b34d048cf0c765d8f31d87b81ab88d1eb 01-Aug-2009 Romain Guy <romainguy@android.com> Add new utility methods to rsScriptC_Lib, android.util.MathUtil and android.graphics.Color.
Fixes RS compilation.
/frameworks/base/core/java/android/util/MathUtils.java