Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   BigDecimal Sqrt? (https://www.askmehelpdesk.com/showthread.php?t=157742)

  • Nov 30, 2007, 12:47 PM
    Blacksage
    BigDecimal Sqrt?
    There seems to be know Sqrt method in the BigDecimal Class. They Do have a power method but the power method only takes ints. So I can't try and do something to the .5 or 1/2 power. Dose anyone know of any other way I can find sqrt using Java BigDecimal? Thanks
  • Dec 4, 2007, 08:40 AM
    jstrike
    Try:
    BigDecimal bd = new BigDecimal(343325027336.33);
    Math.sqrt(bd.doubleValue());
  • Dec 4, 2007, 02:17 PM
    Blacksage
    Wouldn't that be the same thing as:
    double x = Math.sqrt(343325027336.33);
  • Dec 14, 2007, 08:12 AM
    jstrike
    Quote:

    Originally Posted by Blacksage
    Wouldnt that be the same thing as:
    double x = Math.sqrt(343325027336.33);

    Yes, but he said he's using the BigDecimal class so you need to go from BigDecimal to double. There may be other BigDecimal methods that he's using prior to needing the square root.

  • All times are GMT -7. The time now is 07:07 AM.