Skip to main content

Timeline for Setting float to two decimal places

Current License: CC BY-SA 4.0

3 events
when toggle format what by license comment
Apr 16, 2021 at 19:02 comment added chrisl As Majenko wrote you can use the int datatype. But it is unclear to me, why you really need to reduce to 2 decimal places in your database. If you are doing further calculations with that data the extra digits will not hurt. Or are you then just displaying that data form the database? Then the best way would be to round in that displaying program. Or you could send the data to firebase as a string. Then you can do the same rounding as with Serial.print() while constructing the string. Though I don't see the use in that.
Apr 16, 2021 at 18:56 comment added Nina Thanks for your reply. The problem is that I need to use the number for further calculations and also to push it to Firebase Realtime Database. Therefore, is there a similar solution without serial print?
Apr 16, 2021 at 18:49 history answered chrisl CC BY-SA 4.0