Monday, April 14, 2008

Rant

Sometimes, Matlab language drives me nuts. It appears that software engineers just went for the most illogical and incorrect design decisions. Here's an example:

int16(100000000) returns 32767 (So, in Matlab integers are not a group. Why not go for modular arithmetic?)

int16(1)+0.4 returns an answer of class int16 (So, Matlab demotes(!) types in arithmetic expressions.)

(int16(1)+0.4)+0.4 returns 1, but
int16(1)+(0.4+0.4) returns 2 (So, in Matlab addition is not associative!)


Why? Oh, Why?

1 comment:

cocus said...

saturated arithmetic was probably chosen because intel SIMD integer instructions use it (MMX, SSE)