A few times I have told the anecdote that the singly most baffling thing I ever saw in a code review — not the most insecure, just the most “how could a real programmer have written this? how could this ever make sense?” thing — was simply a C++ variable “number_of_trucks” … declared as float. Unambiguously referring to real physical trucks in a fleet.

Reader, it’s been over ten years and I am blowing the gods damn whistle. I had edited that story to protect the guilty: the variable was named number_of_planes. It was shipped by a company whose name begins with “B” and rhymes with “GOING out of business.”

Follow

@0xabad1dea Four words scary story "It was not trucks." 😱

Having worked on the ALU/FPU side, I believe there are exactly two legitimate uses for floats:
* the signal dynamic is super duper high
* the signal dynamic is unknown and can potentially be very high.
Every other case will be better handled (be faster, use less memory, have less corner cases) with integers and constant scaling factors.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.