Max/min value of any number class (maxVal/minVal) in gst?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Max/min value of any number class (maxVal/minVal) in gst?

Garreau, Alexandre
Hi,

It seems other platforms such as Squeak or Pharo have a message “maxVal”
which gives the max value of a given class, such as “SmallInteger
minVal” or “3 class minVal”, for instance.

Does GNU Smalltalk have anything, maybe incompatible, analog to this?  I
guess this must not be that hard to get but I don’t know yet enough of
SmallTalk (or even Smalltalk) so that to try to make that myself…

Sorry if I ask too much questions or ask too much things ^^'

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Max/min value of any number class (maxVal/minVal) in gst?

Holger Freyther


> On 16. Oct 2018, at 15:30, Garreau, Alexandre <[hidden email]> wrote:
>
> Hi,

Hi!


>
> It seems other platforms such as Squeak or Pharo have a message “maxVal”
> which gives the max value of a given class, such as “SmallInteger
> minVal” or “3 class minVal”, for instance.
>
> Does GNU Smalltalk have anything, maybe incompatible, analog to this?  I
> guess this must not be that hard to get but I don’t know yet enough of
> SmallTalk (or even Smalltalk) so that to try to make that myself…

on a quick skim I have not noticed anything. In the C libgst there are
two macros that might be of help to add a primitive. MAX_ST_INT and
MIN_ST_INT. The values will be different on 32bit/64bit runtimes.

But the question is how would you use it?

holger
_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Max/min value of any number class (maxVal/minVal) in gst?

Garreau, Alexandre
On 2018-10-17 at 08:37, Holger Freyther wrote:
> on a quick skim I have not noticed anything. In the C libgst there are
> two macros that might be of help to add a primitive. MAX_ST_INT and
> MIN_ST_INT. The values will be different on 32bit/64bit runtimes.
>
> But the question is how would you use it?

Yes, and how to make (if possible) equivalent messages minVal/maxVal
that would return that min and max value, but not only for SmallInteger,
as several other implementations seem to support it, and that should
increase portability while not breaking compatibility.

I guess for floats and bignums that would be ±inf (the other
implementation I saw doesn’t implement ieee754 ±inf, nor, but this time
I forgot to check, bignums).

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk