Skip to content

Instantly share code, notes, and snippets.

@vagmi
Created January 25, 2010 09:21
Show Gist options
  • Save vagmi/285744 to your computer and use it in GitHub Desktop.
Save vagmi/285744 to your computer and use it in GitHub Desktop.
#log a to the base b
def log_base(a, b)
return (Math.log(a)/Math.log(b))
end
log_base(10,10) # 1.0
log_base(100,10) # 2.0
log_base(20,10) # 1.30102999566398
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment