Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Exponenciation #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

longemen3000
Copy link

No description provided.

@barucden
Copy link
Collaborator

barucden commented Nov 1, 2024

Hello Andrés, are you still interested in finishing this PR after all this time? If you are, more work has to be done. Namely:

  1. Read the specification at https://speleotrove.com/decimal/daops.html#refpower
  2. Implement the operation according to the specification (e.g., 0^0 is illegal)
  3. Implement standard test cases and make sure they all pass

You'll need #75 for steps 2. and 3. In particular, you'll need fix(::Decimal) to take care of rounding, and you'll need scripts/dectest.jl to generate the standardized tests. I'll merge that PR in a few days.

I can provide assistance if needed.

@longemen3000
Copy link
Author

i will wait for #75 to be merged then. After that, i can take another jab at the implementation haha

@barucden
Copy link
Collaborator

barucden commented Nov 3, 2024

The PR has been merged.

You can get the standard test suite here: https://speleotrove.com/decimal/dectest.zip

Then, you need to add support for power tests in the scripts/dectest.jl script. That means to add a new branch to the print_operation function and implement print_power(io, x, y). You should be able to call

julia scripts/dectest.jl Power PATH_TO_DECTESTS/power.decTest test/dectests/test_power.jl
julia scripts/dectest.jl PowerSqrt PATH_TO_DECTESTS/powersqrt.decTest test/dectests/test_powersqrt.jl

This will create two test files, test/dectests/test_power.jl and test/dectests/test_powersqrt.jl, which you should include in test/runtests.jl.

After these steps, you'll have a pretty good test coverage for the power operation. Your implementation should successfully pass all the tests. When in doubt, you can check an implementation in Python.

Please, make sure to use comments to explain all tricky, non-trivial parts of your code, so that we can understand them in the future.

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