File procps-ng-4.0.0-floats.dif of Package procps

---
 local/strutils.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

--- local/strutils.c
+++ local/strutils.c	2021-02-09 10:11:25.000000000 +0000
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
+#include <float.h>
+#include <math.h>
 #include <stdlib.h>
 #include <stdbool.h>
 #include <assert.h>
@@ -76,9 +78,9 @@ double strtod_or_err(const char *str, co
  */
 double strtod_nol_or_err(const char *str, const char *errmesg)
 {
-	double num;
+	long double num;
 	const char *cp, *radix;
-	double mult;
+	long double mult;
 	int negative = 0;
 
 	if (str != NULL && *str != '\0') {
@@ -100,31 +102,31 @@ double strtod_nol_or_err(const char *str
 		mult=0.1;
 		while(isdigit(*radix)) {
 			radix++;
-			mult *= 10;
+			mult *= 10.0;
 		}
 		while(isdigit(*cp)) {
-			num += (*cp - '0') * mult;
-			mult /= 10;
+			num += (long double)(*cp - '0') * mult;
+			mult /= 10.0;
 			cp++;
 		}
 		/* got the integers */
 		if (*cp == '\0')
-			return (negative?-num:num);
+			return (double)(negative?-num:num);
 		if (*cp != '.' && *cp != ',')
 			error(EXIT_FAILURE, EINVAL, "%s: '%s'", errmesg, str);
 
 		cp++;
 		mult = 0.1;
 		while(isdigit(*cp)) {
-			num += (*cp - '0') * mult;
-			mult /= 10;
+			num += (long double)(*cp - '0') * mult;
+			mult /= 10.0;
 			cp++;
 		}
 		if (*cp == '\0')
-			return (negative?-num:num);
+			return (double)(negative?-num:num);
 	}
 	error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str);
-	return 0;
+	return (double)0;
 }
 
 // column width of a multi-byte string
openSUSE Build Service is sponsored by