Skip to content

"300 degC" wrongly converted to "300 K" #926

Closed
@jkotan

Description

@jkotan

Summary

"300 degC" is wrongly converted to "300 K". Probably it is a bug in mathjs. I tested with (10.2.4).

Steps to Reproduce

to reproduce it one can store a scalar value with 'degC' unit or simpler in nodejs

 unit("300 degC").toSI().toJSON()


### Current Behaviour

```json
{ mathjs: 'Unit', value: 300, unit: 'K', fixPrefix: true }

Expected Behaviour

{ mathjs: 'Unit', value: 573.15, unit: 'K', fixPrefix: true }

Extra Details

Workaround for the problem could be to change the above line of the code in convertToSI to something like

 unit(inputValue, inputUnit).to(unit(inputUnit).toSI()).toJSON()

which gives the correct result

{ mathjs: 'Unit', value: 573.15, unit: 'K', fixPrefix: true }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions