freetype
[Top][All Lists]

## Re: [ft] what's the mean of CEIL( x )?

 From: David Turner Subject: Re: [ft] what's the mean of CEIL( x )? Date: Fri, 19 May 2006 09:29:48 +0200 User-agent: Thunderbird 1.5 (Windows/20051201)

```luoyi a écrit :
```
```sorry, maybe I misunderstand what is "fixed-point 26.6 number".....
can you explain it ?

```
it means that the value of X can be seen as a 26-bit integer, followed by a 6-bit
```fractional part. As in the following graphics:

+----------------------------------+-----------+
|     integer mantissa             | fraction  |
+----------------------------------+-----------+
26 bits                    6 bits
```
```In other words:

float_value(x) =    (x >> 6) + (x & 63)/64.0

round(x) = (x+32) & ~63
floor(x)   = x & ~63
ceil(x)     = (x+63) & ~63
int(x)       = (x >> 6)

the macro CEIL(x) as defined really returns int(ceil(x))

note that int(x) is (x >> 6) and *not*   x/64.0 !!

Hope this helps,

- David Turner
- The FreeType Project  (www.freetype.org)

```
```
```
```"David Turner" <address@hidden> ??????:address@hidden
```
```  x=240 corresponds to value 3.75 CEIL(240) => 4
```
```
240 / 26.6 =  9.022

_______________________________________________
Freetype mailing list
http://lists.nongnu.org/mailman/listinfo/freetype

```
```

***********************************************************************************
Information contained in this email message is confidential and may be
privileged, and is intended only for use of the individual or entity named
above. If the reader of this message is not the intended recipient, or the
employee or agent responsible to deliver it to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited. If you have received this communication
in error, please immediately notify the address@hidden and destroy the original
message.
```
***********************************************************************************
```

```

reply via email to