DecimalCalcul


NameDecimalCalcul JSON
Version 2.4 PyPI version JSON
download
home_pagehttps://github.com/bouquet-cedric/module-python
SummaryFournit une classe dédiée aux calculs sur des nombres décimaux
upload_time2024-07-16 20:40:39
maintainerNone
docs_urlNone
authorBouquet Cédric
requires_python>=3.0
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Decimal

This class is used to compute real result from decimal calcul.
By example, if we wan't to calcule 0.1 + 0.2, we'd like to have 0.3,
but really, we obtain 0.30000000000004.
So, this class allow to be precize computing with pows of 10 and treating only integers.
Then, the result for 0.1 + 0.2 is 0.3.

# Tests

To verify results, tests are presents. For that, it's possible to launch pytest to check calcul.

# Operations

## Plus

- Decimal.plus(0.1, 0.2) => 0.3
- Decimal.plus(0.1, 0.02) => 0.12
- Decimal.plus(0.200, 0.02) => 0.22
- Decimal.plus(1, 2) => 3
- Decimal.plus(1, 0.2) => 1.2
- Decimal.plus(0.000005, 1) => 1.000005

## Minus

- TestDecimal.Operation(5, 3) => 2
- TestDecimal.Operation(3, 4) => -1
- TestDecimal.Operation(3.5, 4) => -0.5
- TestDecimal.Operation(3.5, 0.05) => 3.45
- TestDecimal.Operation(1, 3) => -2
- TestDecimal.Operation(0.1, 0.3) => -0.2
- TestDecimal.Operation(0.1, 0.2) => -0.1
- TestDecimal.Operation(0.3, 0.2) => 0.1
- TestDecimal.Operation(0.8, 9) => -8.2

## Times

- Decimal.times(2, 1.5) => 3
- Decimal.times(3, 4) => 12
- Decimal.times(3.5, 4) => 14
- Decimal.times(3.5, 0.05) => 0.175

## Divide

- Decimal.divide(6, 1.5) => 4
- Decimal.divide(3, 4) => 0.75
- Decimal.divide(3.5, 4) => 0.875
- Decimal.divide(3.5, 0.05) => 70
- Decimal.divide(1, 3) => 0.3333333333333333
- Decimal.divide(0.1, 0.3) => 0.3333333333333333
- Decimal.divide(0.1, 0.2) => 0.5
- Decimal.divide(0.8, 9) => 0.08888888888888889

## Modulo

- Decimal.modulo(6, 1.5) => 0
- Decimal.modulo(3, 2) => 1
- Decimal.modulo(9.5, 2) => 1.5

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bouquet-cedric/module-python",
    "name": "DecimalCalcul",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.0",
    "maintainer_email": null,
    "keywords": null,
    "author": "Bouquet C\u00e9dric",
    "author_email": "cedric-bouquet-7@outlook.fr",
    "download_url": "https://files.pythonhosted.org/packages/76/3f/019a43104042e89921db00d661bb43c31b1df51ade22d4c726291dd67c3a/decimalcalcul-2.4.tar.gz",
    "platform": null,
    "description": "# Decimal\r\n\r\nThis class is used to compute real result from decimal calcul.\r\nBy example, if we wan't to calcule 0.1 + 0.2, we'd like to have 0.3,\r\nbut really, we obtain 0.30000000000004.\r\nSo, this class allow to be precize computing with pows of 10 and treating only integers.\r\nThen, the result for 0.1 + 0.2 is 0.3.\r\n\r\n# Tests\r\n\r\nTo verify results, tests are presents. For that, it's possible to launch pytest to check calcul.\r\n\r\n# Operations\r\n\r\n## Plus\r\n\r\n- Decimal.plus(0.1, 0.2) => 0.3\r\n- Decimal.plus(0.1, 0.02) => 0.12\r\n- Decimal.plus(0.200, 0.02) => 0.22\r\n- Decimal.plus(1, 2) => 3\r\n- Decimal.plus(1, 0.2) => 1.2\r\n- Decimal.plus(0.000005, 1) => 1.000005\r\n\r\n## Minus\r\n\r\n- TestDecimal.Operation(5, 3) => 2\r\n- TestDecimal.Operation(3, 4) => -1\r\n- TestDecimal.Operation(3.5, 4) => -0.5\r\n- TestDecimal.Operation(3.5, 0.05) => 3.45\r\n- TestDecimal.Operation(1, 3) => -2\r\n- TestDecimal.Operation(0.1, 0.3) => -0.2\r\n- TestDecimal.Operation(0.1, 0.2) => -0.1\r\n- TestDecimal.Operation(0.3, 0.2) => 0.1\r\n- TestDecimal.Operation(0.8, 9) => -8.2\r\n\r\n## Times\r\n\r\n- Decimal.times(2, 1.5) => 3\r\n- Decimal.times(3, 4) => 12\r\n- Decimal.times(3.5, 4) => 14\r\n- Decimal.times(3.5, 0.05) => 0.175\r\n\r\n## Divide\r\n\r\n- Decimal.divide(6, 1.5) => 4\r\n- Decimal.divide(3, 4) => 0.75\r\n- Decimal.divide(3.5, 4) => 0.875\r\n- Decimal.divide(3.5, 0.05) => 70\r\n- Decimal.divide(1, 3) => 0.3333333333333333\r\n- Decimal.divide(0.1, 0.3) => 0.3333333333333333\r\n- Decimal.divide(0.1, 0.2) => 0.5\r\n- Decimal.divide(0.8, 9) => 0.08888888888888889\r\n\r\n## Modulo\r\n\r\n- Decimal.modulo(6, 1.5) => 0\r\n- Decimal.modulo(3, 2) => 1\r\n- Decimal.modulo(9.5, 2) => 1.5\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Fournit une classe d\u00e9di\u00e9e aux calculs sur des nombres d\u00e9cimaux",
    "version": "2.4",
    "project_urls": {
        "Homepage": "https://github.com/bouquet-cedric/module-python"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1eb2acdc6d33f6f482c6c3892f26459b9eaf952aa4ea73eea2a66f9ee26be4dd",
                "md5": "04ce31be76ab47369cc5212dd057047c",
                "sha256": "49b8a84aeff85134c158d7a8b805deb8e65b5e9cadbc91e9f4a82ee71612dbb6"
            },
            "downloads": -1,
            "filename": "DecimalCalcul-2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "04ce31be76ab47369cc5212dd057047c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.0",
            "size": 3866,
            "upload_time": "2024-07-16T20:40:37",
            "upload_time_iso_8601": "2024-07-16T20:40:37.053742Z",
            "url": "https://files.pythonhosted.org/packages/1e/b2/acdc6d33f6f482c6c3892f26459b9eaf952aa4ea73eea2a66f9ee26be4dd/DecimalCalcul-2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "763f019a43104042e89921db00d661bb43c31b1df51ade22d4c726291dd67c3a",
                "md5": "bc291040e9b306c519b46a0888b86808",
                "sha256": "1660e80a2529fcf8ee4876902e7176da132b7012e0d08e04142359e549202f5d"
            },
            "downloads": -1,
            "filename": "decimalcalcul-2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "bc291040e9b306c519b46a0888b86808",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.0",
            "size": 3370,
            "upload_time": "2024-07-16T20:40:39",
            "upload_time_iso_8601": "2024-07-16T20:40:39.256821Z",
            "url": "https://files.pythonhosted.org/packages/76/3f/019a43104042e89921db00d661bb43c31b1df51ade22d4c726291dd67c3a/decimalcalcul-2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-16 20:40:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bouquet-cedric",
    "github_project": "module-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "decimalcalcul"
}
        
Elapsed time: 0.26716s