C++ Math trunc()
The function rounds off the given value towards zero and returns the nearest integral value whose magnitude is not greater than the given value.
Suppose a number is 'x'. Syntax would be :
Note: return_type can be float,double or long double.
x: The value that can be float,double or long double.
It returns a rounded value of x.
Let's see a simple example when the value of x is positive.
The value of x is :8.8 Truncated value of x is :8
Let's see a simple example when the value of x is negative.
The value of x is :-3.9 Truncated value of x is:-3
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week