# How to tell Mathematica to treat all numbers (including those in decimal form) as arbitrary precision numbers

I have code that is essentially numerical. It uses functions like NDSolve and NIntegrate. But in most interesting cases, the numerics are quite delicate and requires increasing the WorkingPrecision and PrecisionGoal.

Most of the numbers appearing in the equations in NIntegrate and NDSolve are given in decimal form: like eps = 0.0001 and xMax = 20.5. Mathematica treats these as MachinePrecision numbers. This causes error messages by NDSolve and NIntegrate when WorkingPrecision is increased:

"The precision of the equations/integrand is less than the working precision"

So if I want these numerical functions to accommodate any value for WorkingPrecision, it seems I have to express these numbers like eps = 1/10000 and xMax = 205/10 or eps=0.0001100000000000 and xMax = 20.510000000000. These options make for unreadable code.

For the sake of readable code, how do I tell Mathematica that all numbers are to be treated as arbitrary precision numbers?

• – user9660 Mar 9 '16 at 9:16

An example:

f = 2.45 x^2 - 0.76 x - 12/5;
NSolve[f, x, WorkingPrecision -> 30]


NSolve::precw: "The precision of the argument function ({-(12/5)-0.76\ x+2.45\ x^2}) is less than WorkingPrecision (30). "

NSolve[Rationalize[f, 0], x, WorkingPrecision -> 30]
(* {{x -> -0.846720538186604156791220026903},
{x -> 1.15692461981925721801570982282}}*)


or

NSolve[SetPrecision[f, 30], x, WorkingPrecision -> 30]
(* {{x -> -0.84672053818660412931604119279},
{x ->  1.15692461981925717167460037451}} *)