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

Home » Public Forums » archive » Interesting Rant
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: Interesting Rant [message #51351 is a reply to message #51314] Thu, 16 November 2006 17:00 Go to previous messageGo to previous message
Steve Eddins is currently offline  Steve Eddins
Messages: 9
Registered: July 2001
Junior Member
Nigel Wade wrote:
[snip]
>> In MATLAB, both 7/2 and 7/2. evaluate to 3.5 (displayed as
>> 3.5000 by default).
>
> MATLAB defaults to using double precision for all variables. As a corollary to
> the IDL "problem" of 7/2, try the same integer calculation in MATLAB to see how
> useful the opposite camp can be:
>
>>> int16(7)/int16(2)
>
> That one rather annoyed me when MATLAB first introduced non-double matrices.
> After I spent several days reprogramming a MATLAB to C interface so it returned
> integer matrices for integer data I discovered just how comprehensive their
> support of non-double data types was.
>
>
> For those of you who don't have access to MATLAB, the result of the MATLAB
> integer division is:
>
> ??? Error using ==> /
> Function '/' is not defined for values of class 'int16'.
>
> I wonder how much that would annoy our CS major ranter?

Those who have access to MATLAB 7.0 (June 2004) or later would get this:

>> int16(7) / int16(2)
ans =
4

(MATLAB rounds the fractional part instead of truncating it.)

--
Steve Eddins
http://blogs.mathworks.com/steve
[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
Previous Topic: Re: Bitmap vectorization
Next Topic: Color background with PLOT

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

Current Time: Wed Oct 08 19:34:40 PDT 2025

Total time taken to generate the page: 0.00429 seconds