Boost logo

Boost :

Subject: Re: [boost] [boostcon][proto] Suggestion for LIAW session: fixed-pointnumbers
From: Ravi (lists_ravi_at_[hidden])
Date: 2011-03-17 01:28:48


On Wednesday 16 March 2011 19:24:31 Gruenke, Matt wrote:
> > In the system you proposed, what are the template parameters for the
> > fixed- point number with the following range?
> >
> > { 0, 1, ..., 15 } x 2^{-11}
>
> 11 fractional bits.
>
> > Or, the fixed-point number holding values in the following range?
> >
> > { 0, 1, ..., 15 } x 2^{11}
>
> 15 integer bits.

Suboptimal at best, and usually unacceptable because it leads to overflow of
the underlying type (int64, for example) much sooner than necessary in complex
expressions. The way it is usually avoided is to specify (in your notation)
the examples above as -7.11 and 15.-11, which, while consistent, is completely
unintuitive and unobvious.

Regards,
Ravi


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk