Keil Logo

_chkfloat_

Summary
#include <math.h>

unsigned char _chkfloat_ (
  float val);       /* number to check */
Description

The _chkfloat_ function checks the status of the floating-point number val.

Return Value

The _chkfloat_ function returns the status of the floating-point number val:

Return Value Meaning
0 Standard floating-point number.
1 Floating-point value 0.
2 +INF (positive overflow).
3 -INF (negative overflow).
4 NaN (Not a Number) error status.
See Also

_chkdouble_

Example
#include <intrins.h>
#include <stdio.h> /* for printf */

float f1, f2, f3;

void test_chkfloat (void) {
  f1 = f2 * f3;

  switch (_chkfloat_ (f1)) {
    case 0:
      printf ("result is a number\n"); break;
    case 1:
      printf ("result is zero\n"); break;
    case 2:
      printf ("result is +INF\n"); break;
    case 3:
      printf ("result is -INF\n"); break;
    case 4:
      printf ("result is NaN\n"); break;
  }
}
  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.