atan2: specify why we cannot use more than 15 bits for the atan argument

This commit is contained in:
Matt Huszagh 2020-12-17 10:02:35 -08:00
parent 1f28949bc5
commit 56641d5838
1 changed files with 3 additions and 1 deletions

View File

@ -57,7 +57,9 @@ pub fn atan2(y: i32, x: i32) -> i32 {
// We need to share the 31 available non-sign bits between the
// atan argument and constant factors used in the atan
// approximation. Sharing the bits roughly equally between them
// gives good accuracy.
// gives good accuracy. Additionally, we cannot increase the
// number of atan argument bits beyond 15 because we must square
// it.
const ATAN_ARGUMENT_BITS: usize = 15;
let ratio = (min << ATAN_ARGUMENT_BITS) / max;