RE: [PHP] Simple math failing - PHP Bug?

2004-11-05 Thread Ford, Mike
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 05 November 2004 10:42, Olaf van der Spek wrote: > Mike Ford wrote: > > for. (Some early business-oriented computers, and some calculators > > (especially financial ones) did us

Re: [PHP] Simple math failing - PHP Bug?

2004-11-05 Thread Olaf van der Spek
Mike Ford wrote: for. (Some early business-oriented computers, and some calculators (especially financial ones) did use a system called binary-coded decimal -- BCD -- to calculate "accurately" in the sense you mean, but the fact that they were never widely used and have died out almost totally sho

RE: [PHP] Simple math failing - PHP Bug?

2004-11-01 Thread Ford, Mike
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 01 November 2004 06:31, Brian T. Allen wrote: [] > When adding dollar amounts using only whole cents (and excluding the > limitation we've been discussing) you should always

Re: [PHP] Simple math failing - PHP Bug?

2004-11-01 Thread Mark Charette
From: "Chris Shiflett" <[EMAIL PROTECTED]> To: "Jason Wong" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, November 01, 2004 12:22 AM Subject: Re: [PHP] Simple math failing - PHP Bug? --- Jason Wong <[EMAIL PROTECTED]> wrote: Most computer la

Re: [PHP] Simple math failing - PHP Bug?

2004-10-31 Thread Thomas Goyne
On Sun, 31 Oct 2004 23:30:53 -0700, Brian T. Allen <[EMAIL PROTECTED]> wrote: No worries, this isn't personal. I just want to explore this limitation and it's implications for my benefit and the benefit of any that read this thread later when they are searching for answers to a similar pr

Re: [PHP] Simple math failing - PHP Bug?

2004-10-31 Thread M. Sokolewicz
Brian T. Allen wrote: Chris Shiflett wrote: --- "Brian T. Allen" <[EMAIL PROTECTED]> wrote: Well, in fairness, it's one of the worst ideas you've ever heard because you know of this limitation. Of course. That wasn't a dig at you or anything - just a comment. You're free to heed or ignore it

Re: [PHP] Simple math failing - PHP Bug?

2004-10-31 Thread Brian T. Allen
Chris Shiflett wrote: --- "Brian T. Allen" <[EMAIL PROTECTED]> wrote: Well, in fairness, it's one of the worst ideas you've ever heard because you know of this limitation. Of course. That wasn't a dig at you or anything - just a comment. You're free to heed or ignore it. In reality, usin

Re: [PHP] Simple math failing - PHP Bug?

2004-10-31 Thread Chris Shiflett
--- "Brian T. Allen" <[EMAIL PROTECTED]> wrote: > Well, in fairness, it's one of the worst ideas you've ever heard > because you know of this limitation. Of course. That wasn't a dig at you or anything - just a comment. You're free to heed or ignore it. > In reality, using a calculator or somethi

Re: [PHP] Simple math failing - PHP Bug?

2004-10-31 Thread Brian T. Allen
Chris Shiflett wrote: --- Jason Wong <[EMAIL PROTECTED]> wrote: Most computer languages handling floating point calculations just as poorly. If accuracy is important use the BCMath functions. Or use Fortran and double precision. :-) Still, testing a floating point number as a boolean is one

Re: [PHP] Simple math failing - PHP Bug?

2004-10-31 Thread Brian T. Allen
Thomas Goyne wrote: On Sun, 31 Oct 2004 21:52:32 -0700, Brian T. Allen <[EMAIL PROTECTED]> wrote: Hi, OK, I'm totally stumped by this. This should be the simplest math imaginable (addition and subtraction), but PHP is coming up with the wrong answer! [snip] Is this legitimately bad math o

Re: [PHP] Simple math failing - PHP Bug?

2004-10-31 Thread Chris Shiflett
--- Jason Wong <[EMAIL PROTECTED]> wrote: > Most computer languages handling floating point calculations > just as poorly. If accuracy is important use the BCMath > functions. Or use Fortran and double precision. :-) Still, testing a floating point number as a boolean is one of the worst ideas I'

Re: [PHP] Simple math failing - PHP Bug?

2004-10-31 Thread Jason Wong
On Monday 01 November 2004 04:52, Brian T. Allen wrote: > OK, I'm totally stumped by this. This should be the simplest math > imaginable (addition and subtraction), but PHP is coming up with the > wrong answer! > > I've checked on 3 different machines (all linux) running both PHP 4 and > PHP 5.

Re: [PHP] Simple math failing - PHP Bug?

2004-10-31 Thread Thomas Goyne
On Sun, 31 Oct 2004 21:52:32 -0700, Brian T. Allen <[EMAIL PROTECTED]> wrote: Hi, OK, I'm totally stumped by this. This should be the simplest math imaginable (addition and subtraction), but PHP is coming up with the wrong answer! [snip] Is this legitimately bad math on the part of PHP? T

Re: [PHP] simple math computation..

2004-10-04 Thread Louie Miranda
i found the culprit. i remembered, that i use to pass the value with.. number_format($totalCost, 2, ".", ",") so the values being received by my computation has a "," comma 4,000 so that is why i always get wrong values. thanks again! On Mon, 04 Oct 2004 00:02:32 -0700, Matthew Fonda <[EMAIL P

Re: [PHP] simple math computation..

2004-10-04 Thread Matthew Fonda
Howdy. It seems to work fine for me, perhaps you have a typo along the lines some where. echoes 800 -- Regards, Matthew Fonda On Sun, 2004-10-03 at 23:26, Louie Miranda wrote: > the percent of 20% is = .20 right? > how can i compute the correct value for this? > > my $totalCost is $4,000 an

Re: [PHP] simple math computation..

2004-10-03 Thread - Edwin -
On Monday 04 October 2004 15:26, Louie Miranda wrote: > the percent of 20% is = .20 right? 'don't know what's "the pecent of 20% is" ;) but in decimal form, yes, it's right. Or, just ".2" or "0.2". > how can i compute the correct value for this? > > my $totalCost is $4,000 and when i compute it t

Re: [PHP] Simple Math Calculation Problem....

2003-08-01 Thread Curt Zirzow
* Thus wrote Scott Fletcher ([EMAIL PROTECTED]): > Hi! > > I'm a little stuck with this simple math problem. I'm trying to get a > number of days in integer, not float. > > --snip-- >$input_date = "12/16/2002"; >$UserInput = explode("/", $input_date); > >$UserInputMonth = $UserI

Re: [PHP] Simple Math Calculation Problem....

2003-08-01 Thread Curt Zirzow
* Thus wrote Scott Fletcher ([EMAIL PROTECTED]): > The int() function is for C/C++ programming only. This Int() function is > not supported in PHP. In PHP it would be Intval(). For float, Floatval(). > For double, DoubleVal(). Etc. But beware of the Octual numbers. You can cast like you can

Re: [PHP] Simple Math Calculation Problem....

2003-08-01 Thread skate
> The int() function is for C/C++ programming only. This Int() function is > not supported in PHP. In PHP it would be Intval(). For float, Floatval(). > For double, DoubleVal(). Etc. But beware of the Octual numbers. > sorry, confusing my flash action script again :( -- PHP General Maili

Re: [PHP] Simple Math Calculation Problem....

2003-08-01 Thread Scott Fletcher
Gee! I forgot the '$'. It's been right there in my face. Thanks! I hope the round() function work without a problem because I saw in some posting that some people have this problem where if 3.51 is rounded, it return a 3. "Seth - Kate Buntin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL P

Re: [PHP] Simple Math Calculation Problem....

2003-08-01 Thread Scott Fletcher
The int() function is for C/C++ programming only. This Int() function is not supported in PHP. In PHP it would be Intval(). For float, Floatval(). For double, DoubleVal(). Etc. But beware of the Octual numbers. "Skate" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > >$Day

RE: [PHP] Simple Math Calculation Problem....

2003-08-01 Thread Buntin, Seth - KATE
I used your snip you just posted and changed the $Days = round(Days) to $Days = round($Days) and got 228. -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED] Sent: Friday, August 01, 2003 9:18 AM To: [EMAIL PROTECTED] Subject: [PHP] Simple Math Calculation Problem Hi!

Re: [PHP] Simple Math Calculation Problem....

2003-08-01 Thread skate
>$Days = (($clockDate - $inputDate) / (24 * 3600)); $Days = int(($clockDate - $inputDate) / (24 * 3600)); you tried that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] simple math

2001-01-20 Thread Rasmus Lerdorf
11 % 3 On Sat, 20 Jan 2001 [EMAIL PROTECTED] wrote: > Lets say I have 11 / 3 > > answer is 2.667 > > what if I want to get the remainder of it > so 11 / 3 would be 2 > > is there a built in function for this in PHP? > kinda like MOD in Visual Basic? > > - Thanks > > -- > PHP General Mailing