Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c005dd

Browse files
committed
Merge pull request tinyobjloader#40 from MutterOberin/master
Changed pow function to use double overload
2 parents 59acd32 + 42d6bfb commit 2c005dd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tiny_obj_loader.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static bool tryParseDouble(const char *s, const char *s_end, double *result)
185185
while ((end_not_reached = (curr != s_end)) && isdigit(*curr))
186186
{
187187
// NOTE: Don't use powf here, it will absolutely murder precision.
188-
mantissa += static_cast<int>(*curr - 0x30) * pow(10, -read);
188+
mantissa += static_cast<int>(*curr - 0x30) * pow(10.0, -read);
189189
read++; curr++;
190190
}
191191
}
@@ -228,7 +228,7 @@ static bool tryParseDouble(const char *s, const char *s_end, double *result)
228228
}
229229

230230
assemble:
231-
*result = (sign == '+'? 1 : -1) * ldexp(mantissa * pow(5, exponent), exponent);
231+
*result = (sign == '+'? 1 : -1) * ldexp(mantissa * pow(5.0, exponent), exponent);
232232
return true;
233233
fail:
234234
return false;

0 commit comments

Comments
 (0)