On Sat, 28 Jan 2006 12:51:53 -0500 Hans-Christoph Steiner hans@eds.org wrote:
You might notice, I am doing some math these days ;). I just had another idea for a handy thing when doing math: a method of getting the smallest and largest possible numbers. Basically, the Pd version of a #define INFINITY 1e37 (or whatever it is).
I think it would be handy to have as part of [float], like this:
[float infinity] and [float -infinity] (FLT_MAX and FLT_MIN) or maybe: [float max] and [float min] (FLT_MAX and FLT_MIN)
Other float.h defines would also be handy to have access to:
http://www.gnu.org/software/libc/manual/html_node/Floating-Point- Parameters.html
Something like this:
[float max_exp] (FLT_MAX_EXP) [float min_exp] (FLT_MIN_EXP)
And perhaps [int] could also have the relevant versions of the same too. I guess that would just be:
[int infinity] and [int -infinity] or maybe: [int max] and [int min]
I don't think I'll have time to code this any time soon, but I can put it into feature requests...
Please do. I would also find this really useful. I recently wrote an external to help remove infs and NaNs from data I was sending to a database, and needed to write a another silly extern to to generate the values to test it! Something like that should definitely be possible with 'builtins'.
Jamie