madness::conj(x) for double x truncated to float#651
Merged
Conversation
this seemingly is not used everywhere (there are other "instances" of conj) but most notably matrix_inner uses it
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes a precision bug where conj(x) for double values was being truncated to float, causing loss of precision. The bug was caused by the original implementation having static double conj(float x), which forced implicit narrowing conversion when called with double arguments.
Changes:
- Converted the
conjfunctions to templates that work with any floating-point type - Added proper type constraints using
std::enable_if_tandstd::is_floating_point_v - Changed complex conjugate function to use pass-by-reference for better performance
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
for the record: issue introduced in e9dae0a, code before should have been fine. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this seemingly is not used everywhere where "conj" is performed (there are other "instances" of conj) but most notably
matrix_inneruses it ... perhaps used elsewhere also?