memesearch
Overengineered Number Length Function

Overengineered Number Length Function

Download Find similar pictures
Text on the meme
/* Return length of number */ long long num(long long num) { if (num >= 0 && num < 10) return 1; if (num >= 10 && num < 100) return 2; if (num >= 100 && num < 1000) return 3; if (num >= 1000 && num < 10000) return 4; if (num >= 10000 && num < 100000) return 5; if (num >= 100000 && num < 1000000) return 6; if (num >= 1000000 && num < 10000000) return 7; if (num >= 10000000 && num < 100000000) return 8; if (num >= 100000000 && num < 1000000000) return 9; if (num >= 1000000000 && num < 10000000000) return 10; if (num >= 10000000000 && num < 100000000000) return 11; if (num >= 100000000000 && num < 1000000000000) return 12; if (num >= 1000000000000 && num < 10000000000000) return 13; if (num >= 10000000000000 && num < 100000000000000) return 14; if (num >= 100000000000000 && num < 1000000000000000) return 15; if (num >= 1000000000000000 && num < 10000000000000000) return 16; if (num >= 10000000000000000 && num < 100000000000000000) return 17; if (num >= 100000000000000000 && num < 1000000000000000000) return 18; }
What it means

A screenshot shows a C/C++-style function calculating the number of digits with a long chain of range checks. The joke is that a simple logarithm, string conversion, or standard function would be much shorter, so the code is comically overengineered and repetitive. It is shared as a reaction to unnecessarily complicated programming solutions.

Objects
Tags
Source
Type
image
Size
480×295 · 40.2 KiB
Mood
sarcastic, absurd
Language
en
Added

Similar memes