You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provides gcd for int and long, returns non-negative gcd(0,x)=|x|. Compute gcd(|a|, |b|) using Stein's algorithm (binary GCD). Handles negative inputs and Integer.MIN_VALUE safely.
Issue details
BitwiseGCD.java implements the binary GCD (Stein’s) algorithm for int and long and includes a main with ad-hoc tests. Create a well-formed issue describing missing items: formal unit tests, CI integration, documentation, edge-case verification, microbenchmarks, and suggested improvements (API/behavior consistency, extended GCD, performance regression tests). This issue tracks adding those items and provides reproducible steps, expected results, failing/ambiguous behaviors to check, and recommended fixes.
Additional Information
Algorithm: Binary GCD (Stein’s algorithm).Repeatedly remove common factors of 2, make both operands odd by shifting, subtract the smaller from the larger, repeat until one becomes 0, then restore powers of two.