Real Numbers with Decimals need to be Rounded

Real Numbers with Decimals need to be Rounded

Written by Craig Wells
Last update: Tuesday, Nov 27, 2018

Sometimes you may get a number with a decimal return unexpectedly. One method of preventing real numbers with long decimals returning from sensors such as the Cozir which uses the LetsTalkScience custom control, is by using the Math Round function.

Simply insert the Math Round function from the Math menu, between your command and the value; E.g. Show Number + Math Round + Temperature

See the following video illustration of fixing a Cozir Level 1 activity by editing it with this method. The video illustrates using the Blocks and editing the JavaScript directly. Its fairly easy to do.  https://youtu.be/CkNCDCBX600 

The trickiest part will be dragging the Temp or CO2 method into the value circle of the Round function block. This is illustrated in the video.  

 

General

Advice and answers from the LTS_Help Team.

25 articles in this category.
Written by Craig Wells.