Browse code

kamcmd: double/float values printed without decimals when they are 0

- cope better with long (long) values stored in double fields

Daniel-Constantin Mierla authored on 12/01/2022 16:05:21
Showing 1 changed files
... ...
@@ -427,7 +427,11 @@ void print_binrpc_val(struct binrpc_val* v, int ident)
427 427
 			printf("%c", (v->u.end)?'}':'{');
428 428
 			break;
429 429
 		case BINRPC_T_DOUBLE:
430
-			printf("%f", v->u.fval);
430
+			if(v->u.fval == (double)((long long int)v->u.fval)) {
431
+				printf("%lld", (long long int)v->u.fval);
432
+			} else {
433
+				printf("%f", v->u.fval);
434
+			}
431 435
 			break;
432 436
 		default:
433 437
 			printf("ERROR: unknown type %d\n", v->type);