octave-maintainers
[Top][All Lists]
Advanced

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

Extension to intmin/intmax to accept integer values?


From: Rik
Subject: Extension to intmin/intmax to accept integer values?
Date: Sat, 10 Nov 2018 07:38:50 -0800

The current intmin/intmax accept a string as an input.  For example,

intmax ("uint8")
=> 255

How useful would it be to accept an actual integer class variable?  I could
see situations where one might have created an integer variable of some
sort, or maybe it was someone else's code so you have even less of an idea,
and you would like to know something about the limits.  Sample code

x = uint8 (3);
... lots of intervening code ...
intmax (x)
=> 255

Of course, one way to do this would simply be to get the class of the
variable and feed it to intmax.

class (x)
=> uint8
intmax (class (x))
=> 255

But, it still feels nicer to just query the variable directly.  If this is
of interest it isn't very hard to had to bitfcns.cc.  It would be an Octave
extension beyond Matlab's behavior.

--Rik




reply via email to

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