Last active
July 16, 2017 09:40
-
-
Save flaviocopes/f5ad0e50aa0012dedc7b952c69f34530 to your computer and use it in GitHub Desktop.
Go: converting temperatures without type aliases (version with type aliases in https://gist.github.com/flaviocopes/2b1f45c510a0e90d703c0aeabe3b0492)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tempconv | |
const ( | |
AbsoluteZeroC float64 = -273.15 | |
FreezingC float64 = 0 | |
BoilingC float64 = 100 | |
) | |
func CToF(c float64) float64 { return float64(c*9/5 + 32) } | |
func FToC(f float64) float64 { return float64((f - 32) * 5 / 9) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment