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

[IMP-dev] math functions in c++



You need to use the std:: versions of the math functions when writing C ++ code. That is use "std::abs", "std::sin" etc.

By using the C++ versions, rather than the C version, you make sure that the correctly overloaded version is used. If you, for example, use just "abs", then the argument is implicitly converted to an int, which is probably not what you want. Likewise, using "sinf" in algebra where we are using doubles for computation truncates the argument, loosing accuracy for no reason.