Metadata-Version: 1.1
Name: rr.approx
Version: 0.1.2
Summary: A simple module for approximate floating point arithmetic.
Home-page: https://github.com/2xR/rr.approx
Author: Rui Jorge Rei
Author-email: rui.jorge.rei@googlemail.com
License: MIT
Description: =========
        rr.approx
        =========
        
        Approximate floating point arithmetic library. This simple module can be used to compare numbers using a relative and absolute tolerance, to mitigate floating point rounding errors.
        
        .. code-block:: python
        
            from rr.approx import Approx
        
            x = Approx(0.1) * 3
            print x == 0.3  # True
        
        The ``Approx`` class is very simple to use as a replacement for "regular" floats -- you can use ``Approx`` objects instead of floats in most (if not all) contexts: arithmetic and comparisons.
        
        The ``ApproxContext`` class, also accessible as ``Approx.Context``, provides a context manager to temporarily modify the module's tolerance parameters.
        
        .. code-block:: python
        
            print Approx.Context()  # display current context
            Approx.Context(rtol=1e-4, atol=1e-2).apply()  # permanently modify tolerances
            print Approx.Context()
            with Approx.Context(rtol=1e-5, atol=1e-3):  # temporary modification
                print Approx.Context()
            print Approx.Context()
        
        Disclaimer
        ----------
        
        Please note that this module **does not solve** any problems with floating point numbers. What it does is provide a little (or big, depending on how you configure your tolerance parameters) buffer to compensate for rounding errors, but as these errors accumulate you can always get unexpected results.
        
        **Float rounding is inherently innaccurate** in all computers and programming languages due to representing a possibly recurring decimal in a finite number of digits. If you really care about exact results and don't mind paying a performance penalty, you should check out the `decimal <https://docs.python.org/2/library/decimal.html>`_ module from the standard library or some other alternative.
        
        Installation
        ------------
        
        From PyPI ("stable" release):
        
        .. code-block:: bash
        
            pip install rr.approx
        
        Or from the Git repo:
        
        .. code-block:: bash
        
            git clone https://github.com/2xR/rr.approx.git
            pip install ./rr.approx
        
        
        Contributing
        ------------
        
        Contributions are welcome through github pull requests (tests would sure be nice to have... :P).
        
        And if you're using the library and would like to say *"thanks!"* and/or keep me working on it, why not `buy me a beer <https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2UMJC8HSU8RFJ&lc=PT&item_name=DoubleR&item_number=github%2f2xR%2fpaypal&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted>`_?
        
        Happy approximate comparisons!
        
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
