From: pjrm Date: Thu, 5 Jun 2008 06:30:03 +0000 (+0000) Subject: slight numerical improvement X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d384610a5ef08e8814a5482076c28dfa0fa0bddd;p=inkscape.git slight numerical improvement --- diff --git a/src/svg/svg-path-test.h b/src/svg/svg-path-test.h index ec9536f0f..5247ace83 100644 --- a/src/svg/svg-path-test.h +++ b/src/svg/svg-path-test.h @@ -431,7 +431,7 @@ public: bpath = sp_svg_read_path("M .01,.02 L 0.04,0.02 L.04,.08L0.01,0.08 z""M 1e-2,.2e-1 L 0.004e1,0.0002e+2 L04E-2,.08e0L1.0e-2,80e-3 z"); path_str = sp_svg_write_path(bpath); new_bpath = sp_svg_read_path(path_str); - TS_ASSERT(bpathEqual(bpath, new_bpath, 1e-16)); + TS_ASSERT(bpathEqual(bpath, new_bpath, 1e-17)); g_free(bpath); g_free(path_str); g_free(new_bpath); } diff --git a/src/svg/svg-path.cpp b/src/svg/svg-path.cpp index 61f45d460..bd0d4a4f5 100644 --- a/src/svg/svg-path.cpp +++ b/src/svg/svg-path.cpp @@ -471,7 +471,10 @@ static char const* rsvg_parse_unsigned_float(double *val, char const *begin) { exp += (int)exponent; } } - *val = (double)intval * pow(10., exp); + + *val = ( exp < 0 + ? intval / pow(10, -exp) + : intval * pow(10, exp) ); return end_of_num; }