From cf82d605ad7d74be15ddf88e070e70616f53e5b6 Mon Sep 17 00:00:00 2001 From: Danny Auble <da@llnl.gov> Date: Wed, 11 Nov 2009 17:16:18 +0000 Subject: [PATCH] better documentation on what is going on with convert_num_unit --- src/common/slurm_protocol_api.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c index 5b36ff08809..341e4957233 100644 --- a/src/common/slurm_protocol_api.c +++ b/src/common/slurm_protocol_api.c @@ -3519,7 +3519,11 @@ extern void convert_num_unit(float num, char *buf, int buf_size, int orig_type) if(orig_type < UNIT_NONE || orig_type > UNIT_PETA) orig_type = UNIT_UNKNOWN; i = (int)num; - if(i == num) + /* Here we are checking to see if these numbers are the same, + meaning the float has not floating point. If we do have + floating point print as a float. + */ + if((float)i == num) snprintf(buf, buf_size, "%d%c", i, unit[orig_type]); else snprintf(buf, buf_size, "%.2f%c", num, unit[orig_type]); -- GitLab