help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Right shifting in octave


From: Michael Pender
Subject: Re: Right shifting in octave
Date: Fri, 2 May 2014 14:46:05 -0400

>If i write number 0xFFFFFFFF in C ( unsigned int ), the result is -1, if i
write it in octave i get a very big number ( 4294967295). How would i force
octave to get -1 ?

Actually, there is a conversion from an unsigned int (0xFFFFFFFF) to a signed int (-1) taking place before the C language will display the supposedly unsigned value 0xFFFFFFFF as the signed value -1.  The unsigned integer representation of that number is supposed to be 4294967295, in Octave or any other language.  The question you should probably ask is "why is an unsigned integer being incorrectly displayed as a signed integer in the C code?"

- Mike


On Fri, May 2, 2014 at 11:08 AM, goblinsly <address@hidden> wrote:
Thank you for your answer,

I have to program crc in octave as a college asignment. The problem is that
i am a total beginner as far as octave goes. That is why i am using the
problem we were given in c as a guideline. It is proving to be useless
though since, as you pointed, octave and c handle number differently.

If i write number 0xFFFFFFFF in C ( unsigned int ), the result is -1, if i
write it in octave i get a very big number ( 4294967295). How would i force
octave to get -1 ?



--
View this message in context: http://octave.1599824.n4.nabble.com/Right-shifting-in-octave-tp4663871p4663875.html
Sent from the Octave - General mailing list archive at Nabble.com.

_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave


reply via email to

[Prev in Thread] Current Thread [Next in Thread]