[libchamplain/wrap] Use gdouble in x_to_wrap_x to avoid precision loss
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain/wrap] Use gdouble in x_to_wrap_x to avoid precision loss
- Date: Tue, 15 Apr 2014 22:52:49 +0000 (UTC)
commit d5dadc106904da6848a3d3aeb6d05adb4a43dea1
Author: Jiří Techet <techet gmail com>
Date: Wed Apr 16 00:51:49 2014 +0200
Use gdouble in x_to_wrap_x to avoid precision loss
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]