Simplify the Fahrenheit from Celsius computation. (#2497)
As the micro:bit introduces floating point arithmetic for both the existing `f = 18 * c / 10 + 32` computation and the new `f = 1.8 * c + 32` computation, there isn't any benefit for the former.
This commit is contained in:
committed by
Peli de Halleux
parent
47f37c177f
commit
697ef7dd68
@ -38,12 +38,12 @@ basic.forever(() => {
|
|||||||
This program measures the temperature using Fahrenheit degrees.
|
This program measures the temperature using Fahrenheit degrees.
|
||||||
Fahrenheit is a way of measuring temperature that is commonly used in the United States.
|
Fahrenheit is a way of measuring temperature that is commonly used in the United States.
|
||||||
To make a Celsius temperature into a Fahrenheit one, multiply the Celsius temperature by
|
To make a Celsius temperature into a Fahrenheit one, multiply the Celsius temperature by
|
||||||
``18``, divide by ``10`` and add ``32``.
|
``1.8`` and add ``32``.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
let c = input.temperature()
|
let c = input.temperature()
|
||||||
let f = (c * 18) / 10 + 32
|
let f = (1.8 * c) + 32
|
||||||
basic.showNumber(f)
|
basic.showNumber(f)
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user