I would like to display floating numbers with the UTFT module. I think that the simple manipulation of these numbers is the same problem. I found two methods to display floating numbers :
For enabling floats in sprintf (and sscanf) you can install this in \hardware\tools\avr\avr\lib (make a backup of that lib folder, and then extract and replace files): Arduino Forum
Another option is to use dtostrf (I believe it's more efficient, and use much less memory than sprintf with FP enabled): avr-libc: <stdlib.h>: General utilities
int ent = floor(dd); // or double ent = floor(dd); --> the result is the same
double frac = dd - ent;
gives 0 as a result ?
Thank you for your help.
Pierre
Simple... 100/3 is 33. The floor() of 33 is 33. Subtract 33 from 33 and you get 0.
Now, if you were working with floating point numbers, then it would be different.
double dd = 100.0/3.0; // Note the subtle difference here - the .0 forces it to be floating point, not integer.
double ent = floor(dd);
double frac = dd - ent;