Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/24/07 00:40
Read: times


 
#146107 - FP pitfalls
Responding to: ???'s previous message
Christoph Franck said:

All of these transfer functions are known, and should have a known gain and known precision requirements. I would guess that none of them need to make use of the full range a float provides, and therefore a long will make better use of the available bits than a float (provided that the designer is not too lazy to actually work out the numerics).


Orginaly, I was using fixed point, from the '51 counter (T0), clocking the carry's from T0 interrupts(overflow) and displaying the result directly to the display, thinking calibration pots> zero/span for the end user. But then, I realised and due to a couple of transfer functions, I could save some more money by using a software calibration technique. Up to date, I have the ADC value coming out of the CR stabiliser, but I have yet to write the software for calibration, but a couple of weeks ago, I worked out, on paper(very crudely) how I was going to do this in software. Basically, and without any calibration, the ADC must read approx. to within +-20%(at least) of correct value, if I can guarantee better then I will certainly try. Therefore, input voltage(FP) relationships excursions must be kept to a minimal from uncalibrated result, because what you say about floating point is essentially correct. FP has finite bit field, also 10^(-35)*10^(+35)=??
Since the uncalibrated result is going to be within +-20%(I hope) of input voltage, the gain of the calibration tranfer function is going to be somewhere between 1.2 and 0.8.

Christoph Franck said:

Not to mention all the numeric pitfalls that working with floats brings. Do you know the algorithm to "accurately" add more than two floating point numbers ?


Actually Christoph, I've never coded FP in assembler, but I do appreciate it's complexity and have pondered about how to do it. Basically, as I understand it, for adds one needs to shift the mantissa towards the right(lsb) whilst with each right mantissa shift decrement the exponent by one, once the exponents are equal of the two FP's, then an add of the mantissa's can take place. With multiplication, add exponents and multiply mantissa's. Then again, we have these wonderful compilers that take care of all the repetative but complex stuff.But with very large number excursions, I guess one is going to loose lsb's and therefore accuracy.

Christoph Franck said:

I've dealt with transfer functions that had a really nasty internal gain ('t was a 0.05 Hz first order IIR highpass @ 500 Hz sampling rate. Nasty, nasty, nasty, I tell you), and still did it with fixed point arithmethics.


Ha, yes indeed, I understand where you are comming from. In the last 20 years or so and with the advent of recent Texas Instruments calculators, decimal fractions are falling out of favour amongst maths teachers and rightly so, in particular, I was always taught(20 years ago) to leave sqrt(2) as sqrt(2) not 1.73....blah blah.

Keep well
Jason





List of 64 messages in thread
TopicAuthorDate
ADC last digit stability            01/01/70 00:00      
   DVM            01/01/70 00:00      
      DVM's only 10 bits?            01/01/70 00:00      
         Frequency response            01/01/70 00:00      
            Typically twice or more the sampling frequency            01/01/70 00:00      
               Missing the point            01/01/70 00:00      
   You usually don\'t _want_ a stable last digit.            01/01/70 00:00      
      Result            01/01/70 00:00      
         Hm.            01/01/70 00:00      
      Averaging/DSP/FIR filters            01/01/70 00:00      
         Math lecture ?            01/01/70 00:00      
            Can't use average-too slow            01/01/70 00:00      
               Analysis            01/01/70 00:00      
               already stated            01/01/70 00:00      
               Derivation            01/01/70 00:00      
                  The nitty gritty stuff            01/01/70 00:00      
                     Simulate using a spreadsheet            01/01/70 00:00      
                        Hi Russ and thanks for that            01/01/70 00:00      
                           My spreadsheet vs. your spreadsheet            01/01/70 00:00      
                              Unit test !            01/01/70 00:00      
                     As I said...            01/01/70 00:00      
                        Calibration?            01/01/70 00:00      
                           Horsefeathers            01/01/70 00:00      
                              Longs?            01/01/70 00:00      
                                 A long is more "accurate" than a float.            01/01/70 00:00      
                                    Yes it is, but....            01/01/70 00:00      
                                       _Known_ transfer functions.            01/01/70 00:00      
                                          FP pitfalls            01/01/70 00:00      
                                             The compiler isn't going to take care of that.            01/01/70 00:00      
                                                Mantissa fields            01/01/70 00:00      
                                                   Misunderstandings ?            01/01/70 00:00      
                                                      Adding FP's accurately            01/01/70 00:00      
                                 can you not read ?            01/01/70 00:00      
                           Nonsense ...            01/01/70 00:00      
                              Calculator?            01/01/70 00:00      
                     If you're really curious ...            01/01/70 00:00      
                        Climax time            01/01/70 00:00      
                           OOPS!!....            01/01/70 00:00      
                           Equations            01/01/70 00:00      
                              Quantisation            01/01/70 00:00      
                                 Works in unsigned integer, too:            01/01/70 00:00      
                                    Abstract?            01/01/70 00:00      
                                       Useful abstractions.            01/01/70 00:00      
                                          Nice talking with you, Christoph.            01/01/70 00:00      
                           What are the actual requirements ?            01/01/70 00:00      
                              re filters            01/01/70 00:00      
                              And moving forward            01/01/70 00:00      
               You can not due to Dither            01/01/70 00:00      
         Clueless ?            01/01/70 00:00      
            Just dump the LSB            01/01/70 00:00      
               Don't forget proper rounding.            01/01/70 00:00      
            Speaking of DSP            01/01/70 00:00      
         Fluke stability            01/01/70 00:00      
   Oh yes they do!            01/01/70 00:00      
   my take on this            01/01/70 00:00      
      Walk, don't run            01/01/70 00:00      
         :)            01/01/70 00:00      
      Hello Erik            01/01/70 00:00      
         have fun, Jason            01/01/70 00:00      
            I am having fun            01/01/70 00:00      
               Ok, you are aware of this            01/01/70 00:00      
                  He's learning            01/01/70 00:00      
                  Assumptions            01/01/70 00:00      
                     and I ...            01/01/70 00:00      

Back to Subject List