# Dynamic Interpretation Button Label Loses Formatting on Copy and Paste

I have an Interpretation Button that displays its label correctly on evaluation. However, when I copy and paste it as input the label loses its formatting.

Interpretation[{x = RandomReal[]}, Button[Dynamic[N[x, 6]], x = RandomReal[]], N[x, 6]]


When this is copy and pasted into an input cell it changes to:

How can I get it to retain its label formatting which should be the 6 decimal place number?

Also, I though N was cutting the number down to 6 significant figures. This is obviously not the case since the machine precision number is showing up in the label. What have I missed here, as well?

• It's because an input cell displays the number input form, which is what you are seeing. – m_goldberg Dec 2 '16 at 1:52

It happens because "Input" cell style has NumberMarks -> True while "Output" inherits default False.

You can set BaseStyle -> NumberMarks -> False for the Button:

Interpretation[
{x = RandomReal[]},
Button[Dynamic[N[x, 6]], x = RandomReal[], BaseStyle -> NumberMarks -> False],
N[x, 6]
]


As an option

Interpretation[{x = RandomReal[]}, Button[Dynamic@ToString@SetPrecision[x, 6],
x = RandomReal[]], N[x, 6]]


Or

Interpretation[{x = RandomReal[]}, Button[Dynamic@N@Round[x, 1*^-6],
x = RandomReal[]], N@Round[x, 1*^-6]]


As far as I understand, N really doesn't change anything about a machine number, not even its precision, it does most of the work on exact inputs. So for machine numbers you need to use SetPrecision at the very least.