Hi,

have to correct that (thanks to Adam Whitehead for pointing out).

It should be %f instead of %d. However:

'<? $foo = 2.2864849511949E+190; settype($foo,"double"); printf("%f\n",
$foo) ?>' | php -q
2286484951194899000000000000000000000000000000000000000000000000000000000000000
Segmentation fault (core dumped)
[ben@home ben]$ 

This is PHP4.0.4pl1

Ben

Ben Peter wrote:
> 
> Hi,
> 
> I tried
> 
> <? $foo = 2.2864849511949E+190; settype($foo,"double"); printf("%d\n",
> $foo) ?>
> 
> which gave me
> 
> -2147483648
> 
> echo $foo gives
> 
> 2.2864849511949E+190
> 
> - This looks like the number is too large for printf (the 'human
> readable form' printed by printf is abviously wrong).
> 
> Does anybody know such of limits to sprintf?
> 
> Ben
> 
> SED wrote:
> >
> > Hi,
> >
> > I'm multiplying floating numbers:
> >
> >         $result = $foo * $boo;  and the result is like this:
> >
> >         echo "$result";
> >
> > And the result is like this:
> >
> >         2.2864849511949E+190
> >
> > How can I transfer this to normal-human-readable number?
> >
> > Regards,
> > Sumarlidi Einar Dadason
> >
> > SED - Graphic Design
> >
> > ------------------------------------------
> > Phone:       (+354) 4615501
> > Mobile:      (+354) 8960376
> > Fax:         (+354) 4615503
> > E-mail:      [EMAIL PROTECTED]
> > Homepage:    www.sed.is <- New Homepage!
> > ------------------------------------------
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to