# Simple alternative to N[x]

Posted 1 year ago
1438 Views
|
3 Replies
|
2 Total Likes
|
 A fast way to get an exact fraction into its real-number equivalent is to multiply by 1.0 (or just 1.)Example: In[1]:= x = 355/113 Out[1]= 355/113 In[2]:= 1.0 x Out[2]= 3.14159 In[3]:= N[x] Out[3]= 3.14159 
3 Replies
Sort By:
Posted 1 year ago
 I'll add the note that this is exactly what Maeder recommended in the first edition of Programming in Mathematica, back when Mathematica did not have the ability to propagate inexact numbers throughout a computation (pre-version 2, IIRC).
 And if you want it to a certain number of digits, you can use something like 120 Pi `