aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dw-hdfsee.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c
index 0e199752..d300b9fe 100644
--- a/src/dw-hdfsee.c
+++ b/src/dw-hdfsee.c
@@ -1581,17 +1581,20 @@ static void numbers_update(DisplayWindow *dw)
val = dw->image->data[fs+ss*dw->image->width];
- if ( val > 0.0 ) {
- if ( log(val)/log(10.0) < 5 ) {
- snprintf(s, 31, "%.0f", val);
- } else {
- snprintf(s, 31, "HUGE");
- }
+ if ( (val > 0.0) && (log(val)/log(10.0) >= 5) ) {
+ snprintf(s, 31, "HUGE");
+ } else if ( (val < 0.0) && (log(-val)/log(10) >= 4) ) {
+ snprintf(s, 31, "-HUGE");
} else {
- if ( log(-val)/log(10) < 4 ) {
- snprintf(s, 31, "%.0f", val);
- } else {
- snprintf(s, 31, "-HUGE");
+ size_t l, i;
+ snprintf(s, 31, "%.4f", val);
+ l = strlen(s);
+ for ( i=l-1; i>0; i-- ) {
+ if ( s[i] == '0' ) s[i] = '\0';
+ if ( s[i] == '.' ) {
+ s[i] = '\0';
+ break;
+ }
}
}