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 #43789 is a reply to message #43754] Mon, 25 April 2005 05:44 Go to previous messageGo to previous message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
David Fanning wrote:
> 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. :-)
>

Hi,

You might also consider using the COMPILE_OPT compile flag DEFINT32 at
the beginning of your routines. I have taken Mark Hadfield's
recommendation to heart and now use COMPILE_OPT IDL2 pretty much everywhere.

Cheers,
Ben
[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: Sat Oct 11 17:20:39 PDT 2025

Total time taken to generate the page: 0.00256 seconds