Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

lsearch -real

50 views
Skip to first unread message

Manfred Rosenberger

unread,
Jan 26, 2023, 12:25:50 AM1/26/23
to
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

pd

unread,
Jan 26, 2023, 4:01:31 AM1/26/23
to
% lsearch -exact -real {0.0 1 2} 0.00
0

man n lsearch

heinrichmartin

unread,
Jan 26, 2023, 7:36:33 AM1/26/23
to
Also note that you can search newsgroups.

Thread "lsearch -real not working as expected" is a prominent search results for "lsearch real".

To be fair, the wiki search did not help. Also, that thread is as old as COVID-19. But as you can see, the community will help out anyway ;-)

Ralf Fassel

unread,
Jan 26, 2023, 4:13:25 PM1/26/23
to
* pd <p...@anon.net>
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'

Manfred Rosenberger

unread,
Jan 26, 2023, 11:26:37 PM1/26/23
to
I see!
thx a lot!
Manfred
0 new messages