forked from Klipper3d/klipper
-
Notifications
You must be signed in to change notification settings - Fork 0
[Go Migration] Fix screws_tilt_adjust.test floating-point rounding #2
Copy link
Copy link
Open
Description
Problem
Step interval/count values differ due to floating-point rounding:
Expected: interval=8610 count=7 add=-74
Actual: interval=8625 count=6 add=-74
Large single-step movements show dramatic differences:
Expected: interval=4192000 count=1 add=0
Actual: interval=192000 count=1 add=0 (22x difference!)
Root Cause
Go (runtime.go:577-582):
return uint64(int64(printTime * th.mcuFreq)) // int64 intermediatePython (clocksync.py:123-124):
return int(print_time * self.mcu_freq) // Direct truncationThe int64 intermediate conversion in Go causes different rounding behavior.
Proposed Fix
File: go/pkg/hosth4/runtime.go line 577-582
func (th *toolhead) printTimeToClock(printTime float64) uint64 {
if printTime <= 0.0 {
return 0
}
return uint64(printTime * th.mcuFreq) // Direct conversion, no int64
}Verification
./scripts/go_migration_golden.py compare --only screws_tilt_adjust --mode strictEstimate
~1 hour (simple one-line fix)
Parent Issue
Part of #1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels