Skip to content

madness::conj(x) for double x truncated to float#651

Merged
evaleev merged 1 commit intomasterfrom
evaleev/fix/conj-real
Jan 19, 2026
Merged

madness::conj(x) for double x truncated to float#651
evaleev merged 1 commit intomasterfrom
evaleev/fix/conj-real

Conversation

@evaleev
Copy link
Contributor

@evaleev evaleev commented Jan 18, 2026

this seemingly is not used everywhere where "conj" is performed (there are other "instances" of conj) but most notably matrix_inner uses it ... perhaps used elsewhere also?

this seemingly is not used everywhere (there are other "instances" of conj) but most notably matrix_inner uses it
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 conj functions to templates that work with any floating-point type
  • Added proper type constraints using std::enable_if_t and std::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.

@evaleev
Copy link
Contributor Author

evaleev commented Jan 19, 2026

for the record: issue introduced in e9dae0a, code before should have been fine.

@evaleev evaleev merged commit b529fbd into master Jan 19, 2026
30 checks passed
@JonathonMisiewicz JonathonMisiewicz deleted the evaleev/fix/conj-real branch January 19, 2026 21:15
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.

1 participant