On 1/10/06, David Nicol <> wrote:
> On 1/10/06,  <> wrote:
> >
> > Thanks! This is what I'm looking for.
> >
> > -------------- Original message --------------
> > From: "DePriest, Jason R." <>
> >
> > > use Math::BigFloat;
> > > $m = Math::BigFloat->new('7191750529163469.123'); # notice NO double
> > > quotes, this is still a number
>
> I am worried that a wrong meme might begin here and spread.  Single
> quotes and double quotes both yield strings in Perl.  Double quotes
> interpolate and single quotes don't.
>
> The constructor of Math::BigFloat takes a string argument:
>          # Number creation
>          $x = Math::BigFloat->new($str);
>
> If you don't give it a string, it will make a string out of what it
> has, possibly
> after converting it to a normal float and back, which is what may have been
> happening.
>

Yes it is a string.  I know in my original post I had the line in that
it was not a string.  I just copy / pasted the original snippet and
didn't think about taking the comments out.

Sorry.

The thing that is important is that Math::BigFloat takes a string of a
big number and interally performs operations on it as if were a big
number.  So as long as you use the Math::BigFloat operations such as
$m->fadd or $m->fsub and don't try to use just + or - or whatever to
combine and compare them, you will get the results you expect.

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to