How to get absolute value for float : Absolute Value « Math « C / ANSI-C






How to get absolute value for float

#include <math.h>
#include <stdio.h>

int main(void)
{
  printf("%1.1f %1.1f", fabs(1.0), fabs(-1.0));

  return 0;
}

           
       








Related examples in the same category

1.Get absolute value of long integer parameter: how to use labs
2.Return absolute value of floating-point: fabs Return absolute value of floating-point: fabs
3.Return absolute value of integer parameter: how to use abs