cos – Talk

From Bohemia Interactive Community
Revision as of 17:52, 8 August 2006 by Suma (talk | contribs) (Not a bug.)
Jump to navigation Jump to search

Buggy Cosinus

Your signature with timestamp

This command is buggy in OFP, I hope that this will be fixed in Armed Assault.

sin 0 => 0
sin 90 => 1
cos 0 => 1
cos 90 => -4.37114e-008 !!

This leads to some problems when working with this value.

This is not a bug, but a result of floating point rounding errors. Expecting any floating point calculations results to be exactly equal is bad, and leads to errors. Most often this is cared for by comparing for abs(x-y)<epsilon instead of checking x==y. --Suma 17:52, 8 August 2006 (CEST)