• lsearch -real

    From Manfred Rosenberger@21:1/5 to All on Wed Jan 25 16:25:47 2023
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pd@21:1/5 to Manfred Rosenberger on Thu Jan 26 13:59:54 2023
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From heinrichmartin@21:1/5 to manfred on Wed Jan 25 23:36:31 2023
    On Thursday, January 26, 2023 at 1:25:50 AM UTC+1, manfred 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?

    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 ;-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Thu Jan 26 17:13:21 2023
    * pd <pd@anon.net>
    | 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)
  • From Manfred Rosenberger@21:1/5 to All on Thu Jan 26 15:26:35 2023
    I see!
    thx a lot!
    Manfred

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)