File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 24
24
25
25
#include " Common.h"
26
26
#include " Stream.h"
27
- #include < math.h>
28
27
29
28
#define PARSE_TIMEOUT 1000 // default number of milli-seconds to wait
30
29
@@ -165,7 +164,7 @@ float Stream::parseFloat(LookaheadMode lookahead, char ignore)
165
164
bool isFraction = false ;
166
165
double value = 0.0 ;
167
166
int c;
168
- unsigned int digits_post_comma = 0 ;
167
+ double fraction = 1. 0 ;
169
168
170
169
c = peekNextDigit (lookahead, true );
171
170
// ignore non numeric leading characters
@@ -182,7 +181,7 @@ float Stream::parseFloat(LookaheadMode lookahead, char ignore)
182
181
else if (c >= ' 0' && c <= ' 9' ) { // is c a digit?
183
182
value = value * 10 + c - ' 0' ;
184
183
if (isFraction)
185
- digits_post_comma++ ;
184
+ fraction *= 0.1 ;
186
185
}
187
186
read (); // consume the character we got with peek
188
187
c = timedPeek ();
@@ -193,7 +192,7 @@ float Stream::parseFloat(LookaheadMode lookahead, char ignore)
193
192
value = -value;
194
193
195
194
if (isFraction)
196
- value /= pow ( 10 , digits_post_comma) ;
195
+ value *= fraction ;
197
196
198
197
return value;
199
198
}
You can’t perform that action at this time.
0 commit comments