Skip to content

Instantly share code, notes, and snippets.

@crgimenes
Created September 15, 2020 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crgimenes/5f6b68bcfe0a7305fad41277c4711e62 to your computer and use it in GitHub Desktop.
Save crgimenes/5f6b68bcfe0a7305fad41277c4711e62 to your computer and use it in GitHub Desktop.
Simple function example
package exemple
func MapIntervalFloat64(value, fromLow, fromHigh, toLow, toHigh float64) (ret float64) {
ret = (value-fromLow)*(toHigh-toLow)/(fromHigh-fromLow) + toLow
return
}
func SimpleMapIntervalFloat64(value, fromHigh, toHigh float64) (ret float64) {
ret = value * toHigh / fromHigh
return
}
func Factorial(value uint) uint {
if value == 0 {
return 1
}
return value * Factorial(value-1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment