Skip to content

Instantly share code, notes, and snippets.

@tadd
Created July 30, 2010 13:56
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 tadd/500540 to your computer and use it in GitHub Desktop.
Save tadd/500540 to your computer and use it in GitHub Desktop.
Decimal::Math functions test
require "decimal"
y = Decimal::Math.sqrt(2, 50)
puts "sqrt(2) = #{y}" #=> sqrt(2) = 1.41421356237309504880168872420969807856967187537694
include Decimal::Math # you can include the module, same as ::Math
y = log(10, 50)
puts "log(10) = #{y}" #=> log(10) = 2.30258509299404568401799145468436420760110148862848
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment