Skip to content

Commit

Permalink
Avoid non-integral quotient in documentation of fqmul()
Browse files Browse the repository at this point in the history
fqmul() is documented to require a 2nd input that's "< q/2"
in absolute value. This is the correct meaning when reading
q/2 as a _rational_ quotient, but it's not when q/2 is read
as round-down division: In that case, one would need to say
<= instead of <.

This commit avoids any confusion by rewriting the documentation
in terms of the integral quotient (q+1)/2.

Signed-off-by: Hanno Becker <[email protected]>
  • Loading branch information
hanno-becker committed Oct 31, 2024
1 parent 4a2663a commit 2f25adf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mlkem/reduce.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ENSURES(RETURN_VALUE > -HALF_Q && RETURN_VALUE < HALF_Q);
* Arguments: - int16_t a: first factor
* Can be any int16_t.
* - int16_t b: second factor.
* Must be signed canonical (abs value <|q|/2)
* Must be signed canonical (abs value <(q+1)/2)
*
* Returns 16-bit integer congruent to a*b*R^{-1} mod q, and
* smaller than q in absolute value.
Expand Down

0 comments on commit 2f25adf

Please sign in to comment.