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 (Abbot) 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