-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fix the division by 0, improve comments.
- Avoid doing the division if the result would be outside the ]0,1<<24[ range: -- if the numerator is nonpositive, ie <=0, truncate the result to 0, -- if the numerator is greater or equal than the denominator, the result will be outside the allowed range, hence truncate the result to 1<<24. -- otherwise, the result will be inside the range. Knowing that the denominator is greater than the numerator, if the numerator has the last 24 bits non zero, the denominator can't be less than 1<<24, hence the denominator won't be truncated to 0. - Add comment details to help who doesn't know math. Big deal!
- Loading branch information
Edoardo Prezioso
committed
Nov 25, 2014
1 parent
4b2af70
commit cc4e66f
Showing
1 changed file
with
44 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters