Ok, good math libraries in math.h
Also, saving your shapes in floats, doubles, or long doubles will allow you to perform more precise operations.
Floats offer 7 significant digits, and in doubles - 16 significant digits.
a source
In addition, when printing, people usually use _snprintf or printf, and you can format these doubles that float to the precision you need:
Float accuracy
printf ("Value% 8.2f", floatVariable);
This says that you need a total field of 8 characters, within 8 characters, the last 2 will contain the decimal part.
_snprintf (buffer, sizeof (buffer), "Value% .2f", floatVariable);
The example above asks for the minimum field width and the last two characters must be held to the decimal part.
Ryan christensen
source share