On Mon, Aug 19, 2013 at 7:09 PM, David Korn <[email protected]> wrote:
> Subject: Re: [ast-developers] float i; (( i.MAX, i.MIN, i.EPSILON )) 
> constants?
>> Could the numeric types, i.e. typeset -i/-E have a similar
>> functionality like b.true to access the minimum, maximum, epsilon, ...
>> values?
>>
>> For example:
>>
>> typeset -lE i; (( i.MIN )) would be the equivalent to C's LDBL_MIN
>> typeset -lE i; (( i.MAX )) would be the equivalent to C's LDBL_MAX
>> typeset -lE i; (( i.EPSILON )) would be the equivalent to C's LDBL_EPSILON
>> typeset -lE i; (( i.MAX_10_EXP )) would be the equivalent to C's 
>> LDBL_MAX_10_EXP
>> typeset -sE i; (( i.MIN )) would be the equivalent to C's FLT_MIN
>> typeset -sE i; (( i.MAX )) would be the equivalent to C's FLT_MAX
>> typeset -sE i; (( i.EPSILON )) would be the equivalent to C's FLT_EPSILON
>> typeset -sE i; (( i.MAX_10_EXP )) would be the equivalent to C's 
>> FLT_MAX_10_EXP
>
> Interesting idea, but the implementation technique that I use for
> types would be too inefficient in space for numbers.

Well... it would solve the issue I had with my .sh.math idea to store
the constants there - what happens if someone picks the wrong type for
a specific constant (e.g. uses .sh.math.FLT_MAX for a "typeset -l -E"
etc.) ... Tina's idea (derived from java, python and other similar
languages) solves the issue in a very clean and programmer-friendly
way...

> I will put this on my list of possible extensions.

Erm... doesn't this just require a small modification of the
arithmetic engine (I don't know how to do the same for a plain
${i.MAX}), e.g. do a type-based (technically we "only" have six types
- three integer and three float) lookup of the matching constant value
if an integer name is followed by a '.' ?

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to