How to get real Integer Overflows in Matlab/Octave
- by marvin2k
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...