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 15:40:53 -0300

Hi Jordi,

Since i knew Boost, i never stopped to use it. As you know, it's a beautiful approach that makes C++ joyful and productive. Without Boost we need to reinvent the wheel most times.

Boost is the "unofficial home" of the new upcoming C++0x standard, we can take advantage of the new features without care about old compiler versions and things like that. Would be so much fun to see Boost on Octave code. :-)

Here is a 1 vote of a future Octave contributor. :-)

Regards,
Júlio.

2011/8/27 Jordi Gutiérrez Hermoso <address@hidden>
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?

The precision of an int is less than 52 bits in all architectures I
know of, which is the precision of a double, so it is very unlikely to
introduce a problem to cast an int to a double. In a more dubious
situation (e.g. casting a long to a double), it may be recommended to
use Boost's numeric_cast functions.

We've avoided Boost dependencies so far, but Boost is a very respected
library from which the C++ standard library is made nowadays, so I
don't think we should shy away from it if we see that it solves a
problem for us particularly well.

- Jordi G. H.


reply via email to

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