[CELT-dev] What does f mean in CELT's source code?

Monty Montgomery monty at xiph.org
Thu Feb 24 04:12:37 PST 2011


On Thu, Feb 24, 2011 at 6:23 AM, Osama Fadhil <osamaesl at yahoo.com> wrote:
> Hi,
>
> I have noticed in the source code of CELT the numbers like 2.f ,  102.f  ,
> 0.1f  ,  etc...
>
> What does the " f "  mean in this case?

CELT is written in C, and the 'f' marks the constant as a
single-precision float type (as opposed to some other potential
default float type like double precision).  I suspect in most places
it's being used, the 'f' is redundant and it's being used for semantic
clarity.

> Is the number 102.f   equal to the number 102

It is a single precision float equal to the integer value 102.

> or the number 0.1f   equal to the number  0.1?!

Possibly not.  The double precision representation of .1 is not equal
to the single precision representation of .1, as .1 can't be
represented exactly in binary.  Context and the C spec will answer
specific examples of this question.

Monty



More information about the celt-dev mailing list