Re: [eigen] fix double-promotion in 3.3 Core/SpecialFunctions.h |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: [eigen] fix double-promotion in 3.3 Core/SpecialFunctions.h*From*: Ilja Honkonen <ilja.j.honkonen@xxxxxxxx>*Date*: Thu, 5 May 2016 09:04:33 -0400

std::pow(float, int) actually gets promoted to std::pow(double, double).Note that this is correct as of c++11: http://en.cppreference.com/w/cpp/numeric/math/powYes, I looked that up as well. I don't know what gave me the idea that there were pow(float, int) and pow(double, int) overloads.

This is especially bad for std::pow(x, 2). Inside Eigen we can useDoes pow(x, 2.0) fix it? If not, pow(x, float(2)) at least should...Yes that would work, but it is inefficient. I (wrongfully) expected pow(x, 2) to be evaluated to x*x, at least if the exponent is known at compile time and small. That could work, if pow(float, int) got

Ilja

**Follow-Ups**:**Re: [eigen] fix double-promotion in 3.3 Core/SpecialFunctions.h***From:*Christoph Hertzberg

**References**:**[eigen] fix double-promotion in 3.3 Core/SpecialFunctions.h***From:*Ola Røer Thorsen

**Re: [eigen] fix double-promotion in 3.3 Core/SpecialFunctions.h***From:*Christoph Hertzberg

**Re: [eigen] fix double-promotion in 3.3 Core/SpecialFunctions.h***From:*Christoph Hertzberg

**Re: [eigen] fix double-promotion in 3.3 Core/SpecialFunctions.h***From:*Ilja Honkonen

**Re: [eigen] fix double-promotion in 3.3 Core/SpecialFunctions.h***From:*Christoph Hertzberg

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] fix double-promotion in 3.3 Core/SpecialFunctions.h** - Next by Date:
**Re: [eigen] fix double-promotion in 3.3 Core/SpecialFunctions.h** - Previous by thread:
**Re: [eigen] fix double-promotion in 3.3 Core/SpecialFunctions.h** - Next by thread:
**Re: [eigen] fix double-promotion in 3.3 Core/SpecialFunctions.h**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |