I am just starting with swift. This is what I have in my playground...
let tempF1 = Measurement(value: 98.6, unit: UnitTemperature.fahrenheit)
let tempC1 = tempF1.converted(to: UnitTemperature.celsius)
let convertedTemperature1 = MeasurementFormatter().string(from: tempC1)
Output:
98.6 °F
37.0000000000025 °C.
"98.6°F"
let tempC2 = Measurement(value: 37, unit: UnitTemperature.celsius)
let tempF2 = tempC2.converted(to: UnitTemperature.fahrenheit)
let convertedTemperature2 = MeasurementFormatter().string(from: tempF2)
Output:
37.0 °C
98.59999999999546 °F
"98.6°F"
As you can above, formatting Fahrenheit works but Celsius does not...
Any clue what I am doing wrong here??
thanks