Re: Finding maximum of an array



> I have a huge matrix of single values all between 0 and 1 and I am looking for the
highest value.

FWIW if you could add 1.0 to those values in a cheap fashion (ie. if it doesn't have to be done all the time for all values, but can be cached in some way), then you can use integer comparisons on the floats directly, as the representation of floating point numbers ensures that for values >=1.0 the ordering is correct.

ie. you could replace

(ARow[j] >= RX)

with

RX_seen_as_integer := PInteger(@RX)^
...
(PInteger(@ARow[j])^ >= RX_seen_as_integer)

Eric
.



Relevant Pages

  • Re: Smalltalk health
    ... > FWIW - I ran the same test on Squeak this morning ... It would be interesting to try Dolphin. ... Their floating point is sometimes ...
    (comp.object)
  • Re: On writing negative zero - with or without sign
    ... The representation of a negative ... FWIW I consider the phrase "the representation of a positive or zero ...
    (comp.lang.fortran)