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!

https://github.com/bradley101/fraction

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
Last synced: 11 months ago · JSON representation

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
  • Host: GitHub
  • Owner: bradley101
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 97.7 KB
Statistics
  • Stars: 7
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 8
Created over 8 years ago · Last pushed almost 2 years ago
Metadata Files
Readme Contributing License Code of conduct

README.md

fraction Downloads

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/1

Create fraction objects from strings and decimals

print(Fraction('1.2')) 6/5 print(Fraction('1.22/6')) 61/300

Create 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/4995

Creates 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) False

Convert 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

Love programming!

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 62
  • Total Committers: 3
  • Avg Commits per committer: 20.667
  • Development Distribution Score (DDS): 0.242
Past Year
  • Commits: 2
  • Committers: 1
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email 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
bug (1) enhancement (1) good first issue (1) hactoberfest (1)
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

  • Versions: 10
  • Dependent Packages: 1
  • Dependent Repositories: 2
  • Downloads: 3,519 Last month
Rankings
Dependent packages count: 4.7%
Downloads: 5.3%
Dependent repos count: 11.6%
Average: 12.9%
Stargazers count: 20.3%
Forks count: 22.6%
Maintainers (1)
Last synced: 11 months ago
spack.io: py-fraction

Fraction carries out all the fraction operations including addition, subtraction, multiplicati on, division, reciprocation.

  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 29.7%
Average: 30.1%
Forks count: 32.2%
Dependent packages count: 58.6%
Maintainers (1)
Last synced: 11 months ago

Dependencies

.github/workflows/fraction.tests.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/pythonpublish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
setup.py pypi