Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8350405

Imprecise Float16 value reported by Float16.toString

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 25
    • core-libs

      Please see below the difference b/w Float16 value and its string representation.

      jshell> Float.float16ToFloat(Float.floatToFloat16(0x1.fffffffP+14f))
      $5 ==> 32768.0

      jshell> Float16.valueOf(0x1.fffffffP+14f).toString()
      $6 ==> "32770.0"

      jshell> Float16.valueOf(0x1.fffffffP+14f).floatValue()
      $7 ==> 32768.0

      jshell>

            rgiulietti Raffaello Giulietti
            jbhateja Jatin Bhateja
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: