core/src/main/java/org/jruby/RubyNumeric.java
public static long float2ulong(RubyFloat flt) {
        final double aFloat = flt.value;

        if (aFloat <= (double) Long.MAX_VALUE && aFloat >= (double) 0) {
            BigDecimal bd = BigDecimal.valueOf(aFloat);
            BigInteger bi = bd.toBigInteger();
            return bi.longValue();
        }
        // TODO: number formatting here, MRI uses "%-.10g", 1.4 API is a must?
        throw flt.getRuntime().newRangeError("float " + aFloat + " out of range of integer");
    }
/**
     * Convert the given RubyFloat into an unsigned long, encoded as a signed long.
     *
     * Because we can't represent an unsigned long directly in Java, callers of this code must deal with the signed
     * long bits accordingly.
     *
     * @param flt the argument to convert
     * @return an unsigned long encoded as a signed long, or raise an error if out of range
     */
Convert the given RubyFloat into an unsigned long, encoded as a signed long.
Because we can't represent an unsigned long directly in Java, callers of this code must deal with the signed
long bits accordingly.

@param flt the argument to convert
@return an unsigned long encoded as a signed long, or raise an error if out of range
Convert the given RubyFloat into an unsigned long encoded as a signed long . Because we can ' t represent an unsigned long directly in Java callers of this code must deal with the signed long bits accordingly . @param flt the argument to convert @return an unsigned long encoded as a signed long or raise an error if out of range
public static long float2ulong(RubyFloat flt) {
        final double aFloat = flt.value;
        if (aFloat <= (double) Long.MAX_VALUE && aFloat >= (double) 0) {
            BigDecimal bd = BigDecimal.valueOf(aFloat);
            BigInteger bi = bd.toBigInteger();
            return bi.longValue();
        }
        throw flt.getRuntime().newRangeError("float " + aFloat + " out of range of integer");
    }
public static long float2ulong ( RubyFloat flt ) { final double aFloat = flt . value ; if ( aFloat <= ( double ) Long . MAX_VALUE && aFloat >= ( double ) 0 ) { BigDecimal bd = BigDecimal . valueOf ( aFloat ) ; BigInteger bi = bd . toBigInteger ( ) ; return bi . longValue ( ) ; } throw flt . getRuntime ( ) . newRangeError ( "float " + aFloat + " out of range of integer" ) ; }
Convert the given RubyFloat into an unsigned long, encoded as a signed long.
Convert the given RubyFloat into an unsigned long encoded as a signed long .
// TODO: number formatting here, MRI uses "%-.10g", 1.4 API is a must?