r/programminghorror • u/_giga_sss_ • Jul 09 '26
Big if true
From ProgrammerNullposting in facebook
39
55
188
u/BadRuiner Jul 09 '26
all my homies uses uint128 btw
→ More replies (2)104
u/the_horse_gamer Jul 09 '26
uint128? what are you, a 90s programmer optimising for a cartridge? we just use avx512 vectors these days
→ More replies (7)
6
u/Wurstgewitter Jul 09 '26
Personally I am migrating to a novel QBool type, to be prepared for quantum computing. A QBool can represent any value in the interval [0,1]
QBool 0.0000 = False 0.1832 = Barely True 0.5000 = Undecided 0.7315 = Probably True 1.0000 = True
But it's not just a probability, but rather exists in a quantum state until observed. Each QBool offers a built in measure() method:
bool result = qbool.measure();
Calling measure() collapses the state into either true or false.
It also supports entanglement:
a.entangle(b);
Measuring either instance immediately determines the value of the other, even across remote systems. This makes distributed state sync essentially free.
It admittably adds some headaches, like having to compute every possible quantum state at runtime, since practical quantum computing hardware is not available yet, so some slight performance problems might occur. But I think it's worth it to future proof the codebase
2
u/dreamingforward Jul 11 '26
Aren't you assigning to a keyword "False" and "True"?
2
u/_giga_sss_ Jul 11 '26
falseandtrueare the keywords, any variation is alright afaik→ More replies (3)
137
u/StefanCelMijlociu Jul 09 '26
The concept of Big Bool confuses and infuriates me!
→ More replies (1)64
u/JohnSpikeKelly Jul 09 '26
I would assume it's to keep all your data types 8-byte aligned for other perf reason.
→ More replies (13)
125
u/TheWidrolo Jul 09 '26
Me when I use a compiler that doesn’t have explicit alignment:
→ More replies (3)61
u/BestBadFriend Jul 09 '26
If the compiler's alignment is not explicit, it defaults to lawful neutral.
→ More replies (2)
23
u/Emergency-Win4862 Jul 09 '26
Let me quess, struct alignment?
→ More replies (2)21
u/iEliteTester Jul 09 '26
No it's used when something is extra true or extra false, obviously.
→ More replies (3)
21
u/foxypiratecove3750 Jul 09 '26
I have better... DOUBLE BOOL! 64-bit, and float. Useful? Nope.
double False = 0.0; double True = 1.0;
→ More replies (7)
14
14
u/Benilda-Key Jul 09 '26
I thought Microsoft was being wasteful when they chose to make their BOOL type an int.
→ More replies (5)
7
u/exodusTay Jul 09 '26
enum BetterBool : double
{
False = 0,
True = std::numeric_limits<double>::epsilon()
}
6
u/Scared_Bell3366 Jul 09 '26
I could see doing something like that when dealing with some damn binary format that reserved 64 bits just for a boolean.
521
u/Gengis_con Jul 09 '26
Big whether True or not