Skip to content

Commit

Permalink
Fix print of extra 0 when floats have only zeroes as decimals
Browse files Browse the repository at this point in the history
Fixes #25
  • Loading branch information
platisd committed Nov 24, 2023
1 parent cc069fe commit 561d57a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Nokia 5110 LCD library
version=2.7.0
version=2.7.1
author=Dimitris Platis
maintainer=Dimitris Platis <dimitris@plat.is>
sentence=Arduino library for driving the Nokia 5110 LCD
Expand Down
4 changes: 4 additions & 0 deletions src/Nokia_LCD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,10 @@ bool Nokia_LCD::print(double number, unsigned short decimals) {
}
}

if (fractional == 0) {
// If the fractional part is 0, then we have already printed it
return out_of_bounds;
}
// prints the rest of the fractional
return (out_of_bounds || print(fractional));
}
Expand Down

0 comments on commit 561d57a

Please sign in to comment.