ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Fixed Math Rounding


Q: When I call FixMul (3, 1 << 15) (3*0.5), the result is 2, but FixMul (-3, 1 << 15) yields a result of -1. Furthermore, on 68K Macs FixMul (-3, 1 << 15) yields a result of -2. What's going on?

A: This has to do with the rounding needed to make QuickDraw work correctly on PowerPC-based Macintoshes. The Fixed math routines round up, which in the case of negative numbers is towards zero, so -1.5 rounds to -1, and 1.5 rounds to 2.

This behavior is not going to change, and if this causes problems, you will either need to write your own Fixed math routines or wrap the Apple ones to account for the different rounding direction.

Updated: 17-May-1999


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.