r/programminghorror • u/Secret-Comparison-40 • Dec 24 '25
randomly stumbled upon this code in my company’s product (CAE software)
749
Upvotes
r/programminghorror • u/Secret-Comparison-40 • Dec 24 '25
310
u/qtac Dec 24 '25
Kinda wild to post proprietary company code while calling out the company lmfao
Insane risk vs reward on that play 😂
35
u/athy-dragoness Dec 24 '25
did someone say magic numbers?
181
u/ill-pick-one-later Dec 24 '25
Insert Ken Jeong squinting meme
239
u/HyperCodec Dec 24 '25
Average quaternion implementation be like
54
u/Brilliant-Parsley69 Dec 24 '25
Looks like Vector Rotation for me:
q_{rot} = w_1w_2 - x_1x_2 - y_1y_2 - z_1z_2
must be a relict out of a time when you couldn't trust the compilers.
23
u/tekanet Dec 24 '25
Honestly curious, is there a way to implement this type of code in a clean way?
8
u/[deleted] Dec 24 '25
It looks like the first code I have ever written, and I defined Rubik’s cube rotation this way
6
u/oberguga Dec 24 '25
Actually look ok for just computation code. It can be some matrices and universal code to operate on them, but if language has no concept of compiler time computations and optimisations, based on such computation (legacy C /C++ code for example) it should run faster.
4
u/True-Strike7696 Dec 24 '25
superiority complex jokes are getting old. I feel like most are judging this without any real subject knowledge. the real questions: does it work? what's the reward and risk if it is changed?
4
u/-light_yagami Dec 24 '25
bro zoom out a bit more, I can still make out some characters
3
u/DStauffman Dec 25 '25
I've written a bunch of quaternion routines, so my guess is that those are probably Euler rotation sequences. Comments would be nice to show which one is which, but it is something that makes sense to optimize, which often sacrifices readability.
2
u/craiv Dec 24 '25
Found the 3DExperience developer
2
u/CeduAcc Dec 25 '25
lgtm
2
u/DearConversation7629 Dec 25 '25
That's straight up obfuscation lmfao
2
u/Diligent_End8130 Dec 26 '25
Could be auto generated code for embedded systems or microcontroller code 🤔
2
u/ConcertWrong3883 Dec 27 '25
That's just blas...
1
u/stapeln Dec 24 '25
None disclosure horror 😁
1
u/SpecialMechanic1715 Dec 24 '25
just run from there
1
u/Material-Aioli-8539 Dec 24 '25
Dude.. what the fuck does all that even mean!!
Someone label things please!!! (Or leave)
1
u/TheMonHub Dec 25 '25
... Huh
1
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Dec 25 '25
Way too small to read, but it looks like math. Might be fine if everyone touching it understands the math behind it.
1
u/BetelgeuseDesu Dec 28 '25
Wtf is this vibe code looking pile of junk
1
u/EDM_IT_Nerd Dec 28 '25
What's that code and how it works? It looks interesting...
1
u/Material-Aioli-8539 Oct 19 '26
What. Is. This.
I cannot understand this at all..
What. The. Fuck.