From a5448f5ca7c4a0cc0f492de0157ac0c6826322e3 Mon Sep 17 00:00:00 2001 From: "Constantine A. Murenin" Date: Sun, 16 Mar 2008 23:54:02 +0000 Subject: s/273.16/273.15/g, then refactor the formulae to ensure that the double to int64_t conversions happen sooner rather than later discussed with / ok by kettenis --- usr.sbin/sensorsd/sensorsd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/sensorsd/sensorsd.c b/usr.sbin/sensorsd/sensorsd.c index d45e07237d0..1cd8a772532 100644 --- a/usr.sbin/sensorsd/sensorsd.c +++ b/usr.sbin/sensorsd/sensorsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensorsd.c,v 1.40 2008/03/16 03:07:03 cnst Exp $ */ +/* $OpenBSD: sensorsd.c,v 1.41 2008/03/16 23:54:01 cnst Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -642,11 +642,11 @@ get_val(char *buf, int upper, enum sensor_type type) switch(*p) { case 'C': printf("C"); - rval = (val + 273.16) * 1000 * 1000; + rval = val * 1000 * 1000 + 273150000; break; case 'F': printf("F"); - rval = ((val - 32.0) / 9 * 5 + 273.16) * 1000 * 1000; + rval = (val * 1000 * 1000 + 459670000) / 9 * 5; break; default: errx(1, "unknown unit %s for temp sensor", p); -- cgit v1.2.3