James Gray
5/2/2007 12:44:00 AM
On May 1, 2007, at 7:22 PM, Ari Brown wrote:
> So today I tried to write a program which would print out, say,
> 1000 digits of pi.
ruby -rbigdecimal -rbigdecimal/math -e 'include BigMath; digits =
1000; puts "3."+BigDecimal.PI(digits).to_s[3,digits]'
> Ok, so to the point. How do I tell Ruby to print a value (.to_f) to
> a certain number of integers?
printf "%.20f", flt
> .to_f(1000)? And also, how do I write tan, cos, sin, etc. in Ruby?
Math.tan(num) # etc.
James Edward Gray II