in reply to Misunderstanding with Math::BigInt

The first problem is that 2.87... & 0.002 are not ints, so BigInt doesn't help. You need Math::BigFloat.

use Math::BigFloat; my($out,$diver,$grade) = map{ Math::BigFloat->new( $_ ) } split(/,/, ' 2.84894533078051,5,0.002', 3); print $out ** ( 1/$grade ) * $diver; 109907610023675317191879876436497649438076948727516195849531 529984640080900905500623346430661197750153976478077957100021 178235709357073884306056471657477469213296476869314035526387 8485678475840878789876340877189092206814894928600.3227150712 343412750871362367932483896648862164560115552012310931635017 ... <lots more snipped> ... 198626328593786831872991187091247473250005 perl>

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

Replies are listed 'Best First'.
Re^2: Misunderstanding with Math::BigInt
by Smoke (Initiate) on Jun 30, 2005 at 21:19 UTC
    thanks a lot !!! it works perfectly.
    but is there a way to get only the whole number (without what after the dot) ? i tried int() but it rounds the whole number somewhy...

      Here's one way:

      print +( split '\.', $out ** ( 1/$grade ) * $diver )[ 0 ];

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
        thank you soooooo very much :D