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.2sage: str(RR(RDF(1)/RDF(0))) == str(RDF(1)/RDF(0))Truesage: str(RR(-RDF(1)/RDF(0))) == str(-RDF(1)/RDF(0))Truesage: str(RR(RDF(0)/RDF(0))) == str(RDF(0)/RDF(0))Truetan()Return the tangent of self.EXAMPLES:sage: q = RDF.pi()/3sage: q.tan()1.73205080757sage: q = RDF.pi()/6sage: q.tan()0.57735026919tanh()Return the hyperbolic tangent of self.EXAMPLES:sage: q = RDF.pi()/12sage: q.tanh()0.255977789246trunc()Truncates this number (returns integer part).EXAMPLES:sage: RDF(2.99).trunc()2sage: RDF(-2.00).trunc()-2sage: RDF(0.00).trunc()0ulp()Returns the unit of least precision of self, which is the weight of the least significant bit of self. Thisis always a strictly positive number. It is also the gap between this number <strong>and</strong> the closest number withlarger absolute value that can be represented.EXAMPLES:sage: a = RDF(pi)sage: a.ulp()4.4408920985e-16sage: b = a + a.ulp()Adding or subtracting an ulp always gives a different number:sage: a + a.ulp() == aFalsesage: a - a.ulp() == aFalsesage: b + b.ulp() == bFalse16 Chapter 1. Double <strong>Precision</strong> Real Numbers

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

Saved successfully!

Ooh no, something went wrong!