diff options
author | Jiří Techet <techet@gmail.com> | 2014-04-16 00:51:49 +0200 |
---|---|---|
committer | Jiří Techet <techet@gmail.com> | 2014-04-16 00:51:49 +0200 |
commit | d5dadc106904da6848a3d3aeb6d05adb4a43dea1 (patch) | |
tree | 86ee4029fab3905db92eed672714e2899ec04b57 | |
parent | 1b42a1075fd753dce3a7109129e10c55e0cecb37 (diff) | |
download | libchamplain-wrap.tar.gz |
Use gdouble in x_to_wrap_x to avoid precision losswrap
-rw-r--r-- | champlain/champlain-view.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index aa79622..05c3449 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -266,13 +266,13 @@ static ChamplainBoundingBox *get_bounding_box (ChamplainView *view, gdouble y); -static gint -x_to_wrap_x (gint x, gint width) +static gdouble +x_to_wrap_x (gdouble x, gdouble width) { if (x < 0) - x += (-x / width + 1) * width; + x += ((gint)-x / (gint)width + 1) * width; - return x % width; + return fmod (x, width); } |