11.07.2015 Views

Fixed and Arbitrary Precision Numerical Fields - Sage

Fixed and Arbitrary Precision Numerical Fields - Sage

Fixed and Arbitrary Precision Numerical Fields - Sage

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Sage</strong> Reference Manual: <strong>Fixed</strong> <strong>and</strong> <strong>Arbitrary</strong> <strong>Precision</strong> <strong>Numerical</strong> <strong>Fields</strong>, Release 6.21sage: RR(-infinity).fp_rank()-9671406552413433770278913 # 32-bit-41538374868278621023740371006390273 # 64-bitsage: RR(-infinity).fp_rank() - RR(-infinity).nextabove().fp_rank()-1fp_rank_delta(other)Return the floating-point rank delta between self <strong>and</strong> other. That is, if the return value is positive, thisis the number of times you have to call .nextabove() to get from self to other.EXAMPLES:sage: [x.fp_rank_delta(x.nextabove()) for x in... (RR(-infinity), -1.0, 0.0, 1.0, RR(pi), RR(infinity))][1, 1, 1, 1, 1, 0]In the 2-bit floating-point field, one subsegment of the floating-point numbers is: 1, 1.5, 2, 3, 4, 6, 8, 12,16, 24, 32sage: R2 = RealField(2)sage: R2(1).fp_rank_delta(R2(2))2sage: R2(2).fp_rank_delta(R2(1))-2sage: R2(1).fp_rank_delta(R2(1048576))40sage: R2(24).fp_rank_delta(R2(4))-5sage: R2(-4).fp_rank_delta(R2(-24))-5There are lots of floating-point numbers around 0:sage: R2(-1).fp_rank_delta(R2(1))4294967298 # 32-bit18446744073709551618 # 64-bitfrac()Return a real number such that self = self.trunc() + self.frac(). The return value willalso satisfy -1 < self.frac() < 1.EXAMPLES:sage: (2.99).frac()0.990000000000000sage: (2.50).frac()0.500000000000000sage: (-2.79).frac()-0.790000000000000sage: (-2.79).trunc() + (-2.79).frac()-2.79000000000000gamma()Return the value of the Euler gamma function on self.EXAMPLES:sage: R = RealField()sage: R(6).gamma()120.00000000000042 Chapter 2. <strong>Arbitrary</strong> <strong>Precision</strong> Real Numbers

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!