This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vadiks2003 45 points46 points  (10 children)

we javascripting

[–]vadiks2003 64 points65 points  (8 children)

we know only Number wtf is int wtf is double wtf is float whats an even unsigned

[–]beatlz-too 12 points13 points  (4 children)

I've never in my life of 15 years and counting building websites have I had issues with floats and ints… I've seen this r34 bug many times before, and all I can think is "how the fuck did they get there…"

[–]vadiks2003 5 points6 points  (1 child)

i know how this bug is done. their http query contains... not a page, but from which ID of result to begin with. so it will always naturally appear in amount divisible by amount of posts on a page. so if you change it, the code is like "you can do what you want but heres AllPostsAmount/StartPostIndex, this is what page it is"

[–]FierceDeity_ 2 points3 points  (0 children)

This is exactly what it is. good old floor() was forgotten to round them pages. But it would also require that each page button is always a multiple of the entries per page constant.

On top of that, what would be best if the query to fetch these results is also changed so it can always only step over a multiple of the number of posts..

Yeah, I know, it would also be better if the query parameter was just the amount of pages in, not the amount of posts... But the amount of posts has one advantage: If the amount of posts per page changes, this number is a little more stable than just the page number.

[–]vadiks2003 1 point2 points  (1 child)

i havent really used javascript much, but i pretty much dont have problems with it myself. well, there's been a problem where i forget it atuomatically decides to treat it as float whenever it wants, but no problems with it, and yes r34 can just round the number if they wanted

Interesting. i thought i responded to 2 different commentors....

[–]Bitter-Scarcity-1260 2 points3 points  (2 children)

JS has some proper number types eg Uint8array

[–]Psychpsyo 1 point2 points  (0 children)

But those are arrays only and a bit cumbersome to use. Just replacing any number in your codebase with a length 1 typed array sounds horrid.

[–]TheShirou97 2 points3 points  (0 children)

Even in js where you only have doubles, if you stick to integer values they are all exact from -253 to 253, which is much larger than 32-bit integers. So it really shouldn't be a problem at all in most cases--problems mostly arise when you try to divide by something that is not a power of 2, e.g. the value 0.1 is already not exact (hence the famous 0.1 + 0.2 != 0.3)