From Jason Turner
Watch on YouTube

Summary

This episode explores the surprising complexity of the modulo operation in various programming languages. Jason demonstrates that different languages implement modulo differently when handling negative operands, with three main approaches: truncated division (C/C++), floored division (Python), and Euclidean division (Dart). The episode highlights how these different implementations affect wrap-around behavior for array indexing, making cross-language algorithm porting challenging and often producing unexpected results.

Resources

Tags