Re: HIGH Decimal ?
- From: "James J. Weinkam" <jjw@xxxxxxxxx>
- Date: Mon, 14 Apr 2008 23:53:48 GMT
robin wrote:
"James J. Weinkam" <jjw@xxxxxxxxx> wrote in message news:DPCMj.26279$KP5.24294@xxxxxxxxxxxrobin wrote:"James J. Weinkam" <jjw@xxxxxxxxx> wrote in message news:n1sMj.9963$682.9422@xxxxxxxxxxxPerhaps I did not make myself clear.
The OP didn't say why he wanted these values, but a common reason forMIN is available for that, as is MAX.
wanting the algebraically largest or smallest possible value is to
initialize a minimization or maximization algorithm.
Consider a possibly empty list of values. We wish to find mn and mx, the
smallest and largest values in the list respectively. What should mn amd
mx be initialized to so that we can examine each element in turn and
come up with the correct answer? The answer is that mn should be
initialized to the largest representable value and mx to the smallest.
If there are no elements in the list, it is sufficent that mx = mn-1.
In the general case, MAX and MIN are sufficient.
But if there are no elements in the list, any value is irrelevant.
There is no need to know what are the largest possible value and most negative
value. They are irrelevant.
Please yourself. However there are sound mathematical reasons for doing as I outlined.
For the operations addition and multiplication most people are familiar with the application of the operations to sequences of values using summation (sigma) or product (pi) notation. PL/I provides the SUM and PROD builtin functions for these two cases and also ANY and ALL that apply the notion to or (|) and and (&).
This idea can be generalized to any binary operation %:DxD->D, where D is some domain. This concept is most easily expressed using APL notation. If v is a vector of numbers +/v is their sum;{times}/v is their product, where {times} stands for the APL symbol for multiplication which is a cross and is not readily displayed in news group messages in a manner that everyone can read; and in general, %/v is equivalent to v[1]%v[2]%...%v[n]. These are called plus reduction, times reduction, or in general % reduction.
If u and v are two vectors, u,v is their concatenation. Ideally one would like ((%/u)%%/v)=%/u,v to hold in all cases including those where u and/or v is the empty vector, e. This only holds in general if % is associative and %e is defined to be a two sided identity for %. This means that if % is {max} or {min} %/e should be smallest representable value or largest representable value respectively.
In APL, as well as in other languages that support this concept in a general fashion, +/e and {or}/e are 0, {times}/e and {and}/e are 1, and ,/e is e. On the other hand, {nand}/e gives a DOMAIN error since nand has no identity and the relationship stated above does not hold in general even for non empty boolean vectors since nand is not associative.
.
- References:
- HIGH Decimal ?
- From: WalterR
- Re: HIGH Decimal ?
- From: robin
- Re: HIGH Decimal ?
- From: James J. Weinkam
- Re: HIGH Decimal ?
- From: robin
- Re: HIGH Decimal ?
- From: James J. Weinkam
- Re: HIGH Decimal ?
- From: robin
- HIGH Decimal ?
- Prev by Date: Re: HIGH Decimal ?
- Next by Date: Re: HIGH Decimal ?
- Previous by thread: Re: HIGH Decimal ?
- Next by thread: Re: HIGH Decimal ?
- Index(es):
Relevant Pages
|