Skip to content

Instantly share code, notes, and snippets.

@assyrianic
Last active September 9, 2024 21:43
Show Gist options
  • Save assyrianic/7b5f5e434d798783532c2fb96746bae6 to your computer and use it in GitHub Desktop.
Save assyrianic/7b5f5e434d798783532c2fb96746bae6 to your computer and use it in GitHub Desktop.
calculates epsilon for any device
func epsilon() float64 {
eps := 1.0
for eps+1 > 1 {
eps /= 2
}
eps *= 2
return eps
}
def epsil():
eps = 1.0
while eps+1 > 1:
eps /= 2
eps *= 2
return eps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment