MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Rounding?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60885] Re: [mg60881] Rounding?
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sun, 2 Oct 2005 01:54:37 -0400 (EDT)
  • References: <200510010655.CAA13187@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 1 Oct 2005, at 15:55, Tom De Vries wrote:

> Hello everyone,
>
> Sorry if this is an obvious question.  I'm wondering why the two  
> results
> below are different?
>
> I'm creating programs to generate test questions, and I need to  
> know that my
> computer generated answers will match the student answers, to say,  
> three
> decimal places.  So the answer is -0.0625  "exactly", the first  
> result makes
> sense to me, the second doesn't.
>
> If there is a reason for this, is there are way to insure I can  
> make the
> first result look like the second result all the time??
>
>
> SetAccuracy[-0.0625,4]
>
> -0.063
>
> ToString[SetAccuracy[-0.0625,4]]
>
> -0.062
>
>
> Thanks for your input!
>
>
> Tom De Vries
>
>


This is because ToString by default uses the OutputForm of your  
expression:


OutputForm[SetAccuracy[-0.0625,4]]

-0.062

Compare this with:


ToString[SetAccuracy[-0.0625,4],TraditionalForm]


-0.063

and


ToString[SetAccuracy[-0.0625,4],InputForm]


-0.0625`2.7958800173440745


Andrzej Kozlowski


  • References:
    • Rounding?
      • From: Tom De Vries <tom_toad@telus.net>
  • Prev by Date: Re: Minimizing an integer value function
  • Next by Date: Re: Finding length in recursive definition?
  • Previous by thread: Rounding?
  • Next by thread: Re: Rounding?