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

[RFC] Move arithmetic functions into submodule FixedPointArithmetic #292

Closed
wants to merge 1 commit into from

Conversation

kimikage
Copy link
Collaborator

@kimikage kimikage commented Apr 29, 2024

This is in preparation for improved overflow handling. (closes #239)

We should probably discuss the module structure in OverflowContexts.jl.
xref: JuliaMath/OverflowContexts.jl#7


Even though these functions will be exposed differently in the future by the package extension mechanism, I believe that their implementation should be there statically.

There is a slight tradeoff between an ideal module structure and maintainability.
The proposed file structure follows the conventional file structure.
That is, the FixedPoint common implementations are in one arithmetic.jl, and the specializations specific to Fixed and Normed are in *_arithmetic.jl.

In terms of modularity, it might be better to have separate files for each strategy, such as Checked.
However, as noted above, I do not intend for them to be loaded/compiled independently.

Submodule names such as Wrapping are also debatable.
The current proposal comes from the following reasons:

  • CheckedArithmetic conflicts with the package name
  • FixedPointCheckedArithmetic, FixedPointChecked, and so on are redundant
    • They are never exported from FixedPointNumbers
  • They are the analogy with Base.Checked

The automatic formatter has removed the spaces in the type parameters, which I will try to restore later.

Copy link

codecov bot commented Apr 29, 2024

Codecov Report

Attention: Patch coverage is 99.01961% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 97.02%. Comparing base (3a4346c) to head (e967034).

Files Patch % Lines
src/arithmetic/fixed_arithmetic.jl 92.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #292      +/-   ##
==========================================
+ Coverage   96.93%   97.02%   +0.08%     
==========================================
  Files           7       10       +3     
  Lines         784      806      +22     
==========================================
+ Hits          760      782      +22     
  Misses         24       24              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move arithmetic definitions into a submodule FixedPointNumbers.FixedPointArithmetic
1 participant