Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9ecc150

Browse files
committed
This is a bug fix which prevents parseFloat from proceeding past
multiple decimals '.' in the stream. Only one can be accepted for valid decimal numbers.
1 parent 2e12a79 commit 9ecc150

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎hardware/arduino/avr/cores/arduino/Stream.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ float Stream::parseFloat(char skipChar){
185185
read(); // consume the character we got with peek
186186
c = timedPeek();
187187
}
188-
while( (c >= '0' && c <= '9') || c == '.' || c == skipChar );
188+
while( (c >= '0' && c <= '9') || c == '.' && !isFraction || c == skipChar );
189189

190190
if(isNegative)
191191
value = -value;

‎hardware/arduino/sam/cores/arduino/Stream.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ float Stream::parseFloat(char skipChar){
185185
read(); // consume the character we got with peek
186186
c = timedPeek();
187187
}
188-
while( (c >= '0' && c <= '9') || c == '.' || c == skipChar );
188+
while( (c >= '0' && c <= '9') || c == '.' && !isFraction || c == skipChar );
189189

190190
if(isNegative)
191191
value = -value;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /