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
{{ message }}
Repository navigation
CROTG/ZROTG return wrong sine phase for scaled complex inputs after #6123 #6269
On current develop (dbf2c24c9e43ed8f8c12f32837a2f87fab848e97), cblas_zrotg and cblas_crotg return the wrong imaginary sign for the sine when finite complex inputs take the scaled path. The resulting rotation does not annihilate the second component.
This appears to be a regression from #6123. The ZROTG cases I checked from #6120 pass on current develop, but the mixed-phase case below does not.
Reproducer
Link this program against a current OpenBLAS build. The inputs are finite normal numbers and exact powers of two.
For ZROTG, the expected result is c = 1/sqrt(3) and s = (1-i)/sqrt(3), so second/2^512 = (c-Re(s), c+Im(s)) is approximately (0,0). The bundled Reference BLAS ZROTG returns this result.
Current OpenBLAS returns c = 0.57735026918962573 and s = (0.57735026918962584, +0.57735026918962584), giving second/2^512 ≈ (-1.1e-16, 1.1547005383792515). CROTG has the same sign error at the smaller scale shown above.
Environment
OpenBLAS develop at dbf2c24c9e43ed8f8c12f32837a2f87fab848e97, built from source and linked as a static library
Apple M5 Pro, macOS 27.0; the reproducer calls only the scalar ROTG routines
Suspected cause
In interface/zrotg.c near line 164, the scaled branch computes the imaginary part of s with - gs_i * -1. * (fs_r / f2h), which adds that term. For f * conj(g), this term should be subtracted. The expression was changed in #6123 while fixing #6120. The source is shared by the single- and double-precision routines.
Activity