how to make negative numbers into positive

前端 未结 8 1785
天命终不由人
天命终不由人 2021-02-01 14:09

I am having the negative floating point number as:

a = -0.340515;

to convert this into positive number I used the abs() method as:



        
8条回答
  •  死守一世寂寞
    2021-02-01 14:45

    Use float fabsf (float n) for float values.

    Use double fabs (double n) for double values.

    Use long double fabsl(long double) for long double values.

    Use abs(int) for int values.

提交回复
热议问题