JRuby

Float range to restrictive in FFI code

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.1.6
  • Fix Version/s: JRuby 1.2
  • Component/s: Extensions
  • Labels:
    None
  • Environment:
  • Number of attachments :
    0

Description

http://fisheye.codehaus.org/browse/jruby/trunk/jruby/src/org/jruby/ext/ffi/Util.java

The floatValue method in the above class is restricting the range too much. Float.MIN_VALUE is the smallest positive value possible so all non-positive values will be rejected as well as NaN and +-infinity.

Possible solutions:

  • Just cast double to float. This would have the side effect of converting doubles too big or too small (too negative) for a float to +infinity and -infinity respectively, but all values in range should work.
  • Change the range to -Float.MAX_VALUE to Float.MAX_VALUE and add special cases for NaN and +-infinity.

Activity

Hide
Wayne Meissner added a comment -

Fixed in r8659

Show
Wayne Meissner added a comment - Fixed in r8659

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: