math - Is there a trunc function in C++? -



math - Is there a trunc function in C++? -

i searched around , couldn't find trunc function c++. know can this:

int main() { double = 12.566789; cout << setprecision(2) << fixed << (int)(a * 100) / 100.0 << endl; homecoming 0; }

but i'm not sure it's best way this. give thanks you.

trunc there, in <cmath>:

#include <iostream> #include <cmath> int main() { std::cout << trunc(3.141516) << std::endl; }

i suppose you're looking else?

c++ math

Comments

Popular posts from this blog

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -