question: public static float wrap ( float value ) { if ( value >= 0.f ) { return value - ( int ) value ; } float wrappedValue = value - ( float ) Math . floor ( value ) ; if ( wrappedValue >= 1.f ) { wrappedValue -= 1.f ; } return wrappedValue ; }
target:  Wrap the value to the range [0..1[ (1 is excluded). E.g. value == 4.0 -> return 0.0 value == 4.1 -> return 0.1 value == 4.9 -> return 0.9 value == -4.0 -> return 0.0 value == -4.1 -> return 0.9 (and not 0.1) value == -4.9 -> return 0.1 (and not 0.9)