Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Thanks, looks like it's fallback (so called "div_scale", defaults to 40) value that was applied (and now I have a deja-vu to have already investigated this a few years back). Either of

use bignum p => 0; bignum-> precision( 0 ); bignum-> div_scale( 999 );

(or method calls on an instance) will help. That still doesn't feel right:

use strict; use warnings; use feature 'say'; use Data::Dump; use bignum; #use bigint; say my $x = 999999999921778071482940061661655974875633165533182; dd $x; dd $x-> precision; dd $x-> accuracy; dd $x-> div_scale; dd (Math::BigInt-> precision); dd (Math::BigInt-> accuracy); say my $y = $x / 1; __END__ 999999999921778071482940061661655974875633165533182 bless({ sign => "+", value => bless([165533182, 974875633, 61661655, 71482940, 999921778, + 999999], "Math::BigInt::Calc"), }, "Math::BigInt") undef undef 40 undef undef 999999999921778071482940061661655974875600000000000

But with bigint instead:

999999999921778071482940061661655974875633165533182 bless({ sign => "+", value => bless([165533182, 974875633, 61661655, 71482940, 999921778, + 999999], "Math::BigInt::Calc"), }, "Math::BigInt") undef undef 40 undef undef 999999999921778071482940061661655974875633165533182

i.e. object of the same class, with the same properties, same global parameters, but result is different. Same (per deja-vu) conclusion: avoid using bignum.


In reply to Re^3: bignum usage? by Anonymous Monk
in thread bignum usage? by rkd257

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others learning in the Monastery: (4)
    As of 2024-07-23 23:26 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?
      erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.