octave-maintainers
[Top][All Lists]
Advanced

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

Re: Add additional integer math and conversion warnings and the intwarni


From: John W. Eaton
Subject: Re: Add additional integer math and conversion warnings and the intwarning function
Date: Tue, 19 Aug 2008 14:46:50 -0400

On 19-Aug-2008, David Bateman wrote:

| David Bateman wrote:
| > 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
| >
| Please use the attached version instead as it improves the error 
| messages. For example
| 
| octave:1> intwarning("on")
| octave:2> a = uint8(254.7)
| warning: Conversion of non-integer value from scalar to uint8 matrix
| a = 255
| octave:3> a + 1
| warning: data truncated for uint8 scalar by scalar binary operator +
| ans = 255

I applied this changeset to my archive.

Thanks,

jwe


reply via email to

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