in reply to cos (100000000.0)

Did you try checking out the site archives? For example, yesterday someone asked a very similar question with An arithmetic oddity and a Super Search for precision yields a large number of results, and the first one (int($x) gives strange result) is a good discussion of exactly this issue.

Please read up on how floating point arithmatic works - for example What Every Computer Scientist Should Know About Floating-Point Arithmetic. I suspect that in C++ you are invoking the single precision cosine function (or maybe just the single-precision string format for output) and double precision in Java and Perl - doesn't it strike you as odd that it returns half as many digits? And I would like to know why you think any of those are more or less accurate - have you actually calculated the analytical answer? And what are you trying to do that requires 16 digits of precision - the Planck constant is only known to 8.

In short, what are you really trying to do? This sounds a lot like an XY Problem to me.