fraction
Fraction helps to easily provide a data model while using fractional values and numbers in Python. It can easily handle all the calculations involved while doing arithmetic and logical operations so that you dont have to worry about less important stuffs!
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (6.8%) to scientific vocabulary
Repository
Fraction helps to easily provide a data model while using fractional values and numbers in Python. It can easily handle all the calculations involved while doing arithmetic and logical operations so that you dont have to worry about less important stuffs!
Basic Info
Statistics
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
- Releases: 8
Metadata Files
README.md
fraction 
fraction is a Python module that is designed for fractional values numerator/denominator
Installation
Easy to install
$ python -m pip install Fraction
Usage
Import
```
from fraction import Fraction ```
Initialization
Creates a fraction equal to 0/1
f1 = Fraction()Creates a fraction equal to (1/2) / (1/4)
print(Fraction('1/2', '1/4')) 2/1Create fraction objects from strings and decimals
print(Fraction('1.2')) 6/5 print(Fraction('1.22/6')) 61/300Create fraction objects from recurring decimals
f = Fraction.fromdecimal(1.3, rec='3') print(f) 4/3 f = Fraction.fromdecimal(24.5067, rec='067') print(f) 122411/4995Creates a fraction equal to 3/10
``` a = Fraction('3/10') b = Fraction('1/2')
Get numerator/denominator
a.numerator, a.denominator (3, 10) ```
Arithmetic Operations
Computes reciprocal of fraction as Fraction object
recip_a = Fraction.reciprocal(a) recip_a.numerator, recip_a.denominator (10, 3)Perform addition of Fraction objects (returns a Fraction object)
sum_ab = a + b sum_ab.numerator, sum_ab.denominator (4, 5)Perform subtraction of Fraction objects (returns a Fraction object)
diff_ab = a - b diff_ab.numerator, diff_ab.denominator (-1, 5)Perform multiplication of Fraction objects (returns a Fraction object)
mul_ab = a * b mul_ab.numerator, mul_ab.denominator (3, 20)Perform div of Fraction objects (returns a Fraction object)
div_ab = a / b div_ab.numerator, div_ab.denominator (3, 5)Comparison/Relational operations
Supports comparison operations <, <=, >, >=, ==, !=
a < b True a == Fraction(7, 10) FalseConvert fraction into a float string
a = Fraction('1/3') a.todecimal(decplaces=5) '0.33333'For debugging
Supports str() and repr() built in objects methods
a = Fraction() print a 0/1 a Fraction: 0/1
Owner
- Name: Shantanu Banerjee
- Login: bradley101
- Kind: user
- Location: Pune, IN
- Company: @veritas
- Website: https://shantanubanerjee.com
- Repositories: 5
- Profile: https://github.com/bradley101
Love programming!
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: almost 3 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Shantanu Banerjee | s****t@g****m | 47 |
| Shantanu Banerjee | S****e@v****m | 9 |
| Jack Grahl | j****l@g****m | 6 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 5
- Total pull requests: 7
- Average time to close issues: 20 days
- Average time to close pull requests: 13 days
- Total issue authors: 4
- Total pull request authors: 3
- Average comments per issue: 3.6
- Average comments per pull request: 1.14
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- jwg4 (2)
- weightwatchers-carlanderson (1)
- Tommimon (1)
- Crystalline-Entity (1)
Pull Request Authors
- bradley101 (3)
- CopperyMarrow15 (2)
- jwg4 (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- pypi 3,519 last-month
-
Total dependent packages: 2
(may contain duplicates) -
Total dependent repositories: 2
(may contain duplicates) - Total versions: 11
- Total maintainers: 2
pypi.org: fraction
Fraction carries out all the fraction operations including addition, subtraction, multiplication, division, reciprocation
- Homepage: https://github.com/bradley101/fraction
- Documentation: https://fraction.readthedocs.io/
- License: MIT License
-
Latest release: 2.2.0
published about 4 years ago
Rankings
Maintainers (1)
spack.io: py-fraction
Fraction carries out all the fraction operations including addition, subtraction, multiplicati on, division, reciprocation.
- Homepage: https://github.com/bradley101/fraction
- License: []
-
Latest release: 2.2.0
published almost 3 years ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite