Methods

Class Index [+]

Quicksearch

Flt::BinNum::Trigonometry

Public Instance Methods

pi(round_digits=nil) click to toggle source
     # File lib/flt/trigonometry.rb, line 766
766:       def pi(round_digits=nil)
767:         round_digits ||= self.precision
768:         nhexd = (round_digits+3)/4 + 1
769:         v = pi_hex_digits(nhexd)
770:         l = v.size
771:         v = v.to_i(16)
772:         e = (1-l)*4
773:         # add trailing 01 for rounding (there always be some non null digit beyond the rounding point)
774:         v <<= 2
775:         v |= 1
776:         e -= 2
777:         num_class.context(self, :precision=>round_digits){+num_class.Num(1,v,e)}
778:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.