Keil Logo

C166: Floating-point Support


Information in this article applies to:

  • C166 All Versions

QUESTION

We are changing software that currently uses integer math to use floating-point math. Does the Keil C166 Compiler support floating-point math and are there include files or libraries we need to declare in order for it to compile successfully with float variables?

ANSWER

The C166 compiler supports both single-precision (32-bit) and double-precision (64-bit) floating-point. To use either, all you have to do is start declaring and using floating-point variables just like in ANSI C.

By default, all float and double variables are stored in 32-bit IEEE format. This gives a precision of 7 decimal digits. When you require higher precision (than 7 digits) you may use the C166 FLOAT64 directive to enable 64-bit doubles. Enable this option in µVision under Project - Options for Target - C166 - Double-precision floating-point. If you enable FLOAT64, all double variables are stored in 64-bit IEEE format. This provides a precision of 15 decimal digits.

MORE INFORMATION


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.