Skip to content

fix: change float32 to float64 in Sign operator to prevent precision loss#2148

Open
digital-wizard48 wants to merge 1 commit intomicrosoft:mainfrom
digital-wizard48:fix/issue-61-erroneous-float-calculations
Open

fix: change float32 to float64 in Sign operator to prevent precision loss#2148
digital-wizard48 wants to merge 1 commit intomicrosoft:mainfrom
digital-wizard48:fix/issue-61-erroneous-float-calculations

Conversation

@digital-wizard48
Copy link

Summary

  • The Sign class in qlib/data/ops.py was converting series data to np.float32 to handle bool type inputs
  • This caused significant precision loss for large numbers (e.g., multiplying close price by volume)
  • For example, Mul($close, $volume) could return 3989893056.0 instead of the correct 3989893260.0
  • The fix changes the dtype from np.float32 to np.float64 which preserves the necessary precision

Fixes #61


This PR was auto-generated by Gittensor bot using Claude AI to fix a reported issue.

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.

Erroneous float calculations.

2 participants