Skip to content

Add return on investment to math#2760

Closed
InukaWijerathna wants to merge 1 commit into
keon:masterfrom
InukaWijerathna:add/return-on-investment
Closed

Add return on investment to math#2760
InukaWijerathna wants to merge 1 commit into
keon:masterfrom
InukaWijerathna:add/return-on-investment

Conversation

@InukaWijerathna

Copy link
Copy Markdown

Description

Adds return_on_investment to the math module.

Return on Investment (ROI) is a straightforward but widely used financial formula — it tells you the percentage gain or loss on an investment relative to its cost:

ROI = (Gain - Cost) / Cost × 100

What's included

  • algorithms/math/return_on_investment.py — typed implementation with full docstring, doctests, and ValueError for non-positive cost
  • algorithms/math/__init__.py — export added

Checklist

  • Follows the code style of the project (docstring with Args/Returns/Raises/Examples)
  • Doctests for all cases including error paths
  • Export added to __init__.py

Reference: https://www.investopedia.com/terms/r/returnoninvestment.asp

@InukaWijerathna

Copy link
Copy Markdown
Author

Hi! Just checking in to see if there's any update on this PR — happy to make any changes needed to get it merged. Thanks for your time!

@keon

keon commented Jun 8, 2026

Copy link
Copy Markdown
Owner

@InukaWijerathna Thanks for the contribution! can you rebase on the current main branch? I think there's a lot of unrelated commits added to this PR

@InukaWijerathna InukaWijerathna force-pushed the add/return-on-investment branch from 9944e11 to 8b17348 Compare June 9, 2026 03:08
@InukaWijerathna

Copy link
Copy Markdown
Author

Done! I've rebased onto the current master branch — the PR now contains only the single commit adding the return on investment function to algorithms/maths/. (Also updated the path from math to maths to match the current repo structure.)

@keon

keon commented Jun 16, 2026

Copy link
Copy Markdown
Owner

it is such a simple code that I am not sure if it is worth packaging it as a library... sorry about that.

@keon keon closed this Jun 16, 2026
@InukaWijerathna InukaWijerathna deleted the add/return-on-investment branch June 17, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants