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

BigDecimal.doubleValue() is depressingly slow

XMLWordPrintable

    • b21

      A DESCRIPTION OF THE PROBLEM :
      I find the following slow path in BigDecimal:

              // Somewhat inefficient, but guaranteed to work.
              return Double.parseDouble(this.toString())

      Since JDK-7131192 : BigInteger.doubleValue() is depressingly slow
      is now available, something faster could be done.

      It suggest doing unscaledValue().doubleValue() * Math.exp(scale()*Math.log(10))


            rgiulietti Raffaello Giulietti
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: