add morphisms for angle, temperature & real numbers
This commit is contained in:
parent
6f85e004b9
commit
65cd0b6853
3 changed files with 211 additions and 0 deletions
morphisms
34
morphisms/temperature.morphism-base
Normal file
34
morphisms/temperature.morphism-base
Normal file
|
@ -0,0 +1,34 @@
|
|||
```
|
||||
```
|
||||
|
||||
morph_celsius_to_kelvin ()
|
||||
Temperature ~ Celsius ~ ℝ ~ native.Float
|
||||
--> Temperature ~ Kelvin ~ ℝ ~ native.Float
|
||||
```
|
||||
*dst = *src + 273.15;
|
||||
return 0;
|
||||
```
|
||||
|
||||
morph_kelvin_to_celsius ()
|
||||
Temperature ~ Kelvin ~ ℝ ~ native.Float
|
||||
--> Temperature ~ Celsius ~ ℝ ~ native.Float
|
||||
```
|
||||
*dst = *src - 273.15;
|
||||
return 0;
|
||||
```
|
||||
|
||||
morph_celsius_to_fahrenheit ()
|
||||
Temperature ~ Celsius ~ ℝ ~ native.Float
|
||||
--> Temperature ~ Fahrenheit ~ ℝ ~ native.Float
|
||||
```
|
||||
*dst = (*src * 9.0 / 5.0) + 32.0;
|
||||
return 0;
|
||||
```
|
||||
|
||||
morph_fahrenheit_to_celsius ()
|
||||
Temperature ~ Fahrenheit ~ ℝ ~ native.Float
|
||||
--> Temperature ~ Celsius ~ ℝ ~ native.Float
|
||||
```
|
||||
*dst = (*src - 32.0) * 5.0 / 9.0;
|
||||
return 0;
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue