Extrema

by Pirion
This library creates a container that allows you to store a single value within minimum and maximum constants. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Pirion.extrema##version=3

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://Pirion.extrema##version=3

36 downloads
Version 1.2
Date added: Jul 26 2014
Last updated: Jun 19 2015
0 fans
The extrema are the minimum and maximum values of a function. This library creates a container that allows you to store a single value within these constants.

The library also provides some convenience functions that provides general functionality.

Comments

Pirion: (Sep 5 2014, 5:38 pm)
Thanks, sure is relevant. I actually added the macro form in my last update.
Mr_Goober: (Sep 5 2014, 3:24 pm)
Not sure if relevant, but I usually keep a handy Clamp function laying around.

// Text Macro Form
#define Clamp(N,L,H) max(min(N,H),L)

// Function Form
proc/Clamp(N=0,L=0,H=100)
return max(min(N,H),L)

// Example Use:
proc/Test()
var/d = 100
d = Clamp(d,0,50) // d is now 50.
world << d // prints 50.
FKI: (Aug 16 2014, 2:10 pm)
If the situation calls for an object, then I would say it should be turned into an object. There's nothing wrong with using objects that way (I do it myself), in fact I find it to be very robust.
Ter13: (Aug 16 2014, 10:58 am)
This is a side question that's a little off topic but what program is that speed test run in? Sorry if its off topic.

Dream Seeker has a profiling tool. Right click on the title bar of Dream Seeker, and click on server->Profile...
Zelda123: (Aug 16 2014, 9:33 am)
This is a side question that's a little off topic but what program is that speed test run in? Sorry if its off topic.