From 88cb2efacc9e3ae00fcfa88644b4b49ffc735a4d Mon Sep 17 00:00:00 2001 From: bitplane Date: Sat, 9 Jun 2007 14:32:18 +0000 Subject: [PATCH] fixed a fast_atof bug with negative exponents git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@702 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 2 ++ include/fast_atof.h | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/changes.txt b/changes.txt index b6045624..a44ed7ee 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,7 @@ Changes in version 1.3.1 (?? Mar 2007) + - Fixed a bug with negative exponents in fast_atof, posted by RVL + - renamed IAnimatedMeshSceneNode::getAbsoluteTransformation to getMD3TagTransformation to avoid conflicts with ISceneNode::getAbsoluteTransformation diff --git a/include/fast_atof.h b/include/fast_atof.h index 7a4f10e9..fadef58c 100644 --- a/include/fast_atof.h +++ b/include/fast_atof.h @@ -86,8 +86,14 @@ inline const char* fast_atof_move( const char* c, float& out) { ++c; //float exp = (float)strtol(c, &t, 10); + bool einv = (*c=='-'); + if (einv) + c++; + float exp = (float)strtol10(c, t); - + if (einv) + exp *= -1.0f; + f *= (float)pow(10.0f, exp); c = t; }