floating point - How to get the opposite side of round()/floor() in C? -


i have double a=1234.5678, can 1234 floor(a), how 0.5678? know can subtract a-floor(a), there function in runtime library?

modf break double value in 2 parts

double param, fractpart, intpart;  param = 3.14159265; fractpart = modf (param , &intpart); printf ("%f = %f + %f \n", param, intpart, fractpart); return 0; 

output: 3.141593 = 3.000000 + 0.141593

you have include math.h

http://www.cplusplus.com/reference/cmath/modf/


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

php - Boolean search on database with 5 million rows, very slow -

css - Text drops down with smaller window -