RE: [PHP] Math Weirdness

This is a discussion on RE: [PHP] Math Weirdness within the PHP General forums, part of the PHP Programming Forums category; On 15 July 2008 14:33, tedd advised: > At 11:24 AM +0100 7/15/08, Ford, Mike wrote: &...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-15-2008
Ford, Mike
 
Posts: n/a
Default RE: [PHP] Math Weirdness

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 approximation and not the actual
>>> number.

>>
>> Bull! Nearly all computer floating point numbers are approximations
>> because of being held in binary rather than decimal. Any number with

a
>> (decimal) fractional part that doesn't end with the digit 5 is
>> necessarily an approximation, and that's only half the story. So as

soon
>> as you involve numbers like 0.1 or 0.2, you've already got minor
>> inaccuracies which will propagate through any kind of arithmetic --

it's
>> just worse with multiplication or division because these tend to

result
>> in inaccuracy in more significant digits!
>>
>> Bottom line: a floating point value should *always* be treated with

an
>> appropriate degree of suspicion.
>>
>> Cheers!
>>
>> Mike

>
> 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 all the
> floating point numbers (the one's we are talking about here) you want
> without any rounding errors whatsoever.


Sorry, I do apologise if I came over too strongly -- there was no
intention to offend.

However, you really can't dismiss the effects of round-off errors on
addition and subtraction as lightly as that. It's simply not true that
approximations only occur at the point of doing multiplication and
division -- there *are* approximations involved in addition and
subtraction, and it is necessary to be aware that this is the case -- as
Jay proved, 0.1+0.2 is hardly ever exactly 0.3. In this sort of case, it
may well be that an appropriate degree of suspicion is simply to round
to 2 decimal places at every stage, or compare the absolute difference
to .001, but nonetheless one has to *know* that this is necessary.

Ummm -- sorry, better </rant>, now!!!

Cheers!

Mike

--
Mike Ford, Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus,
Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm
Reply With Quote
  #2 (permalink)  
Old 07-15-2008
Jochem Maas
 
Posts: n/a
Default Re: [PHP] Math Weirdness

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 symbol.


no it's the worst round error ever. how exactly do you go
from 3.1 to .25 :-P

>
> Cheers,
> Rob.


Reply With Quote
  #3 (permalink)  
Old 07-15-2008
Jay Blanchard
 
Posts: n/a
Default RE: [PHP] Math Weirdness

[snip]
Ask Jay, he's the skimming master! >:)
[/snip]

Bow down before me....but not too far lest ye be skimmed as well.
Reply With Quote
  #4 (permalink)  
Old 07-16-2008
Shawn McKenzie
 
Posts: n/a
Default Re: [PHP] Math Weirdness

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 bastar-dized my beautiful pi symbol.

>
> no it's the worst round error ever. how exactly do you go
> from 3.1 to .25 :-P


Easy, subtract 2.85

-Shawn

>
>>
>> Cheers,
>> Rob.

>

Reply With Quote
  #5 (permalink)  
Old 07-16-2008
Jason Pruim
 
Posts: n/a
Default Re: [PHP] Math Weirdness


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 all there is to it.
>>>
>>> Weird... you're client bastar-dized my beautiful pi symbol.

>> no it's the worst round error ever. how exactly do you go
>> from 3.1 to .25 :-P

>
> Easy, subtract 2.85


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


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
japruim@raoset.com




Reply With Quote
  #6 (permalink)  
Old 07-16-2008
Jay Blanchard
 
Posts: n/a
Default RE: [PHP] Math Weirdness

[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".
Reply With Quote
  #7 (permalink)  
Old 07-16-2008
Daniel Brown
 
Posts: n/a
Default Re: [PHP] Math Weirdness

On Tue, Jul 15, 2008 at 3:50 PM, tedd <tedd.sperling@gmail.com> 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. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:00 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0