Re: How to transfer "2.2864849511949E+190" to a normal-human-readable number?

From: Date: Fri, 16 Feb 2001 14:01:39 +0000
Subject: Re: How to transfer "2.2864849511949E+190" to a normal-human-readable number?
Groups: php.general 
Request: Send a blank email to php-general+get-40143@lists.php.net to get a copy of this message
Well, the numbers are a bit silly for doing this sort of thing, but the seg fault is clearly a bug! Can you report it please. (bugs.php.net) Thanks -- Phil Driscoll Dial Solutions +44 (0)113 294 5112 http://www.dialsolutions.com http://www.dtonline.org -----Original Message----- From: Ben Peter <ben@bpeter.org> To: sed@sed.is <sed@sed.is>; php-general@lists.php.net <php-general@lists.php.net> Date: Friday, February 16, 2001 12:34 PM Subject: Re: [PHP] How to transfer "2.2864849511949E+190" to a normal-human-readable number? >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 >228648495119489900000000000000000000000000000000000000000000000000000000000 0000 >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: sed@sed.is >> > Homepage: www.sed.is <- New Homepage! >> > ------------------------------------------ >> > >> > -- >> > PHP General Mailing List (http://www.php.net/) >> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >> > For additional commands, e-mail: php-general-help@lists.php.net >> > To contact the list administrators, e-mail: php-list-admin@lists.php.net >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >> For additional commands, e-mail: php-general-help@lists.php.net >> To contact the list administrators, e-mail: php-list-admin@lists.php.net > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#40143) next »