aboutsummaryrefslogtreecommitdiff
path: root/src/displaywindow.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-04-28 17:08:11 +0200
committerThomas White <taw@physics.org>2010-04-28 17:08:11 +0200
commitfb978a5cef9deb84f108bc71117e5b06f4323189 (patch)
tree1098a76714959924c7a2f2c6082003eb9f62c6c6 /src/displaywindow.c
parentecf729efabef7ed49dbe4b6d613923e438812e88 (diff)
hdfsee: Properly handle negatives in numbers box
Diffstat (limited to 'src/displaywindow.c')
-rw-r--r--src/displaywindow.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c
index d6f47ac5..020be60c 100644
--- a/src/displaywindow.c
+++ b/src/displaywindow.c
@@ -733,10 +733,18 @@ static void numbers_update(DisplayWindow *dw)
}
if ( (x>0) && (y>0) && valid ) {
- if ( log(val)/log(10) < 5 ) {
- snprintf(s, 31, "%.0f", val);
+ if ( val > 0 ) {
+ if ( log(val)/log(10) < 5 ) {
+ snprintf(s, 31, "%.0f", val);
+ } else {
+ snprintf(s, 31, "HUGE");
+ }
} else {
- snprintf(s, 31, "HUGE");
+ if ( log(-val)/log(10) < 4 ) {
+ snprintf(s, 31, "%.0f", val);
+ } else {
+ snprintf(s, 31, "-HUGE");
+ }
}
} else {
strcpy(s, "--");