Skip to content

Problems with "special" unit conversion #79

@stevegeek

Description

@stevegeek

Special Unit handling

Example:

1 Cel/100 to Cel

puts Unitwise::Measurement.new(1, "Cel/100").convert_to("Cel").inspect
# #<Unitwise::Measurement value=-270.4085 unit=Cel>

This should be 1 Cel/100 is 0.01 Cel , as is correctly handled with non-special atoms

puts Unitwise::Measurement.new(1, "s/100").convert_to("s").inspect
#<Unitwise::Measurement value=1/100 unit=s>

The implementation applies the 'non linear/special' conversion from a Celcius value to a Kelvin one when it handles the Cel term of the Measurement expression, ie 1 x Cel/100 is converted to (1 + 273.15)K/100 which is incorrect. ie 0.01 Cel is not equal to 2.7415K .

(edit, second section was incorrect, I had the notation wrong 🤦 )

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions