In article <(E-Mail Removed)>,

Patrick Maupin <(E-Mail Removed)> wrote:

>On Mar 29, 10:29=A0pm, Steven D'Aprano

><(E-Mail Removed)> wrote:

>> On Mon, 29 Mar 2010 19:24:42 -0700, Patrick Maupin wrote:

>> > On Mar 29, 6:19=A0pm, Steven D'Aprano <st...@REMOVE-THIS-

>> > cybersource.com.au> wrote:

>> >> How does the existence of math.fsum contradict the existence of sum?

>>

>> > You're exceptionally good at (probably deliberately) mis-interpreting

>> > what people write.

>>

>> I cannot read your mind, I can only interpret the words you choose to

>> write. You said

>>

>> [quote]

>> See, I think the very existence of math.fsum() already violates "there

>> should be one obvious way to do it."

>> [end quote]

>>

>> If sum satisfies the existence of one obvious way, how does math.fsum

>> violate it? sum exists, and is obvious, regardless of whatever other

>> solutions exist as well.

>

>Because sum() is the obvious way to sum floats; now the existence of

>math.fsum() means there are TWO obvious ways to sum floats. Is that

>really that hard to understand? How can you misconstrue this so badly

>that you write something that can be (easily) interpreted to mean that

>you think that I think that once math.fsum() exists, sum() doesn't

>even exist any more????
To a mathematician sum(set) suggest that the order of summation

doesn't matter. (So I wouldn't use sum for concatenating lists.)

Harshly, sum() should be used only for operator + both associative and

commutative.

Now for floating point numbers the order of summation is crucial,

not commutative (a+b)+c <> a+(b+c).

So the obvious thing for someone versed in numerical computing

do is looking whether sum() gives any guarantees for order and

whether there may be a special sum() for floating point.

(This is not very realistic, because such a person would have

skimmed the math library a long time ago, but anyway.)

Met vriendelijke groeten,

Albert van der Horst

--

Albert van der Horst, UTRECHT,THE NETHERLANDS

Economic growth -- like all pyramid schemes -- ultimately falters.

albert@spe&ar&c.xs4all.nl &=n

http://home.hccnet.nl/a.w.m.van.der.horst
--

--

Albert van der Horst, UTRECHT,THE NETHERLANDS

Economic growth -- being exponential -- ultimately falters.

albert@spe&ar&c.xs4all.nl &=n

http://home.hccnet.nl/a.w.m.van.der.horst