Number is always represented with the closest double?
A real number is usually between two double representation.
Always the closest representation is used or not necessary?

Not sure what you are asking. Maybe you should post an example of what you want.

My question is:
Every built in operators (+-*/) and math functions (like: sin, cos, sqrt, ...)
acts on floating point numbers a way like the result is rounded to the nearest representable floating point number?

C++ does not require that, but the IEEE floating-point standard does. So if you're using C++ on an IEEE-conforming machine, it will behave as you want; otherwise you get what you get.

The numbers are not rounded -- excess digits that won't fit in the size of the float or double are just dropped (truncated). Thus if the actual value is 1.236 but only three digits fit in the variable than the variable's value will be 1.23.

Here is a more thorough and accurate description of the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.