Correct FixedPointParameter display precision
Correct FixedPointParameter display precision

BZ: 176178

Explain the precision computation (m * log10(2)):

  For a Qn.m number, the step between each storable number is 2^(-m).
  Hence, on a decimal representation, the Dth digit after the decimal
  point can take all possible values (1..9) - meaning that it is
  significant - only if

          2^(-m) <= 10^(-D)
              -m <= log2(10^(-D))
              -m <= log10(10^(-D)) / log10(2)
              -m <= -D / log10(2)
    m * log10(2) >= D

  Conversly, the Dth digit can be represented if

    D <= m * log10(2)

We add 1 to the precision in order to display the digit right after the last
significant digit.  This will lead to oddities such as:

    $ setParameter /Test/test/f32_Q8.23 0.1234569
    $ getParameter /Test/test/f32_Q8.23
    > 0.1234570

but it will avoid modifying raw values when converting from string to Q-format
and back to string.

Also, use std::setprecision() on the stream instead of manually truncating the
displayed number.

Change-Id: Ief2a7daabf4505ae4312e79036b0374f53368cac
Signed-off-by: David Wagner <60228a510f9a76940848fa2d29321fc4edfc2119@intel.com>

geekboxzone/mmallow_external_parameter-framework,sdnnfv/parameter-framework,mgaio/parameter-framework,dbrageul/parameter-framework,miguelgaio/parameter-framework,wzairix/parameter-framework,AdrienMQ/parameter-framework,pafonso/parameter-framework,tcahuzax/parameter-framework,pafonso/parameter-framework,01org/parameter-framework,zchokri/parameter-framework,miguelgaio/parameter-framework,Makohoek/parameter-framework,pafonso/parameter-framework,tcahuzax/parameter-framework,Makohoek/parameter-framework,Makohoek/parameter-framework,android-ia/hardware_intel_parameter-framework,dbrageul/parameter-framework,android-ia/hardware_intel_parameter-framework,anwarMov/parameter-framework,mgaio/parameter-framework,01org/parameter-framework,AdrienMQ/parameter-framework,geekboxzone/mmallow_external_parameter-framework,clero/parameter-framework,clero/parameter-framework,anwarMov/parameter-framework,tcahuzax/parameter-framework,krocard/parameter-framework,dawagner/parameter-framework,sdnnfv/parameter-framework,android-ia/hardware_intel_parameter-framework,krocard/parameter-framework,soaresm/parameter-framework,geekboxzone/mmallow_external_parameter-framework,zchokri/parameter-framework,soaresm/parameter-framework,01org/parameter-framework,dawagner/parameter-framework,dawagner/parameter-framework,sdnnfv/parameter-framework,krocard/parameter-framework,dbrageul/parameter-framework,zchokri/parameter-framework,miguelgaio/parameter-framework,anwarMov/parameter-framework,soaresm/parameter-framework,wzairix/parameter-framework,clero/parameter-framework,AdrienMQ/parameter-framework,mgaio/parameter-framework,wzairix/parameter-framework