kicad-developers team mailing list archive
Mailing list archive
Math function call note.
Wayne Stambaugh <stambaughw@...>
Fri, 26 Jun 2009 14:43:55 -0400
Thunderbird 184.108.40.206 (Windows/20090605)
Just a quick note when using math function calls (sqrt, tan, cos, etc),
please cast integer parameters to the correct type (float, double, or
long double) to prevent some compilers (VC++ for one but there may be
others) from generating an ambiguous function call errors. Apparently
GCC automatically casts them to doubles or determines what type they are
being used as and casts them to the appropriate type. I am actually
surprised that GCC doesn't complain about this as all of the math
functions defined in math.h in Linux and MinGW have a float, double, and
long double definition.