Precision and rounding issue?

Hello,
I have been interfacing to another program using the .NET interface, and found that real values which at their source have at least 7 digits of precision are being rounded. That lead me to read them as strings and apply ToExpression, with the same result.Since ToExpression uses input rules, i tried just a direct keyboard input, with the same results. Have I forgotten something? Can anyone tell me why I am failing to get a real number of 7 digits into Mathematica? I’m on the current release of 10 on win 7.

In[1]:= real = 39.99998

Out[1]= 40.

In[2]:= N[real, 15]

Out[2]= 40.

In[3]:= 100000 real

Out[3]= 4.*10^6

In[4]:= Precision[real]

Out[4]= MachinePrecision

In[5]:= $MachinePrecision

Out[5]= 15.9546

It is just a matter of output formating, which is abbreviated by default. Try

FullForm[real]
NumberForm[real, 10]
RealDigits[100000 real]

The function N is meant to turn exact symbolic numbers into floating-point numbers. It does not do much to numbers that are already floating-point. The whole matter is confusing, though. Mathematica has formating conventions that are fine most of the times, but can run against expectations in some cases.

Yes, Thank you. The problem was just formatting, which is likely in the definition of StandardForm. Does anyone know how to customize in a notebook the number of digits MAthematica is willing to display in StandardForm?

I believe this might provide what you want:

SetOptions[EvaluationNotebook[], PrintPrecision -> 10]

with the caveat from the documentation for ‘PrintPrecision’:

“This function has not been fully integrated into the long-term Wolfram Language, and is subject to change.”

To globally set the number of digits displayed, use Edit → Preferences:

For an individual notebook, PrintPrecision can be changed through Option Inspector

Thank you all. This was just what I needed!