<climits> Equivalent?
Posted: Thu Jun 25, 2015 6:03 pm
I recently had the need for both INT_MAX and INT_MIN in Livecode - what solutions are you guys using to accomplish this behavior?
I need to be able to reliably run mathematical operations (min, max, comparators, etc) on pairs of numbers, and when numbers get too large, you start to get very strange behavior. I suppose I could hard-code the values of -999 trillion and 999 trillion, which seem to be a functional limit based on 60 seconds of testing in the message box, but I'd prefer to use a more reliable, version-agnostic method if possible. Any ideas?
(For reference, I'd like to use it to do unified set evaluations in a math library; i.e. tVar < 0 could be thought of as testing whether tVar is in the set (INT_MIN,0), while -5 < tVar <= 0 could be represented as (-5,0] and so on. However, without a reliable way of representing INT_MIN and INT_MAX, single-sided ranges aren't very well-defined sets.)
I need to be able to reliably run mathematical operations (min, max, comparators, etc) on pairs of numbers, and when numbers get too large, you start to get very strange behavior. I suppose I could hard-code the values of -999 trillion and 999 trillion, which seem to be a functional limit based on 60 seconds of testing in the message box, but I'd prefer to use a more reliable, version-agnostic method if possible. Any ideas?
(For reference, I'd like to use it to do unified set evaluations in a math library; i.e. tVar < 0 could be thought of as testing whether tVar is in the set (INT_MIN,0), while -5 < tVar <= 0 could be represented as (-5,0] and so on. However, without a reliable way of representing INT_MIN and INT_MAX, single-sided ranges aren't very well-defined sets.)