JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-5441

Attempt to create decimal 2.2250738585072012e-308 sends JVM into tight infinite loop

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: JRuby 1.6.4
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Number of attachments :
      0

      Description

      http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/

      Basically, 2.2250738585072012e-308 in various forms can't be generated.

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        I made another attempt that tries to check if the value is in the proper range, but this version fails other specs that expect specific minimum float values.

        https://gist.github.com/815270

        Show
        Charles Oliver Nutter added a comment - I made another attempt that tries to check if the value is in the proper range, but this version fails other specs that expect specific minimum float values. https://gist.github.com/815270
        Hide
        Charles Oliver Nutter added a comment -

        Oracle has released a hotfix that applies to earlier JDKs as well. http://www.oracle.com/technetwork/java/javase/fpupdater-tool-readme-305936.html

        I expect Apple will get updates released shortly.

        Show
        Charles Oliver Nutter added a comment - Oracle has released a hotfix that applies to earlier JDKs as well. http://www.oracle.com/technetwork/java/javase/fpupdater-tool-readme-305936.html I expect Apple will get updates released shortly.
        Hide
        Hiro Asari added a comment -

        Indeed, Apple's latest JDK contains the fix.

        $ jruby -v -e 'p 2.2250738585072012e-308'
        jruby 1.6.0 (ruby-1.8.7-p330) (2011-04-11 b695384) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) [darwin-x86_64-java]
        2.2250738585072e-308
        

        We do still have a pragmatic problem of supporting older versions of JDK.

        Should we incorporate the fix outlined here: http://extremestjython.blogspot.com/2011/02/no-more-java-double-trouble.html

        Show
        Hiro Asari added a comment - Indeed, Apple's latest JDK contains the fix. $ jruby -v -e 'p 2.2250738585072012e-308' jruby 1.6.0 (ruby-1.8.7-p330) (2011-04-11 b695384) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) [darwin-x86_64-java] 2.2250738585072e-308 We do still have a pragmatic problem of supporting older versions of JDK. Should we incorporate the fix outlined here: http://extremestjython.blogspot.com/2011/02/no-more-java-double-trouble.html
        Hide
        Charles Oliver Nutter added a comment -

        Yes, I think we should.

        Show
        Charles Oliver Nutter added a comment - Yes, I think we should.
        Hide
        Charles Oliver Nutter added a comment -

        Fixed on master (66b5b33) and jruby-1_6:

        commit 9791492574e39c78e9bc62d9dc71081e2810e2dc
        Author: Charles Oliver Nutter <headius@headius.com>
        Date: Mon Jul 11 19:40:43 2011 -0500

        Fix JRUBY-5541 on older JDKs: Attempt to create decimal 2.2250738585072012e-308 sends JVM into tight infinite loop

        Show
        Charles Oliver Nutter added a comment - Fixed on master (66b5b33) and jruby-1_6: commit 9791492574e39c78e9bc62d9dc71081e2810e2dc Author: Charles Oliver Nutter <headius@headius.com> Date: Mon Jul 11 19:40:43 2011 -0500 Fix JRUBY-5541 on older JDKs: Attempt to create decimal 2.2250738585072012e-308 sends JVM into tight infinite loop Using code from Oti's blog: http://extremestjython.blogspot.com/2011/02/no-more-java-double-trouble.html , which he has released into the public domain.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Hiro Asari
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: