Skip to main content
3 of 3
added 16 characters in body
Stitch
  • 4.2k
  • 1
  • 13
  • 28

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.

Stitch
  • 4.2k
  • 1
  • 13
  • 28