Float range to restrictive in FFI code
--------------------------------------
Key: JRUBY-3290
URL: http://jira.codehaus.org/browse/JRUBY-3290
Project: JRuby
Issue Type: Bug
Components: Extensions
Affects Versions: JRuby 1.1.6
Environment: Ubuntu 8.10
$jruby --version
jruby 1.1.6 (ruby 1.8.6 patchlevel 114) (2008-12-17 rev 8388) [i386-java]
$ java -version
java version "1.6.0_0"
IcedTea6 1.3.1 (6b12-0ubuntu6) Runtime Environment (build 1.6.0_0-b12)
OpenJDK Server VM (build 1.6.0_0-b12, mixed mode)
Reporter: Jay Anderson
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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email