[Top][All Lists]

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

Re: [dmidecode] Memory voltage values

From: Anton Arapov
Subject: Re: [dmidecode] Memory voltage values
Date: Wed, 24 Apr 2013 08:18:54 -0400 (EDT)

I do agree with the change, seems three digits of precision is indeed 
unnecessary, will apply it. 


-------- Original message --------
From: Jean Delvare <address@hidden> 
To: address@hidden 
Cc: Anton Arapov <address@hidden> 
Subject: [dmidecode] Memory voltage values 
Since SMBIOS 2.8.0, dmidecode can display memory voltage values. Values
are stored in mV and the code currently uses %.3f to print the value in
volts. This means that the standard DDR3 voltage would be displayed as
"1.500 V". 3 decimal places seem a bit overkill in most situations. I
think "1.5 V" would look better and be closer to what the reader would
expect. So I'd rather use %g so that the trailing 0s are omitted. The
only problematic corner case would be multiples of 1000, which would be
printed as "1 V", "2 V" etc. which is a bit rough and unexpected. So I
would force one decimal for these.

This can be easily achieved with the following code change:

--- dmidecode.orig/dmidecode.c  2013-04-23 16:41:14.844319737 +0200
+++ dmidecode/dmidecode.c       2013-04-23 21:50:04.320649702 +0200
@@ -2236,7 +2236,7 @@ static void dmi_memory_voltage_value(u16
if (code == 0)
printf(" Unknown");
-        printf(" %.3f V", (float)code / 1000);
+        printf(code % 100 ? " %g V" : " %.1f V", (float)code / 1000);

static const char *dmi_memory_device_form_factor(u8 code)

Anton, what do you think?

Jean Delvare


reply via email to

[Prev in Thread] Current Thread [Next in Thread]