octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ambiguous call to "pow(int, unsigned int&)" in __magick_read__.cc:76


From: Júlio Hoffimann
Subject: Re: ambiguous call to "pow(int, unsigned int&)" in __magick_read__.cc:763
Date: Sat, 27 Aug 2011 14:52:26 -0300

Nothing is always safe when talking about computer finite representation of numbers. :-) The snippet of code just prevents ambiguity during compilation, is a programmer task to guarantee the correct behavior.

About the roundoff, i don't have the solid basis on the topic to affirm with total certainty that there is no problems when working within the range (INT_MIN, INT_MAX). One thing i could say is that stdlib has accuracy as one of it's guidelines, different of other libraries which the main purpose is to implement fast as possible algorithms.

Júlio.

2011/8/27 c. <address@hidden>

On 27 Aug 2011, at 18:37, Jordi Gutiérrez Hermoso wrote:

> If that's the version of pow you intended to call,
> there is nothing
> wrong in disambiguating the call with a cast, especially if it's not a
> C-style cast. If that fixes your build, I suggest you push that patch.
> I am not seeing this problem on a more recent g++.

I was just concerned that casting back-and-forth from int to double might
introduce some unexpected behaviour due to roundoff, do you think it is always safe
to use that approach to do power elevation with integer inputs?

> - Jordi G. H.

c.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]