0

I am reading Kernighan and Ritchie, and honestly, I am not able to understand anything in the following sentence I encountered while reading:

Any integer is converted to a given unsigned type by finding the smallest non-negative value that is congruent to that integer,
modulo one more than the largest value that can be represented in the unsigned type.

Could anyone please clarify what congruent means here and try explaining to me what does this sentence exactly convey(if possible , with an example).

Thank you

P.S. I am referring to Appendix A Section A6.2 : Integral Conversions

2
Contributors
2
Replies
5
Views
5 Years
Discussion Span
Last Post by DJSAN10
0

The standard uses a simpler description:

if the new type is unsigned, the value is converted by repeatedly adding or subtracting one more than the maximum value that can be represented in the new type until the value is in the range of the new type.

0

The standard uses a simpler description:

Okay.. got it to some extent. I will check the description given in the standard.
Thank you.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.