Skip to content

Temperature arithmetic is wrong #218

Closed
@SirRufo

Description

@SirRufo

According to https://en.wikipedia.org/wiki/Celsius#Temperatures_and_intervals

What is often confusing about the Celsius measurement is that it follows an interval system but not a ratio system; that it follows a relative scale not an absolute scale. This is put simply by illustrating that while 10 °C and 20 °C have the same interval difference as 20 °C and 30 °C the temperature 20 °C is not twice the air heat energy as 10 °C. As this example shows, degrees Celsius is a useful interval measurement but does not possess the characteristics of ratio measures like weight or distance.

and further more at https://de.wikipedia.org/wiki/Grad_Celsius#Temperaturdifferenz (german)

delta t = 2°C - 1°C  is equivalent to delta T = 2K - 1K
delta t = 1K (= 1°C) is equivalent to delta T = 1K (not equal -272.15°C)

And that will fail here

var delta_t = 2.DegreesCelsius( ) - 1.DegreesCelsius( );
var delta_T = 2.Kelvins( ) - 1.Kelvins( );

System.Diagnostics.Debug.Assert( delta_t == delta_T );
System.Diagnostics.Debug.Assert( delta_t.Kelvins == delta_T.Kelvins );
System.Diagnostics.Debug.Assert( delta_t.DegreesCelsius == delta_T.DegreesCelsius );
System.Diagnostics.Debug.Assert( delta_t.Kelvins == 1 );
// next will fail because delta_t.DegreeCelsius is -272.15
System.Diagnostics.Debug.Assert( delta_t.DegreesCelsius == 1 );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions