Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Find range in coordinates array

by VinsWorldcom (Prior)
on Sep 30, 2019 at 18:38 UTC ( #11106884=note: print w/replies, xml ) Need Help??


in reply to Find range in array with indices

Agree with jdporter above, not aware of any coordinate system where 7.133 > 7.23.

I think maybe the varying degrees of accuracy are causing confusion? 7.133 is accurate to the thousandths place, where 7.23 is only accurate to the hundredths place. Does this make it easier to understand:

7.23 = 7.230

7.230 > 7.133

UPDATE:A-ha, so this isn't coordinate space, rather Tk indices, see Re: Find range in coordinates array below.

Replies are listed 'Best First'.
Re^2: Find range in coordinates array
by huck (Parson) on Sep 30, 2019 at 18:53 UTC

    what if it were 7-23 and 7-133 where each size of the - was its own integer co-ord, and 7.23 was actualy 7.0023 and 7.133 was 7.0133

    Quick untested idea for fix

    sub fixit { my $pt=shift; my ($x1,$x2)=split(/\./,$pt); return sprintf ('%08i.%08i',$x1,$x2); } .... last if (fixit($cursorPosition) <= fixit($tagBegin));
    Much optimzation could be done to that, but it gives you the idea

      Thank you. I played a bit with your idea (your assumption was right) and I managed to get a working solution. However, I finally used the solution proposed by Haukex because it seems... simply perfect.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11106884]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2020-05-26 18:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (150 votes). Check out past polls.

    Notices?