toon-members
[Top][All Lists]
Advanced

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

[Toon-members] Precision in SE3::exp()


From: Simon Taylor
Subject: [Toon-members] Precision in SE3::exp()
Date: Wed, 28 Mar 2012 18:25:52 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.28) Gecko/20120313 Thunderbird/3.1.20

Howdy all,

I've just been tracking down an unexpected change in output after some refactoring, and the root cause is fixed by the attached patch.

When precision is float, it is implicitly converted to double and double ::cos(double) is called, and the rest of that expression will also be promoted to double. My refactoring removed a "using namespace std" so the std::cos(float) overload was (IMHO correctly) used in my previous code. SE3::exp already has a "using std::sqrt;" statement, so style should probably be matched when it's fixed.

I've been trying to find a list of C++ overloads that are added std to search for all potential occurrences of these sorts of issues but I haven't had much luck. There's a couple of gcc options that help tracking them down in code that actually gets compiled (-Wdouble-promotion and -Wconversion) but I don't think there's a warning for implicit parameter conversion (I can't make "double v = ::sqrt(1.3f);" generate any warnings, but having v as a float makes -Wconversion pick it up as possible data loss).

Simon

ps: since the git switch we seem to have lost commit email notifications...

Attachment: explicit_std_namespace.patch
Description: Text Data


reply via email to

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