This is an almost exact duplicate of many questions here - basically there is no exact representation of 34.38 in binary floating point, so your 34 + 19/50 is represented as 34 + k / n, where n is the power of two, and there is no exact power of two that has 50 as a factor, therefore there is no exact value of k.
If you set the output precision, you will see that the best double view is not accurate:
cout << fixed << setprecision ( 20 );
gives
char a -- 34.38 val ----- 34.38000000000000255795 modified val --- 3438.00000000000045474735 FMOD ----- 0.00000000000045474735
So, in response to your question, you are already using the best way to convert a string to double (although boost lexical cast completes your two or three lines in one line, so you can write your own function). The result is explained by the representation used by the doubles, and will apply to any final representation based on a binary floating point.
With floats, the multiplication is rounded, not up, so you get the exact result. This is not behavior you can rely on.
source share