[gcalctool] Don't show bitfield on fractions



commit 1f88d7f3db503da27f1a4eedb2f12808dbe1c78d
Author: Robert Ancell <robert ancell gmail com>
Date:   Mon Apr 19 09:37:24 2010 +1000

    Don't show bitfield on fractions

 src/math-buttons.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/math-buttons.c b/src/math-buttons.c
index 0422136..2b30e07 100644
--- a/src/math-buttons.c
+++ b/src/math-buttons.c
@@ -495,10 +495,11 @@ display_changed_cb(MathEquation *equation, GParamSpec *spec, MathButtons *button
         guint64 bits;
 
         if (enabled) {
-            MPNumber max;
+            MPNumber max, fraction;
 
             mp_set_from_unsigned_integer(G_MAXUINT64, &max);
-            if (mp_is_negative(&x) || mp_is_greater_than(&x, &max))
+            mp_fractional_component(&x, &fraction);
+            if (mp_is_negative(&x) || mp_is_greater_than(&x, &max) || !mp_is_zero(&fraction))
                 enabled = FALSE;
             else
                 bits = mp_cast_to_unsigned_int(&x);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]