Close to a value : Float « Date Type « Android

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » Date Type » Float 
Close to a value
    

class Utils {
    private static final float EPSILON = 0.0001f;

    public final static boolean close(float a, float b) {
        return close(a, b, EPSILON);
    }

    public final static boolean close(float a, float b, float epsilon) {
        return Math.abs(a - b< epsilon;
    }
}

   
    
    
    
  
Related examples in the same category
1.Convert a float to 16.16 fixed-point representation
2.Convert a 16.16 fixed-point value to floating point
3.Random and Roundup
4.Is Long or double
5.calculate NormDiff
6.DecimalFormat, Maximum Fraction Digits
7.Format Distance
8.Gives the fractional part of a number
9.Value equals in a range, and ensure value inside a range
10.scale, round Number
11.Returns the smallest power of two that is greater than
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.