Try this code.
Math::BigFloat->new('2187057715053006176499296408615417037129128897214 +238256113698344404908334336944631917741033900096370541032981352897479 +4149028917796716909528358808344846743188026.3358424164688113979341672 +817820980901270335818142717085694006013286169841932603829327703871880 +428990115508942455532934618389216110784616173476066841503276383837003 +379903941568669190776279824783435928019360618178076885689415041227681 +844670764900853378260631999915592273797583721140943359293289412998382 +173652701723265352101625829774791587832397090147942858752926315552361 +783352460136562979750515887006847684035410231950364818914502590711655 +366289482609717574837339905541901751286406418328318293008678171684392 +671085100451990131991851475002542698170815681092942517642292616577517 +786222417104149554986200865059260416692954217421195236361801616322976 +530913722541245775661381844217848774307041052858179134861939621614955 +079372880536990393780066744832735297424321264402399647634986599223736 +661814927327512892111811467257097624814635258985073512630492058901597 +404864371649851510984020115534028021934478375765870460883666269412675 +21'); my $denominator = Math::BigFloat->new('1000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000'); printf("numerator: %s\n", $numerator + 1 ); printf("numerator: %s\n", $numerator ); printf("denominator: %s\n", $denominator ); my $x = $numerator->copy(); $x->accuracy(10); print scalar $x->bdiv($denominator), "\n"; $x = $numerator->copy(); $x->accuracy(1000); print scalar $x->bdiv($denominator), "\n";
-- gam3
A picture is worth a thousand words, but takes 200K.

In reply to Re: BigFloat Precision by gam3
in thread BigFloat Precision by Willman023

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, details, 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, summary, 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.