Re: scaling coefficients for c



In article <AI2dnYu9o4tKFo_YnZ2dnUVZ_r2dnZ2d@xxxxxxxxxxxx>,
sonos <sonos@xxxxxxxxxx> wrote:
[scaling coefficients]

and the same fraction in hex
0.961F9F01C

but how do I set a c variable in binary form for fractions?

unsigned long scaling = 0x961F9F01;


Note: The final 'C' of your fraction doesn't fit into a typical 32 bit
integral number. You will need to decide whether to truncate
(as shown here), or to round (final 1 becomes a 2), or to see if your
compiler supports variables longer than 32 bits and use a longer
fraction.
--
Okay, buzzwords only. Two syllables, tops. -- Laurie Anderson
.



Relevant Pages

  • Re: scaling coefficients for c
    ... I understand the requirement of scaling coefficients for fixed point ... microcontrollers. ... do I code a fraction in binary form for use in c code or asm language? ...
    (comp.lang.c)
  • Re: scaling coefficients for c
    ... I understand the requirement of scaling coefficients for fixed point ... microcontrollers. ... do I code a fraction in binary form for use in c code or asm language? ...
    (comp.lang.c)
  • scaling coefficients for c
    ... I understand the requirement of scaling coefficients for fixed point ... microcontrollers. ... do I code a fraction in binary form for use in c code or asm language? ...
    (comp.dsp)
  • scaling coefficients for c
    ... I understand the requirement of scaling coefficients for fixed point ... microcontrollers. ... do I code a fraction in binary form for use in c code or asm language? ...
    (comp.lang.c)