How to get real Integer Overflows in Matlab/Octave
Posted
by marvin2k
on Stack Overflow
See other posts from Stack Overflow
or by marvin2k
Published on 2010-03-11T13:32:06Z
Indexed on
2010/03/12
3:17 UTC
Read the original article
Hit count: 381
Hi there.
I'm working on a verification-tool for some VHDL-Code in Matlab/Octave. Therefore I need datatypes which generate "real" overflows:
intmax('int32') + 1
ans = -2147483648
Lateron, it would be helpfull if i can define the bitwidth of a variable... But that is not so important...
When I build a C-like example, where a variable gets increased until it's smaller than zero, it spins forever and ever...
test = int32(2^30);
while (test > 0)
test = test + int32(1);
end
Another approach i tried was a custom "overflow"-routine which was called everytime after a number is changed. This approach was painfully slow, not practicable and not working in all cases at all...
© Stack Overflow or respective owner