42
$\begingroup$

If I compute, say, 1/3//N, Mathematica displays

0.333333

as the result. When I copy that output to use elsewhere, the paste produces

0.3333333333333333`

What is the meaning and function of the backtick ?

I realize this must be quite elementary. I stand ready to be educated. :-)

$\endgroup$
1
  • 1
    $\begingroup$ See also (26772) for other appearances of the backtick, e.g. Developer`PartitionMap $\endgroup$
    – Mr.Wizard
    Commented Feb 6, 2017 at 18:18

2 Answers 2

35
$\begingroup$

The backtick is a short-hand to mark the precision of your output. If it is not followed by any number, it denotes machine precision. You can denote arbitrary precision by including a number, as for example, 0.3`20.

By default, these are not displayed in StandardForm, which is why you see them only when copying, at which point it gets converted to InputForm. You can show them with NumberMarks -> True. For example:

Sqrt[2] // N
(* 1.4142135623730951 *)

InputForm[Sqrt[2] // N, NumberMarks -> True]
(* 1.4142135623730951` *)
$\endgroup$
2
  • $\begingroup$ InputForm? You mean StandardForm, isn't it? $\endgroup$ Commented Apr 28, 2014 at 17:56
  • $\begingroup$ @SjoerdC.deVries Yes, StandardForm for the first half of the sentence. However, when editing the cell/copy pasting, it gets converted to InputForm (with NumberMarks -> True). $\endgroup$
    – rm -rf
    Commented Apr 28, 2014 at 18:36
31
$\begingroup$

The default value of

$NumberMarks
Automatic  

means that ` should by default be used in arbitrary-precision but not machine-precision numbers. Arbitrary-precision numbers can contain an arbitrary number of digits e.g. :

Sqrt[3`21] == 1.73205080756887729353

Machine numbers contain the same number of digits and maintain no information on their precision, e.g. :

{Sqrt[3`10] == Sqrt[3] // N, Sqrt[3`10]}
{True, 1.7320508076}

One can force machine numbers to be shown with number marks by :

Block[{$NumberMarks = True}, ToString[N[1/3], InputForm]]
0.3333333333333333`      

Precision[x] yields the effective number of digits of precision in the number x.

Precision /@ {1/3, 1/3 // N}

enter image description here

Precision[1/3 // N] // N
15.9546
Round[MachinePrecision]
16

You can count the number of digits before the backtick, namely 16.
The MachinePrecission is a real number because on the hardware level it is represented in the binary form. This needs 53 bits to represent almost 16 digits :

N@{MachinePrecision*Log[2, 10], MachinePrecision}
{53., 15.9546}  
$\endgroup$
10
  • $\begingroup$ Thank you! Strange that one needs to round MachinePrecision to see its value. $\endgroup$ Commented Mar 14, 2012 at 1:10
  • 1
    $\begingroup$ @Joseph MachinePrecision is a symbolic constant like Pi and E. You can see its value using N[MachinePresicion] as well. This is what Artes did with Precision[1/3 // N] // N . Rounding gives the approximate (integer) number of digits of precision it corresponds to. $\endgroup$
    – Szabolcs
    Commented Mar 14, 2012 at 5:55
  • $\begingroup$ @Szaboics: Thanks, that makes sense! $\endgroup$ Commented Mar 15, 2012 at 0:42
  • 1
    $\begingroup$ This is indeed a very educational answer, Artes---Thanks! $\endgroup$ Commented Mar 15, 2012 at 0:45
  • 1
    $\begingroup$ @Artes Oops. I had typed $MachinePrecision. That dollar signs, apparently get munged. I might have caught it in a response. But not a comment, as they don't show what the result will look like. $\endgroup$ Commented Mar 19, 2012 at 1:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.