comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Commutativity of multiplication
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Commutativity of multiplication [message #50983 is a reply to message #50981] Wed, 25 October 2006 14:54 Go to previous messageGo to previous message
Sven Geier is currently offline  Sven Geier
Messages: 17
Registered: July 2002
Junior Member
David Fanning wrote:
[...]
> It also explains this:
>
> IDL> f = 500L
> IDL> g = 1UL
> IDL> help, g*(-f)
> <Expression> ULONG = 4294966796
> IDL> help, (-f)*g

Wow. This is ... uhm ... "more interesting than I thought". There's whole
realms of oddity here that I never knew existed:

IDL> help,f,g
F LONG = -500
G ULONG = 1
IDL> print,f*g
-500
IDL> print,g*f
4294966796
IDL> if f*g eq g*f then print,f*g," equals ",g*f
-500 equals 4294966796

So for the sake of multiplication preservation of a sign is considered
important enough to break commutativity, but for the sake of comparison,
type conversion is performed that changes the value of an expression by
four billion.

Some days I can get all my exercise just by shaking my head over these kinds
of oddities...

Thanks for the reply, tho ...


- S

--
http://www.sgeier.net
My real email address does not contain any "Z"s.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Syntax errors
Next Topic: Re: !P.SYMSIZE still broken? after 5 years?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 06:33:42 PDT 2025

Total time taken to generate the page: 1.12135 seconds