Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: Non-integer print output???

by syphilis (Archbishop)
on Sep 10, 2021 at 14:33 UTC ( [id://11136640]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Non-integer print output???
in thread Non-integer print output???

The exponentiation operator a**b is IIRC optimized to generally handle float input for a and b and is approximating the result.

Does this arise because C's pow/powl/powq functions take floating point inputs and return floating point values ?
I've always assumed so, without ever really knowing.

I'm a little surprised that the C language doesn't provide a pow() function that takes and returns signed long int (or signed long long int) values - though I guess such a function would easily overflow for relatively low input values.

Cheers,
Rob

Replies are listed 'Best First'.
Re^4: Non-integer print output???
by bliako (Monsignor) on Sep 10, 2021 at 17:18 UTC
Re^4: Non-integer print output???
by LanX (Saint) on Sep 10, 2021 at 15:45 UTC
    As I said, it's AFAIR an approximation algorithm.

    I quickly found efficient integer algorithms too, can't tell why they are not included.

    I suppose it's provided by the CPU/ MMU?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-03-29 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found