add morphisms for angle, temperature & real numbers

This commit is contained in:
Michael Sippel 2025-03-18 14:06:05 +01:00
parent 6f85e004b9
commit 65cd0b6853
Signed by: senvas
GPG key ID: F96CF119C34B64A6
3 changed files with 211 additions and 0 deletions

View 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;
```