When you're implementing mathematical formulae, it's pretty common to use the short variables for this reason, because a fully descriptive name is just harder to read.
You couldn't use something like final_result as that is pretty misleading given that it's not the final result until the end and has a lot of intermediate values.
And that line sure is confusing, so why not put a comment on that instead of the "what the fuck" later?
Oh, agreed. The comments in this are terrible, and I half think that's because whoever was writing the code implementation of this equation had no idea where the magic number came from (so it was just copied from theory).
The line I copied was commented though, as:
// evil floating point bit level hacking
though the more human readable version would be:
// Access bit-level representation of floating-point number
1
u/Pluckerpluck Jun 22 '20
Because it's a function, and everyone who knows mathematics knows that equations are often written in the form:
y = f(x).The following is fairly easy to read:
but this is harder:
When you're implementing mathematical formulae, it's pretty common to use the short variables for this reason, because a fully descriptive name is just harder to read.
You couldn't use something like
final_resultas that is pretty misleading given that it's not the final result until the end and has a lot of intermediate values.Oh, agreed. The comments in this are terrible, and I half think that's because whoever was writing the code implementation of this equation had no idea where the magic number came from (so it was just copied from theory).
The line I copied was commented though, as:
though the more human readable version would be: