{ "info": { "author": "Rui Jorge Rei", "author_email": "rui.jorge.rei@googlemail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7" ], "description": "=========\r\nrr.approx\r\n=========\r\n\r\nApproximate 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.\r\n\r\n.. code-block:: python\r\n\r\n from rr.approx import Approx\r\n\r\n x = Approx(0.1) * 3\r\n print x == 0.3 # True\r\n\r\nThe ``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.\r\n\r\nThe ``ApproxContext`` class, also accessible as ``Approx.Context``, provides a context manager to temporarily modify the module's tolerance parameters.\r\n\r\n.. code-block:: python\r\n\r\n print Approx.Context() # display current context\r\n Approx.Context(rtol=1e-4, atol=1e-2).apply() # permanently modify tolerances\r\n print Approx.Context()\r\n with Approx.Context(rtol=1e-5, atol=1e-3): # temporary modification\r\n print Approx.Context()\r\n print Approx.Context()\r\n\r\nDisclaimer\r\n----------\r\n\r\nPlease 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.\r\n\r\n**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 `_ module from the standard library or some other alternative.\r\n\r\nInstallation\r\n------------\r\n\r\n>From PyPI (\"stable\" release):\r\n\r\n.. code-block:: bash\r\n\r\n pip install rr.approx\r\n\r\nOr from the Git repo:\r\n\r\n.. code-block:: bash\r\n\r\n git clone https://github.com/2xR/rr.approx.git\r\n pip install ./rr.approx\r\n\r\n\r\nContributing\r\n------------\r\n\r\nContributions are welcome through github pull requests (tests would sure be nice to have... :P).\r\n\r\nAnd 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 `_?\r\n\r\nHappy approximate comparisons!", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/2xR/rr.approx", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "rr.approx", "package_url": "https://pypi.org/project/rr.approx/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rr.approx/", "project_urls": { "Homepage": "https://github.com/2xR/rr.approx" }, "release_url": "https://pypi.org/project/rr.approx/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "A simple module for approximate floating point arithmetic.", "version": "0.1.2" }, "last_serial": 2186092, "releases": { "0.1.0": [], "0.1.1": [ { "comment_text": "", "digests": { "md5": "0a586c2e52a07175c569334974b671b9", "sha256": "4050076e7233ca275c88b893ec01e13513123b79f415141580a1ae9d6a1892fc" }, "downloads": -1, "filename": "rr.approx-0.1.1-py2-none-any.whl", "has_sig": false, "md5_digest": "0a586c2e52a07175c569334974b671b9", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6916, "upload_time": "2016-06-21T23:39:44", "url": "https://files.pythonhosted.org/packages/54/ce/cdeef67994000f9edde49a05ca7f0b5ab472272c21fe87d48f59780b2b20/rr.approx-0.1.1-py2-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "3918971201548a09b57069aefe7319a4", "sha256": "84defdd40298e11f19cbdd66279b2bddb65856190b8bbc8cc11836c70a0e278c" }, "downloads": -1, "filename": "rr.approx-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "3918971201548a09b57069aefe7319a4", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 8334, "upload_time": "2016-06-24T22:17:48", "url": "https://files.pythonhosted.org/packages/53/85/dbb69117372ac076351a92472e562a83d557f1b69bd553185d19f33ab54a/rr.approx-0.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e21d2276c5cbd8c2693fcd1de0f3543e", "sha256": "7286e8c9dce4b82515ec819862a32b82219f3785be5a6672c695f8c0820d4ef2" }, "downloads": -1, "filename": "rr.approx-0.1.2.zip", "has_sig": false, "md5_digest": "e21d2276c5cbd8c2693fcd1de0f3543e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9893, "upload_time": "2016-06-24T22:18:20", "url": "https://files.pythonhosted.org/packages/2c/79/f923a3e799098cb7274f843e2cc541b8f3a28da122001840c4929e4fce80/rr.approx-0.1.2.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3918971201548a09b57069aefe7319a4", "sha256": "84defdd40298e11f19cbdd66279b2bddb65856190b8bbc8cc11836c70a0e278c" }, "downloads": -1, "filename": "rr.approx-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "3918971201548a09b57069aefe7319a4", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 8334, "upload_time": "2016-06-24T22:17:48", "url": "https://files.pythonhosted.org/packages/53/85/dbb69117372ac076351a92472e562a83d557f1b69bd553185d19f33ab54a/rr.approx-0.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e21d2276c5cbd8c2693fcd1de0f3543e", "sha256": "7286e8c9dce4b82515ec819862a32b82219f3785be5a6672c695f8c0820d4ef2" }, "downloads": -1, "filename": "rr.approx-0.1.2.zip", "has_sig": false, "md5_digest": "e21d2276c5cbd8c2693fcd1de0f3543e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9893, "upload_time": "2016-06-24T22:18:20", "url": "https://files.pythonhosted.org/packages/2c/79/f923a3e799098cb7274f843e2cc541b8f3a28da122001840c4929e4fce80/rr.approx-0.1.2.zip" } ] }