Just about casting, in the situation where you do it to avoid a warning about narrowing of a type (the opposite of your question), use static_cast<type>(value) rather than a C style cast.
double is not the greatest precision for FP, although 15 or 16sf with double is normally enough for most things. longdouble can do 18 or 19sf. Libraries exist for arbitrary precision types.
> Ok, I will bite, this once : So you continue to troll, this time with petulance.
Please remember that I at least have 1/3 valueable posts in total (389.3333 posts)
The operation might give an inaccurate result if I would store it in a float number (according to IEEE floating point arithmetic). Maybe because variable "factor" is a double, then the result of it is automatically stored in a double memory place?
The operation might give an inaccurate result if I would store it in a float number (according to IEEE floating point arithmetic).
Yes. float can only do 6 or 7 sf, so it's precision is easily exceeded.
Maybe because variable "factor" is a double, then the result of it is automatically stored in a double memory place?
Because factor is a double means the type of the expression on the rhs of = is promoted to double. vfirstx is also double, and that is it's storage type (the lhs of =). But people often make the mistake of having an expression on the rhs that is double, then cause an implicit cast to some lesser type (float or some int type say) on the lhs. This should attract a warning if one has a compiler flag turned on to do it.