* pd <
[email protected]>
| On 26/1/23 10:25, Manfred Rosenberger wrote:
| > I do not understand the option -real
| > % lsearch -real {0 1 2} 0.0
| > -1
| > % lsearch -real {0 1 2} 0
| > 0
| > % lsearch -real {0.0 1 2} 0.00
| > -1
| > % lsearch -exact {0.0 1 2} 0.00
| > -1
| > % lsearch -exact {0.0 1 2} 0.0
| > 0
| > %
| > ------------
| > it does not recognize
| > 0 in {0 1 2} as the same as 0.0
| > 0.0 in {0.0 1 2} as the same as 0
| > ------------
| > to do a exact matching I could use: lsearch -exact ..
| > -----------
| > so how shall I expect the option -real is working?
| > ---------
| > Thanks for responding!
| > Manfred
| % lsearch -exact -real {0.0 1 2} 0.00
| 0
| man n lsearch
To be precise:
CONTENTS DESCRIPTION OPTIONS
These options describe how to interpret the items in the list being
searched. ***They are only meaningful when used with the -exact and
-sorted options.***
(*** emphasis by me)
-real The list elements are to be compared as floating-point values.
So you need both -real *and* -exact.
R'
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)