MathGroup Archive 2011

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

Search the Archive

Min-MaxPrecision?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115718] Min-MaxPrecision?
  • From: Marco Masi <marco.masi at ymail.com>
  • Date: Wed, 19 Jan 2011 05:25:57 -0500 (EST)

I would like to run a program that makes always quad precison calculations in all variables. I thought Mathematica would do that internally by setting $MinPrecision = $MaxPrecision = nrd, with nrd the number of digits. However, if I try

$MinPrecision = $MaxPrecision = 32;
var = 1 - 0.0000000000000000000000000000001;
N[var, 32]

I get 1. Whereas I expected 0.9999999999999999999999999999999

Block seems to do the job. In fact

Block[{$MinPrecision = 32, $MaxPrecision = 32},
 1 - 0.00000000000000000000000000000001`32]

gives 0.99999999999999999999999999999999.

But that's not very useful in my case because I would like to run a long program and can't apply it on all variables. Ideally I need something like

Block[{$MinPrecision = 32, $MaxPrecision = 32},
....... var in long program with zillions of calculations.....]

And after execution know what exactly var is to 32 digits precision and Exporting it to file with that precision. If I type var, or N[var,32] it will output only with the default 15 digits. Export will consequently do the same.

Can anyone help?

Marco.


  • Prev by Date: Re: SetOptions does not work with Grid
  • Next by Date: Mathematica 8 browser plugin and Firefox 3/4
  • Previous by thread: Re: minimax polynomial determination
  • Next by thread: Re: Min-MaxPrecision?