Message Boards Message Boards

2 Replies
5 Total Likes
View groups...
Share this post:

What is the difference between an output like 2 and 2. ?

Posted 11 years ago
I'm new to Mathematica and get puzzled by some of its output. When using List and operations like Part I sometimes get outputs like "2", "3" etc and some other times I get "2.", "3.". Mathematica obviously interpret these as different, which I tested by using Part as input to other operations. So what is the difference? Thanks in advance.
POSTED BY: Henrik Carlsen
2 Replies
2 is an infinite precision number.  2. is a machine precision number.  You can see the difference by taking the square root.
Sqrt[2] returns Sqrt[2] as the result needs to be infinite precision.  Sqrt[2.] returns 1.4141.
POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract