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

Home » Public Forums » archive » Re: Basic Math: I _hope_ this is a stupid question
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: Basic Math: I _hope_ this is a stupid question [message #43792 is a reply to message #43789] Sun, 24 April 2005 14:48 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ed Hyer writes:

> IDL> print,288*180
> -13696
> IDL> print,long(288*180)
> -13696
> IDL> print,ulong64(288*180)
> 18446744073709537920
> IDL> print,288.*180
> 51840.0
>
> I just want to multiply two integers! Is that so wrong?

Here are a couple of articles for you:

http://www.dfanning.com/math_tips/sky_is_falling.html
http://www.dfanning.com/math_tips/double.html

Where you see "double" you should read "long integer", and where
you see "float" you should read "integer".

Basically, casting a short multiplication (288*180) to a
long *after* you do the arithmetic, doesn't gain you
anything. You have to do it *before* you to the arithmetic. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDLgrPolygon -TEXTURE_MAP question
Next Topic: overriding system functions.

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

Current Time: Sun Oct 12 07:21:38 PDT 2025

Total time taken to generate the page: 0.15846 seconds