Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to compare between Sqrt[3.] and Sqrt[3]. To display the result, I mapped HoldForm to display the expressions on the left hand column (code at end), but it seems like Sqrt[3.] had been evaluated before it was mapped on to. Is there any way to stop that to happen?

Mapping HoldForm

Grid[Prepend[{HoldForm[#], Precision[#], 
     MachineNumberQ[#]} & /@ {Sqrt[3.], Sqrt[3]}, {"Number", 
   "Precision[]", "MachineNumberQ[]"}],
 Frame -> All]
share|improve this question
up vote 3 down vote accepted
Grid[Prepend[{HoldForm[#], Precision[#], 
     MachineNumberQ[#]} & /@ {Unevaluated@Sqrt[3.], 
    Sqrt[3]}, {"Number", "Precision[]", "MachineNumberQ[]"}], 
 Frame -> All]

enter image description here

share|improve this answer
Thank you so much for your help rasher. If you're able to, could you help me explain why HoldForm@Unevaluated@Sqrt[3.] would return Unevaluated[Sqrt[3.]] instead of just Sqrt[3.]? It seems that if a method works directly, it may not work using Map and vice versa. – seismatica Jun 21 '14 at 10:28
@seismatica: That's because Sqrt[3] evaluated is displayed as Sqrt[3] - its value. Try replacing it with Sqrt[4] with and without the Unevaluated - I'm sure the lightbulb will come on, if not comment back. edit: hang on - I may have misread your comment question... if so, I'll delete this comment reply. - In any case, look at details in the docs for Map - note that it constructs/evaluates the expressions. – ciao Jun 21 '14 at 10:45
@seismatica: If my comment reply didn't get it for you, I'll give it another shot later if no one else replies - it's nearly 04:00 here, gotta hit the hay... – ciao Jun 21 '14 at 10:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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