float: number after the point.


Is it possible like in C language to choice how much numbers after the point for a "float" value?


You get float (24 bit mantissa) and double (52 bit mantissa). Most Arduino's don't implement double,
so all are 24 bit mantissa.

Or perhaps you are trying to ask about converting a float value to a string?

Try print (2.34546, 2);

Thanks for the reply.

I would to do this with arduino.

printf("The value %2.1f is a float with 2 digits before the point and 1 digit after the point.\n", 26.400);

The goal is to display 26.4 and not 26.40.

Look up how to do it Serial.print() - Arduino Reference

Thanks MarkT and Whandall for the help. :slight_smile:


You can use sprintf, but you need to enable float support for it. To do that you can follow these instructions :stuck_out_tongue: