Re: [PHP] RE: round()

2007-10-12 Thread Nathan Nobbe
On 10/12/07, tedd <[EMAIL PROTECTED]> wrote: > > At 7:30 PM -0700 10/11/07, Instruct ICC wrote: > > > > > >Now I see why BCMath was mentioned. > > Yes, but precision is not the issue. > > It doesn't make any difference if you are rounding. > > (a) 1.489123451985765 > > or > > (b) 148912345198576.5

RE: [PHP] RE: round()

2007-10-12 Thread tedd
At 7:30 PM -0700 10/11/07, Instruct ICC wrote: Now I see why BCMath was mentioned. Yes, but precision is not the issue. It doesn't make any difference if you are rounding. (a) 1.489123451985765 or (b) 148912345198576.5 You still have to make a decision as to if the above (a) rounds to:

[PHP] RE: round()

2007-10-12 Thread tedd
At 11:26 AM -0700 10/11/07, =?UTF-8?Q?J=C3=BCrgen_Wind?= wrote: I get correct results: 5.2.4 PHP_VERSION round(5.555,2):5.56 toFixed(5.555,2):5.56 You get correct results because the demand you made of the function was simple. If you expand your demand to thousands of cases, then the bias wil

RE: [PHP] RE: round()

2007-10-11 Thread Instruct ICC
> well, > seems to be OS dependent: > > PHP_OS:Linux (Suse 9.x 32bit) | PHP_VERSION:5.0.3 > $t=1.255; > round($t,2):1.26 > $t += .0001; > round($t,2):1.26 > > > PHP_OS:WINNT (2000) | PHP_VERSION:5.2.4 > $t=1.255; > round($t,2):1.25 > > $t += .0001; > round($t,2):1.26 > > -- > Vie

[PHP] RE: round()

2007-10-11 Thread Jürgen Wind
well, seems to be OS dependent: PHP_OS:Linux (Suse 9.x 32bit) | PHP_VERSION:5.0.3 $t=1.255; round($t,2):1.26 $t += .0001; round($t,2):1.26 PHP_OS:WINNT (2000) | PHP_VERSION:5.2.4 $t=1.255; round($t,2):1.25 $t += .0001; round($t,2):1.26 -- View this message in context: http://www

[PHP] RE: round()

2007-10-11 Thread Jürgen Wind
I get correct results: 5.2.4 PHP_VERSION round(5.555,2):5.56 toFixed(5.555,2):5.56 admin-214 wrote: > >> While we're entertaining algorithms, has anyone else noticed that > >> php's round() isn't the most accurate algorithm to round? > > > > If you will refer to chafy's reply on 28-Feb-

Re: [PHP] Re: Round with ONE-decimal... always...

2005-09-12 Thread Gustav Wiberg
- Original Message - From: "Mark Rees" <[EMAIL PROTECTED]> To: Sent: Monday, September 12, 2005 11:12 AM Subject: [PHP] Re: Round with ONE-decimal... always... > I want to adjust the round() -function a little... If I put round(6,0) there will be an output

[PHP] Re: Round with ONE-decimal... always...

2005-09-12 Thread Mark Rees
> > I want to adjust the round() -function a little... > > If I put round(6,0) there will be an output of 6 > If I put round(6,32) there will be an output of 6,3 > > I want it to have 6,0 instead of just 6... I guess there is an easy solution > to this? Suggestions? Have a look at this. http://uk

[PHP] Re: round

2005-01-26 Thread M. Sokolewicz
use number_format() Blackwater Dev wrote: Hello, I have these values: 8.26456 9.7654 3. 5.2689 and I want them rounded to two decimal places so I use the round : round($value,2) which gives me, for example: 8.26 But, it also gives me 3 instead of 3.00. How can I round but retain the 0's? Thank

[PHP] Re: ROUND inconsistency

2001-04-13 Thread Sinisa Milivojevic
Lee Howard writes: > Using MySQL 3.23.32 on RedHat Linux 7.0... > > MySQL's ROUND function rounds 5 up when the preceding digit is odd and down > when the preceding digit is even. > > mysql> select round(1.5); > ++ > | round(1.5) | > ++ > | 2 | > ++ >