5 ms·
I found what was causing the off-result for me; if you do: 128 / 3 (2 int's) in C# it will truncate to int; if you do 128 / 3.0 you'll get the expected output a
by NKCSS 9y ago
I found what was causing the off-result for me; if you do: 128 / 3 (2 int's) in C# it will truncate to int; if you do 128 / 3.0 you'll get the expected output and everything starts to make sense :)
- quincunx 9y agook, two other things that may be throwing you off, the input is a filesize, not a width, the result of filesize / 3 is always an integer (even if float representation,) and the result of sqrt(filesize/3) is also always an integer (even if float representation,) as per the comments. Also, taking the 2log and then 2power is a no-op because it doesn't truncate / ceiling in-between the two. You kind of see where the code was going to, but it never quite made it there.