[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
please dont fix this... Matlab vs Octave Integer Division
From: |
David Grohmann |
Subject: |
please dont fix this... Matlab vs Octave Integer Division |
Date: |
Mon, 12 Mar 2007 18:43:56 -0500 |
User-agent: |
Thunderbird 1.5.0.10 (Windows/20070221) |
So Matlab does integer division incorrectly... I thought I should let
you know. I prefer your implementation with the correct answer.
2/3 should equal 0 but Matlab will tell you it's 1.
Matlab:
>> a = cast(2, 'uint32')
a = 2
>> b = cast(3, 'uint32')
b = 3
>> c = a / b
c = 1
>> class(a)
ans = uint32
>> class(b)
ans = uint32
>> class(c)
ans = uint32
----------------
Octave:
----------------
octave:164> b = feval( 'uint32' , 3)
b = 3
octave:165> a = feval( 'uint32' , 2)
a = 2
octave:166> a
a = 2
octave:167> b
b = 3
octave:168> class(a)
ans = uint32
octave:169> class(b)
ans = uint32
octave:170> c = a/b
c = 0
octave:171> class(c)
ans = uint32
--
David Grohmann
Senior Student Associate
Applied Research Lab : UT Austin : ESL - S206
Office: 512-835-3237
- please dont fix this... Matlab vs Octave Integer Division,
David Grohmann <=