octave-maintainers
[Top][All Lists]
Advanced

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

Re: Extension to intmin/intmax to accept integer values?


From: Carnë Draug
Subject: Re: Extension to intmin/intmax to accept integer values?
Date: Sat, 10 Nov 2018 19:28:12 +0000

On Sat, 10 Nov 2018 at 15:49, Rik <address@hidden> wrote:
>
> 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.

This seems like a very nice addition.  I don't think I ever just
wanted to get intmax/intmin for a specific class, it's always the
intmax/min of a passed argument.  Grepping for intmax on the image
package and the core image functions, confirms the same.

~
carandraug



reply via email to

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