Add additional integer math and conversion warnings and the intwarning function

David Bateman David.Bateman at motorola.com
Mon Aug 18 11:11:40 CDT 2008


Attached is a patch that adds the warnings

Octave:int-convert-nan
Octave:int-convert-non-int-val
Octave:int-math-overflow

and the intwarning function to control them. Initially they are off by 
default. For example consider

octave:1> intwarning("query")
The state of warning "Octave:int-convert-nan" is "off"
The state of warning "Octave:int-convert-non-int-val" is "off"
The state of warning "Octave:int-convert-overflow" is "off"
The state of warning "Octave:int-math-overflow" is "off"

octave:2> a = uint8(254.7)
a = 255
octave:3> a + 1
ans = 255
octave:4> intwarning("on")
octave:5> a = uint8(254.7)
warning: Conversion of non-integer value from scalar to uint8 matrix
a = 255
octave:6> a + 1
warning: data truncated converting from uint8 scalar to scalar
ans = 255

regards
David

-- 
David Bateman                                David.Bateman at motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch8248
Url: https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080818/3a1d76a8/attachment-0001.ksh 


More information about the Octave-maintainers mailing list