<p><b>@kaspar030</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/10695#discussion_r258057045">drivers/lpsxxx/lpsxxx.c</a>:</p>
<pre style='color:#555'>> +
+    if (i2c_read_reg(DEV_I2C, DEV_ADDR, LPSXXX_REG_TEMP_OUT_H, &tmp, 0) < 0) {
+        i2c_release(DEV_I2C);
+        DEBUG("[lpsxxx] read_temp: cannot read TEMP_OUT_H register\n");
+        return -LPSXXX_ERR_I2C;
+    }
+    i2c_release(DEV_I2C);
+    val |= ((uint16_t)tmp << 8);
+
+    DEBUG("[lpsxxx] read_temp: raw data %08" PRIx32 "\n", (uint32_t)val);
+
+    /* compute actual temperature value in °C */
+    res += ((float)val) / TEMP_DIVIDER;
+
+    /* return temperature in c°C */
+    *temp = (int16_t)(res * 100);
</pre>
<p>I think you can get rid of the float conversion & division:</p>
<pre><code>(TEMP_BASE + (val / TEMP_DIVIDER)) * 100 == (TEMP_BASE * 100) + (val * 100 / TEMP_DIVIDER)
</code></pre>
<p>So this should be equivalent:</p>
<pre><code>#define TEMP_BASE=4250U;
#define TEMP_DIVIDER=480U;

uint32_t res = TEMP_BASE;
uint32_t val = 0;
// ...
res += (val * 100) / TEMP_DIVIDER;
*temp = (int16_t)res;
</code></pre>
<p>(maybe use signed int).</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/10695#pullrequestreview-205234463">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AEn7YGk1YJicuHhOMqAV78Ch02eB-c-_ks5vPAeMgaJpZM4Znw5u">mute the thread</a>.<img src="https://github.com/notifications/beacon/AEn7YM887pbP8VEm_ub1zqQEGxHUHOEHks5vPAeMgaJpZM4Znw5u.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/RIOT-OS/RIOT","title":"RIOT-OS/RIOT","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/RIOT-OS/RIOT"}},"updates":{"snippets":[{"icon":"PERSON","message":"@kaspar030 commented on #10695"}],"action":{"name":"View Pull Request","url":"https://github.com/RIOT-OS/RIOT/pull/10695#pullrequestreview-205234463"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/10695#pullrequestreview-205234463",
"url": "https://github.com/RIOT-OS/RIOT/pull/10695#pullrequestreview-205234463",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>