# Legacy Document

Important: The information in this document is obsolete and should not be used for new development.

Inside Macintosh: QuickDraw GX Environment and Utilities /
Chapter 8 - QuickDraw GX Mathematics / Using QuickDraw GX Mathematics

## Determining the Highest Order Bit of a wide Number

You can use the `WideScale` function to obtain the bit number of the highest order bit in the absolute value of a `wide` number. Listing 8-3 shows how to use the `WideScale` function in a function that multiplies two numbers in `long` format. If the product is too big to fit in a `long`, the function shifts the product so that it fits into a `long` and returns the bit shift. This operation can be termed pseudo-floating-point.

Listing 8-7 Using the `WideScale` function to create a pseudo-floating-point function

```long FloatMul(long a, long b, long *product)
{
wide temp;
long shift = WideScale(WideMultiply(a, b, &temp)) - 30;
if (shift > 0)
WideShift(&temp, shift);
else
shift = 0;
if (product) *product = temp.lo;
return shift;
}
```
The `WideScale` function is described on page 8-53.

© Apple Computer, Inc.
7 JUL 1996