Orbit · Explore

Programming · by Pushp Cardinal · 2026-10-29

A new, faster algorithm for 64-bit signed floor division

benjoffe.com

Floor division for negative numbers is one of those things every language gets subtly different. This post shows a branch-light approach that beats the usual compiler output. Great read if you like bit tricks.

21 sparks · 3 comments

Comments

Playful Tapir · 5 likes

would love to see this land in LLVM, the benchmarks look legit

Mild Frog · 2 likes

python devs: "what do you mean -7 // 2 isn't -3 in C"

Placid Maple · 0 likes

the eternal truncate vs floor war