Jochem Maas wrote:
Robert Cummings schreef:
On Tue, 2008-07-15 at 12:37 -0400, tedd wrote:
At 12:31 PM -0400 7/15/08, Robert Cummings wrote:
Umm... here it is to unlimited precision: ¼
Cheers,
Rob.
Yeah and here's ƒ
Like or not, that's all there is to it.
Weird... you're client
On Jul 16, 2008, at 11:39 AM, Shawn McKenzie wrote:
Jochem Maas wrote:
Robert Cummings schreef:
On Tue, 2008-07-15 at 12:37 -0400, tedd wrote:
At 12:31 PM -0400 7/15/08, Robert Cummings wrote:
Umm... here it is to unlimited precision: ¼
Cheers,
Rob.
Yeah and here's ƒ
Like or not, that's
[snip]
And then put it in Jay's pocket since we know he's skimming! If you're
lucky maybe he'll cut you in for not telling the boss :P
[/snip]
Allegedly.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Tue, Jul 15, 2008 at 3:50 PM, tedd [EMAIL PROTECTED] wrote:
Well, someone's client took infinity and turned it into an integral.
tdd
Yeah, but they stole your 'e' to make up for it.
--
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo.
There's an algorithm known as banker's rounding that I thought all US
banks used. I'm on blackberry right now so I don't have a pointer, but
essentially you round to the nearest even cent. 1.5 goes to 2, as does
2.5.
Waynn
On 7/15/08, tedd [EMAIL PROTECTED] wrote:
At 4:15 PM -0400 7/14/08,
On 14 July 2008 20:47, tedd advised:
Round-off errors normally don't enter into things unless your doing
multiplication and division operations. At that point, what you get
back from the operation is an approximation and not the actual
number.
Bull! Nearly all computer floating point numbers
On 14 July 2008 21:44, Jay Blanchard advised:
[snip]
So does that mean your problem is solved?
[/snip]
It would appear so. I just need to remember to check for absolute
values
when working with floats.
Yeah, that's Computer Science 101 stuff. (Well, it was when I did my
degree 30+ years
[snip]
It would appear so. I just need to remember to check for absolute
values
when working with floats.
Yeah, that's Computer Science 101 stuff. (Well, it was when I did my
degree 30+ years ago, so it's probably nearer primary school level by
now ;)
[/snip]
This is what happens when you
At 11:24 AM +0100 7/15/08, Ford, Mike wrote:
On 14 July 2008 20:47, tedd advised:
Round-off errors normally don't enter into things unless your doing
multiplication and division operations. At that point, what you get
back from the operation is an approximation and not the actual
number.
2008/7/15 tedd [EMAIL PROTECTED]:
I said:
Round-off errors normally don't enter into things unless your doing
multiplication and division operations.
And that is not Bull -- it's true. You can add and subtract all the
floating point numbers (the one's we are talking about here) you want
of their coprocessors!
peace..
-Original Message-
From: tedd [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 15, 2008 6:33 AM
To: php php
Subject: RE: [PHP] Math Weirdness
At 11:24 AM +0100 7/15/08, Ford, Mike wrote:
On 14 July 2008 20:47, tedd advised:
Round-off errors normally don't
[snip]
for most of what the majority of php/script apps deal with, it's
probably
safe to assume that addition/subtraction will be safe, but i can think
of
numerous examples where this isn't true...
[/snip]
As demonstrated by the example I provided, just checking the difference
(or lack thereof)
On Tue, Jul 15, 2008 at 11:16 AM, Jay Blanchard [EMAIL PROTECTED] wrote:
the errors add up really quickly because the platforms are
so darn much quicker than we are.
All I need to prove you wrong is an abacus and an old man with Parkinson's.
;-P
--
/Daniel P. Brown
Dedicated
On 15 July 2008 14:33, tedd advised:
At 11:24 AM +0100 7/15/08, Ford, Mike wrote:
On 14 July 2008 20:47, tedd advised:
Round-off errors normally don't enter into things unless your
doing
multiplication and division operations. At that point,
what you get
back from the operation is an
On 15 July 2008 16:07, bruce advised:
anyone remember the intel debacle in the 1990's.. when they
ate a couple
hundred million when they had a math err in one of their coprocessors!
Oh, yes!
And then, back in the day, there was the DEC arithmetic processor which
hung if you happened to
On Tue, 2008-07-15 at 11:32 +0100, Ford, Mike wrote:
On 14 July 2008 21:44, Jay Blanchard advised:
[snip]
So does that mean your problem is solved?
[/snip]
It would appear so. I just need to remember to check for absolute
values
when working with floats.
Yeah, that's Computer
On Tue, 2008-07-15 at 10:16 -0500, Jay Blanchard wrote:
[snip]
for most of what the majority of php/script apps deal with, it's
probably
safe to assume that addition/subtraction will be safe, but i can think
of
numerous examples where this isn't true...
[/snip]
As demonstrated by the
[snip]
So what you're saying is that you've been skimming for a while and the
fruits of your mislabour are adding up?
[/snip]
Not as far as you know. ;)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
At 4:52 PM +0100 7/15/08, Ford, Mike wrote:
On 15 July 2008 14:33, tedd advised:
Mike:
No reason to be rude.
I said:
Round-off errors normally don't enter into things unless your doing
multiplication and division operations.
And that is not Bull -- it's true. You can add and subtract
On Tue, 2008-07-15 at 12:26 -0400, tedd wrote:
At 4:52 PM +0100 7/15/08, Ford, Mike wrote:
On 15 July 2008 14:33, tedd advised:
Mike:
No reason to be rude.
I said:
Round-off errors normally don't enter into things unless your doing
multiplication and division operations.
At 12:31 PM -0400 7/15/08, Robert Cummings wrote:
Umm... here it is to unlimited precision: ¼
Cheers,
Rob.
Yeah and here's
Like or not, that's all there is to it.
Cheers,
tedd
--
---
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List
On Tue, 2008-07-15 at 12:37 -0400, tedd wrote:
At 12:31 PM -0400 7/15/08, Robert Cummings wrote:
Umm... here it is to unlimited precision: ¼
Cheers,
Rob.
Yeah and here's ƒ
Like or not, that's all there is to it.
Weird... you're client bastar-dized my beautiful pi symbol.
Cheers,
tedd schreef:
At 4:45 PM -0400 7/14/08, Daniel Brown wrote:
That's as far OT as I'm going, but it's worth noting how
regulation doesn't do shit if it's not enforced.
The only thing that's regulated AND enforced is what you owe the
government.
actually your under no obligation to
Robin Vickery schreef:
2008/7/15 tedd [EMAIL PROTECTED]:
I said:
Round-off errors normally don't enter into things unless your doing
multiplication and division operations.
And that is not Bull -- it's true. You can add and subtract all the
floating point numbers (the one's we are talking
Robert Cummings schreef:
On Tue, 2008-07-15 at 12:37 -0400, tedd wrote:
At 12:31 PM -0400 7/15/08, Robert Cummings wrote:
Umm... here it is to unlimited precision: ¼
Cheers,
Rob.
Yeah and here's ƒ
Like or not, that's all there is to it.
Weird... you're client bastar-dized my beautiful pi
On Tue, 2008-07-15 at 20:17 +0200, Jochem Maas wrote:
Robin Vickery schreef:
2008/7/15 tedd [EMAIL PROTECTED]:
I said:
Round-off errors normally don't enter into things unless your doing
multiplication and division operations.
And that is not Bull -- it's true. You can add and
On Tue, 2008-07-15 at 20:21 +0200, Jochem Maas wrote:
Robert Cummings schreef:
On Tue, 2008-07-15 at 12:37 -0400, tedd wrote:
At 12:31 PM -0400 7/15/08, Robert Cummings wrote:
Umm... here it is to unlimited precision: ¼
Cheers,
Rob.
Yeah and here's ƒ
Like or not, that's all
[snip]
Ask Jay, he's the skimming master! :)
[/snip]
Bow down before mebut not too far lest ye be skimmed as well.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
At 8:21 PM +0200 7/15/08, Jochem Maas wrote:
Robert Cummings schreef:
On Tue, 2008-07-15 at 12:37 -0400, tedd wrote:
At 12:31 PM -0400 7/15/08, Robert Cummings wrote:
Umm... here it is to unlimited precision: 14
Cheers,
Rob.
Yeah and here's
Like or not, that's all there is to it.
On Mon, 2008-07-14 at 12:39 -0500, Jay Blanchard wrote:
/* calculate total balance with payments and adjustments */
$totalBalance = $acct['BALANCE'] + $adjBalance;
echo number_format($totalBalance, 2, '.', '').\t;
/* calculate total charges */
[snip]
What makes you think the problem is in this code? How about doing the
following right before the block of code you've provided so that we can
actually check the data with what you're using:
?php
echo '$acct[BALANCE]: '.$acct[BALANCE].\n;
echo '$adjBalance: '.$adjBalance.\n;
echo
On Mon, 2008-07-14 at 12:39 -0500, Jay Blanchard wrote:
I am totally buffaloed by a set of very simple calculations that I am
doing;
/* calculate total balance with payments and adjustments */
$totalBalance = $acct['BALANCE'] + $adjBalance;
echo number_format($totalBalance, 2,
[snip]
So again... from whence do you conjure $endingBal? :)
[/snip]
$endingBal is conjured from the database tracking the account balance.
For any 24 hour period the beginning and ending balance for subsequent
days is the same unless adjustments or payments have been made to the
account in that
I am totally buffaloed by a set of very simple calculations that I am
doing;
/* calculate total balance with payments and adjustments */
$totalBalance = $acct['BALANCE'] + $adjBalance;
echo number_format($totalBalance, 2, '.', '').\t;
/* calculate total charges
On Mon, 2008-07-14 at 14:12 -0500, Jay Blanchard wrote:
[snip]
So again... from whence do you conjure $endingBal? :)
[/snip]
$endingBal is conjured from the database tracking the account balance.
For any 24 hour period the beginning and ending balance for subsequent
days is the same unless
[snip]
Isn't it possible then that your data is out of synch between the
current balance and the previous day's ending balance?
[/snip]
No, the values are there and correct (it is done with a snapshot). The
correct numbers are being used in the math (as shown). When I do
this(as you
Robert Cummings [EMAIL PROTECTED] wrote:
On Mon, 2008-07-14 at 14:12 -0500, Jay Blanchard wrote:
[snip]
So again... from whence do you conjure $endingBal? :)
[/snip]
$endingBal is conjured from the database tracking the account balance.
For any 24 hour period the beginning and
On Mon, 2008-07-14 at 15:33 -0400, Wolf wrote:
Robert Cummings [EMAIL PROTECTED] wrote:
On Mon, 2008-07-14 at 14:12 -0500, Jay Blanchard wrote:
[snip]
So again... from whence do you conjure $endingBal? :)
[/snip]
$endingBal is conjured from the database tracking the
On Mon, 2008-07-14 at 14:29 -0500, Jay Blanchard wrote:
[snip]
Isn't it possible then that your data is out of synch between the
current balance and the previous day's ending balance?
[/snip]
No, the values are there and correct (it is done with a snapshot). The
correct numbers are being
At 12:39 PM -0500 7/14/08, Jay Blanchard wrote:
Each number represented by a variable in all of these calculations has
been rounded to 2 decimal points at the point they are generated. For
the most part this works just hunky-dory but I have a handful of calcs
(out of 300k plus records) that look
On Mon, Jul 14, 2008 at 1:39 PM, Jay Blanchard [EMAIL PROTECTED] wrote:
I am totally buffaloed by a set of very simple calculations that I am
doing;
$totChargeDiff = $endingBal - $totalCharges;
echo number_format($totChargeDiff, 2, '.', '').\t;
You're
On Mon, Jul 14, 2008 at 3:51 PM, Daniel Brown [EMAIL PROTECTED] wrote:
You're performing math to get the result for $totChargeDiff by
subtracting $totalCharges from $endingBal. That will give you -0.10
in this case, because 0.10 - 0.20 = -0.10. You want the difference,
not the result.
On Mon, Jul 14, 2008 at 3:54 PM, Daniel Brown [EMAIL PROTECTED] wrote:
Oh, and the code, by the way:
?php
// your code to this point
/* what is the difference between the ending balance and the charges? */
$totChargeDiff = ($totalCharges $endingBal) ?
On Mon, Jul 14, 2008 at 3:51 PM, Daniel Brown [EMAIL PROTECTED]
wrote:
You're performing math to get the result for $totChargeDiff by
subtracting $totalCharges from $endingBal. That will give you -0.10
in this case, because 0.10 - 0.20 = -0.10. You want the difference,
not the
I don't quite understand your problem, but I use integers for any monetary
workings as you can guarantee it is accurate (obviously, you work in pence
or cents rather than GBP or USD).
Alex
Hello Alex,
I was reading through this thread, and I was curious about what methods
you use
On Mon, Jul 14, 2008 at 4:00 PM, Alex Chamberlain
[EMAIL PROTECTED] wrote:
Surely, for difference,
$totChargeDiff = abs($endingBal - $totalCharges);
Yes, in live code. I gave my example to illustrate my point, not
to be used in code. I believe Jay would understand that.
--
/Daniel P.
[quote]
I don't quite understand your problem, but I use integers for any monetary
workings as you can guarantee it is accurate (obviously, you work in pence
or cents rather than GBP or USD).
Alex
Hello Alex,
I was reading through this thread, and I was curious about what methods you
use
On Mon, 2008-07-14 at 15:00 -0500, Daniel Kolbo wrote:
I don't quite understand your problem, but I use integers for any monetary
workings as you can guarantee it is accurate (obviously, you work in pence
or cents rather than GBP or USD).
Alex
Hello Alex,
I was reading
On Mon, 2008-07-14 at 21:09 +0100, Alex Chamberlain wrote:
[quote]
I don't quite understand your problem, but I use integers for any monetary
workings as you can guarantee it is accurate (obviously, you work in pence
or cents rather than GBP or USD).
Alex
Hello Alex,
I was
On Mon, Jul 14, 2008 at 4:15 PM, Robert Cummings [EMAIL PROTECTED] wrote:
Nope, banks can't round like that when calculating your daily
interest :)
If it works in their favor, you'd be surprised what they do.
That's why extending TILA to banks in the US is such a big deal to me,
yet gets
On Mon, 2008-07-14 at 16:25 -0400, Daniel Brown wrote:
On Mon, Jul 14, 2008 at 4:15 PM, Robert Cummings [EMAIL PROTECTED] wrote:
Nope, banks can't round like that when calculating your daily
interest :)
If it works in their favor, you'd be surprised what they do.
That's why
[snip]
So does that mean your problem is solved?
[/snip]
It would appear so. I just need to remember to check for absolute values
when working with floats.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Mon, 2008-07-14 at 16:25 -0400, Daniel Brown wrote:
On Mon, Jul 14, 2008 at 4:15 PM, Robert Cummings
[EMAIL PROTECTED] wrote:
Nope, banks can't round like that when calculating your daily
interest :)
If it works in their favor, you'd be surprised what they do.
That's why
On Mon, Jul 14, 2008 at 4:28 PM, Robert Cummings [EMAIL PROTECTED] wrote:
I'm not completely sure about the U.S. but banks in Canada are
regulated... fortunately :)
They are here, too, to a certain extent. The problem is, they can
create their own rules that cost the customer a fortune,
[snip]
Yeah, I prefer to work with pennies too when doing that stuff. But
floats work much better when skimming... harder to track ;) Remind me
not to buy weed from Jay.
[/snip]
Hehehehehehe ;)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
At 4:15 PM -0400 7/14/08, Robert Cummings wrote:
Nope, banks can't round like that when calculating your daily
interest :)
Cheers,
Rob.
I do know that when it comes to interest you pay them, they round up.
When it comes to interest they pay you, they round down -- and why
not? A decision
At 4:45 PM -0400 7/14/08, Daniel Brown wrote:
That's as far OT as I'm going, but it's worth noting how
regulation doesn't do shit if it's not enforced.
The only thing that's regulated AND enforced is what you owe the government.
Don't get me started. :-)
Cheers,
tedd
--
---
Looks like the Doubles are not exactly zero. Must be some precision
points not displaying.
Ok... It's Friday and maybe my brain is dead, but I'm having a weird
problem with some basic math.
Here's a little snippet of the code I'm working with:
---
echo
They are not the same amount. They each got a different rounding error.
Double values only display a small number of decimal places
(relatively speaking). If you look at the difference you're getting,
it's 0.0142108547152 (I may be off by a zero or two), so
given you're working
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Math weirdness with doubles...
Looks like the Doubles are not exactly zero. Must be some precision
points not displaying.
Ok... It's Friday and maybe my brain is dead, but I'm having a weird
problem with some basic math.
Here's a little snippet
[mailto:[EMAIL PROTECTED]
Sent: Friday, February 27, 2004 3:16 PM
To: jon roig
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Math weirdness with doubles...
Looks like the Doubles are not exactly zero. Must be some precision
points not displaying.
Ok... It's Friday and maybe my brain is dead
jon roig wrote:
Ok... It's Friday and maybe my brain is dead, but I'm having a weird
problem with some basic math.
Here's a little snippet of the code I'm working with:
---
echo pCurrent:$currentAmount:.gettype($currentAmount). -
Paid:$paidAmount:.gettype($paidAmount)./p;
62 matches
Mail list logo