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

BigDecimal.doubleValue() is depressingly slow

    Details

      Description

      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))


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bpb Brian Burkhalter
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: