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

Home » Public Forums » archive » -32768
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: -32768 [message #88127 is a reply to message #88126] Fri, 21 March 2014 11:39 Go to previous messageGo to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Friday, 21 March 2014 19:16:40 UTC+1, fawltyl...@gmail.com wrote:
> On Friday, March 21, 2014 7:02:08 PM UTC+1, Yngvar Larsen wrote:
>
>
>
>> For literals, I agree that this might be regarded as dubious. But in general, the fact that N-bit integer arithmetic is silently wrapped modulo 2^N should be regarded as semantically well defined. If not, I believe a serious performance hit would result.
>
> The C standard guarantees modulo 2^N arithmetic for unsigned integers only. For signed integers, the behavior is undefined.

Thanks for the info! I didn't know that. Fortunately, I haven't had to do much numerical work in C lately.

Do you by any chance know the rationale behind that?

> -32768 is a funny number. Did you know that its absolute value is negative?
>
> IDL> help, abs(-32767-1)
> <Expression> INT = -32768

Yes! In fact, we've been internally misusing that fact in an IDL routine at work :) I guess we probably shouldn't, but it worked to well in the context to leave it alone!

--
Yngvar
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Killing Widget Objects
Next Topic: How to choose the pixels along a curve in an image

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

Current Time: Fri Oct 10 09:15:43 PDT 2025

Total time taken to generate the page: 1.11892 seconds