# [fpc-devel] StdConvs: conversion to/from Kelvin is wrong?

Bart bartjunk64 at gmail.com
Sun May 29 22:41:45 CEST 2022

```Fpc 3.3.1

===
D := ConvUtils.Convert(100.0, tuCelsius, tuKelvin);
write('100.0 Celsius       --> ',D:12:4,' Kelvin --> ');
D := ConvUtils.Convert(D, tuKelvin, tuCelsius);
writeln(D:12:4, ' Celsius');

D := ConvUtils.Convert(100.0, tuFahrenheit, tuKelvin);
write('100.0 Fahrenheit    --> ',D:12:4,' Kelvin --> ');
D := ConvUtils.Convert(D, tuKelvin, tuFahrenheit);
writeln(D:12:4, ' Fahrenheit');

D := ConvUtils.Convert(100.0, tuRankine, tuKelvin);
write('100.0 Rankine       --> ',D:12:4,' Kelvin --> ');
D := ConvUtils.Convert(D, tuKelvin, tuRankine);
writeln(D:12:4, ' Rankine');

D := ConvUtils.Convert(100.0, tuReamur, tuKelvin);
write('100.0 Reamur        --> ',D:12:4,' Kelvin --> ');
D := ConvUtils.Convert(D, tuKelvin, tuReamur);
writeln(D:12:4, ' Reamur');
===

Outputs:
100.0 Celsius       -->     100.0000 Kelvin -->     100.0000 Celsius
100.0 Fahrenheit    -->      55.5556 Kelvin -->     100.0000 Fahrenheit
100.0 Rankine       -->      55.5556 Kelvin -->     100.0000 Rankine
100.0 Reamur        -->     125.0000 Kelvin -->     100.0000 Reamur

I think the correct output should be
100.0 Celcius       -->      373.1500 Kelvin -->     100.0000 Celcius
100.0 Fahrenheit    -->      310.9278 Kelvin -->     100.0000 Fahrenheit
100.0 Rankine       -->       55.5556 Kelvin -->     100.0000 Rankine
100.0 Reamur        -->      398.1500 Kelvin -->     100.0000 Reamur

See https://en.wikipedia.org/wiki/Conversion_of_units#Temperature
There is adding/subtracting involved in the calculations, not jus a
single conversion factor.
--
Bart
```