Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^2: sub as mathematical function

by vr (Curate)
on Sep 04, 2019 at 21:04 UTC ( #11105630=note: print w/replies, xml ) Need Help??

in reply to Re: sub as mathematical function
in thread sub as mathematical function

Measure (and cost) of returning "exactly the same" result unspecified, a pedant would note it's pure luck and coincidence that for 9 intervals these functions indeed seem to always return the same. For a simple case of 6 intervals:

~$ perl -E 'say 4 if 0.8333333333333333 < 5/6' 4 ~$ perl -E 'say int 6 * 0.8333333333333333' 5

For maybe general case of 100 intervals, playing with Data::Float (and from similar experiment literal number above came from):

~$ perl -MData::Float=nextdown -E '$n=100; for(1..$n){say if $_-1 != i +nt $n*nextdown $_/$n}' 5 10 17 20 23 34 40 46 67 68 80 81 92 93

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2021-04-14 02:16 GMT
Find Nodes?
    Voting Booth?

    No recent polls found