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

As an option

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

Or

Interpretation[{x = RandomReal[]}, Button[N@Round[xButton[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.

As an option

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

Or

Interpretation[{x = RandomReal[]}, Button[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.

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.

added 267 characters in body
Source Link
Stitch
  • 4.2k
  • 1
  • 13
  • 28

As an option

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

Or

Interpretation[{x = RandomReal[]}, Button[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.

As an option

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

Or

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

As an option

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

Or

Interpretation[{x = RandomReal[]}, Button[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.

Source Link
Stitch
  • 4.2k
  • 1
  • 13
  • 28

As an option

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

Or

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