Code

slight numerical improvement
authorpjrm <pjrm@users.sourceforge.net>
Thu, 5 Jun 2008 06:30:03 +0000 (06:30 +0000)
committerpjrm <pjrm@users.sourceforge.net>
Thu, 5 Jun 2008 06:30:03 +0000 (06:30 +0000)
src/svg/svg-path-test.h
src/svg/svg-path.cpp

index ec9536f0ff0e41e877f09678cdc6a8d3c0385b23..5247ace83741266d7c1ecd5939db7d39bff633d3 100644 (file)
@@ -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");\r
         path_str = sp_svg_write_path(bpath);\r
         new_bpath = sp_svg_read_path(path_str);\r
-        TS_ASSERT(bpathEqual(bpath, new_bpath, 1e-16));\r
+        TS_ASSERT(bpathEqual(bpath, new_bpath, 1e-17));\r
         g_free(bpath); g_free(path_str); g_free(new_bpath);\r
     }\r
 \r
index 61f45d46048ac33077a920c85da46860de8c745d..bd0d4a4f5ff1dbb7c7af872f8ff6779a4ec20dba 100644 (file)
@@ -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;
 }