# precision and accuracy – SetPrecision with Manipulate using variable number of controls

I want to convert inputs from controls in Manipulate into exact numbers and have two kinds of inputs:

• parameters: there are a fixed number of these
• rates: the number of rates is controlled by the parameter n

To do this, I package the parameters into a list of rules and use SetPrecision to translate the inputs to exact numbers. But that approach doesn’t see to work for rates.

You can see that I tried twice to set the precision of the rates:

1. With `(rate(mode)=SetPrecision(#,Infinity))&`
2. With `SetPrecision(rate /@ Range(n),Infinity)`

The figure shows that the rates — the top line — are not exact numbers. The parameter p is an exact number. How to get the rates to be exact?

`````````
With({maxModes = 5},
Manipulate(
Manipulate(
Evaluate(
With({rates = Thread(Rule(Range(n), SetPrecision(rate /@ Range(n),Infinity))),
params = {p ->SetPrecision(pval, Infinity)}},
Column({rates,params}))),
Evaluate(
Sequence @@ (With({mode = #},{{rate(mode), mode, Row({"Rate ", mode})},-10, 10,
Row({Manipulator(##)," ", InputField(Dynamic(rate(mode),(rate(mode)=SetPrecision(#,Infinity))&),Appearance->"Frameless",BaseStyle->"Label")})&}) & /@ Range(n)))),

{{n, 3, "Number of Modes"}, Range(maxModes), Control->SetterBar},
{{pval, 1, "Parameter"}, -1, 1, Appearance->"Labeled"}))
``````
``````(!(Precision of Rates vs Parameters)(1))(1)

(1): https://i.stack.imgur.com/eN6Gn.png

``````