Skip to content

Remove stub implementations for signed() and unsigned() - #356

Closed
kimikage wants to merge 1 commit into
JuliaMath:masterfrom
kimikage:rm_signed_unsigned
Closed

kimikage wants to merge 1 commit into
JuliaMath:masterfrom
kimikage:rm_signed_unsigned

Conversation

@kimikage

@kimikage kimikage commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

This was separated from PR #350.

There was a discussion regarding signed(T) and unsigned(T) in late 2018, and as of at least 2020, no clear conclusion had been reached regarding generalization to types other than Integer (including the addition of signedtype() and unsignedtype()). (cf. JuliaLang/julia#30445)

More than five years have passed since then, but since there has been no movement toward generalization in other packages, I believe that even if this package supports SNormed or UFixed, FixedPoint would not support signed() or unsigned().

In other words, the stub has fulfilled its role as a placeholder. Furthermore, it will not affect existing codes, as long as they don't abuse the bug in Julia <v1.4.


I don't remember why I did it, but some of the sign tests should have been marked @test_broken instead of @test_throws.

@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.21%. Comparing base (6decae1) to head (b036653).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #356      +/-   ##
==========================================
- Coverage   97.22%   97.21%   -0.01%     
==========================================
  Files           7        7              
  Lines         792      790       -2     
==========================================
- Hits          770      768       -2     
  Misses         22       22              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kimikage
kimikage force-pushed the rm_signed_unsigned branch 3 times, most recently from 0a74ffe to 6c98776 Compare October 14, 2026 14:30
@kimikage

Copy link
Copy Markdown
Collaborator Author

Test results on julia v1.0 - v1.13 and nightly
https://github.com/JuliaMath/FixedPointNumbers.jl/actions/runs/38581189692

@kimikage
kimikage marked this pull request as ready for review October 14, 2026 15:57
@kimikage kimikage changed the title [WIP] Remove stub implementations for signed() and unsigned() Remove stub implementations for signed() and unsigned() Oct 14, 2026

@PatrickHaecker PatrickHaecker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the point of this PR. It breaks for older Julia versions exactly what #350 wants to avoid by being honest about what is supported and what isn't.

Comment thread src/FixedPointNumbers.jl
Comment on lines -370 to -371
signed(x::X) where {X <: FixedPoint} = signed(X)(signed(x.i), 0)
unsigned(x::X) where {X <: FixedPoint} = unsigned(X)(unsigned(x.i), 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Julia 1.3, this breaks the code (no surprise here):

julia> using FixedPointNumbers; signed(1N0f8)
1

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making code that was working stop working is a breaking change, but I’m skeptical about whether making code that wasn’t working start working in an undesirable way counts as a breaking change.

As far as these two methods are concerned, I don't have a strong opinion.
However, if we interpret “breaking changes” too strictly, we won't be able to fix bugs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

I still like the "more honest" approach of #350 better (and I would suggest that we avoid spending time on compatibility with versions no one uses with upgraded package versions anyway – sorry for triggering this), but I can follow your argument here: It wasn't working before and in that sense it's not too bad that it is not working now. Nevertheless, the question remains why it's better to return an incorrect result instead of throwing.

@kimikage

Copy link
Copy Markdown
Collaborator Author

I'd like to create a separate PR to fix the test, and then fix the bug of sign.

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