octave-maintainers
[Top][All Lists]
Advanced

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

Re: please dont fix this... Matlab vs Octave Integer Division


From: Benjamin Lindner
Subject: Re: please dont fix this... Matlab vs Octave Integer Division
Date: Tue, 13 Mar 2007 08:49:46 +0100

> | 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 also rounds to the nearest values for things like int32 (0.9).
> I think this that having Octave behave differently from Matlab for
> something like this is not good, so I checked in the following patch.
> Note that the /= operator was already rounding.

Yes, but is it really necessary to give up correct and IMO useful 
behaviour just because Matlab implements it differently?

Forgive my asking, but why sacrifice for the sake of compatibility?
Losing correct behaviour of integer artihmetic will remove one
item on the bonus list of Octave vs. Matlab. And 2/3=1 simply is not
correct on integers, is it?

I know that the "how far to go for compatibility"-topic can be discussed 
virtually endlessly, and in the end it's jwe's decision, but I'd like
to point out that just because matlab does something in a different way
to Octave, this is in principal not a good reason to give up features.
Especially it matlab does it buggy...

> If you really want C-style semantics, then I think maybe it would be
> best to write your own C-style integer types for Octave and/or maybe
> convince the MathWorks to also add data types that do what you want.

Well, it's not C-Style semantic, it's integer artihmetic, and not 
specialised on C. 

benjamin
-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser


reply via email to

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