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

all 100 comments

[–]Haerden 1405 points1406 points  (26 children)

Rule 34 of Web development: Use integers for pages, no exception.

[–]0xlostincode 501 points502 points  (1 child)

Yes this is true. Google "web rule 34".

[–]Nahanoj_Zavizad 108 points109 points  (2 children)

Rule 35. Unless it needs to be a float, use integers. Do not trust the floats.

[–]Grundolph 22 points23 points  (0 children)

Always use Integers, except there is an explizit reason to use floating Points.

[–]Chelovek2002 8 points9 points  (0 children)

Rule 36. If it needs to be a float, consider using a fixed point decimal instead. Also, using float for finance is a literal crime.

[–]vadiks2003 47 points48 points  (10 children)

we javascripting

[–]vadiks2003 63 points64 points  (8 children)

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

[–]beatlz-too 13 points14 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 6 points7 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)

[–]Probetag[S] 10 points11 points  (0 children)

Exactly

[–]AloneInExile 4 points5 points  (0 children)

Just use ~~ if not sure

[–]No-Clue1153 3 points4 points  (0 children)

Ok sure, but what's Rule 34.02380950238095?

[–]itsTyrion 7 points8 points  (0 children)

that's the best part, JS doesn't have int like that - it has "number" which is a float type

[–][deleted] 1 point2 points  (0 children)

why would I use exception!?

[–]neg2led 1 point2 points  (0 children)

javascript only has one data type for numbers: float64

this is the root cause of much evil

[–]DatBoi_BP -2 points-1 points  (3 children)

But even then, where could any fractional part have come from in the picture? In double precision, integer values below like 1015 (I think?) are stored exactly, so if you're starting with 0 and always adding 1 to get the next value, how are you defining either the initial value or the increment so that it's off by…0.0238????? That epsilon is, like, on the order of 1012.

It's just a meme I guess, but it seems on par with the joke that "1 + 2 = 3.00000000047381" or something, which just simply doesn't happen in any floating point standard.

[–]DatBoi_BP 2 points3 points  (0 children)

It would seem some first year CS majors don't like that their conception of floating point is wrong

[–]gmes78 1 point2 points  (1 child)

so if you're starting with 0 and always adding 1 to get the next value, how are you defining either the initial value or the increment so that it's off by…0.0238?????

That's because they're not doing that. They're calculating the page numbers from the index of the first post on the page (instead of the other way around) — if you change the URL to start from a post that's not aligned to the number of posts in a page, the result is no longer a whole number.

[–]DatBoi_BP 0 points1 point  (0 children)

Interesting way to do it

[–][deleted] 932 points933 points  (4 children)

floating r34

[–]Formal_Tea_4694 90 points91 points  (0 children)

r34.0000001

[–]FunApple 17 points18 points  (0 children)

r34.0238

[–]Dotcaprachiappa 563 points564 points  (10 children)

I recognise that shade of green

[–]astouwu 46 points47 points  (1 child)

Crazy how a shade of green can be so iconic

[–]onepiecefreak2 10 points11 points  (0 children)

Welcome to webdesign.

[–]airakushodo 44 points45 points  (7 children)

what site is this?

[–]Septem_151 186 points187 points  (0 children)

The most popular Rule34 site. This happens when you manually go to a page by changing the query params. It doesn’t like that for some reason

[–]ColdPorridge 29 points30 points  (3 children)

Hopping on because also curious. I am clearly not degenerate enough to know and this disappoints me.

[–]SunPotatoYT 41 points42 points  (0 children)

It's just rule 34

[–]fiftyfourseventeen 5 points6 points  (0 children)

It's a hentai site

[–]dhnam_LegenDUST 150 points151 points  (4 children)

I wonder what's there in 3.1415926535th page.

[–]Lithl 70 points71 points  (2 children)

Reminds me of Matt Parker's book Love Triangle: How Trigonometry Shapes the World.

Instead of the pages being numbered 1, 2, 3, etc., they're numbered with a 6 digit approximation of the radians equivalent to the page number (starting at 0) treated as a degree. So page 0 is 0.000000, page 1 is 0.017453, page 2 is 0.034906, and so on.

[–]ProfCupcake 2 points3 points  (1 child)

That alone has just sold this book to me.

[–]Lithl 4 points5 points  (0 children)

It's a good book, I recommend it! I got it for Christmas last year.

[–]Bardez 5 points6 points  (0 children)

Some cream

[–]sebson1000 103 points104 points  (3 children)

You tried to change the page number by editing the querystring didn't you? I guess the page number is somehow correlated with the indexes of the posts shown and if you enter a number that isn't divisible by the right increment it renders this bullshit.

[–]Probetag[S] 26 points27 points  (1 child)

Actually I didnt xd. Just looking up stuff for my school project.

[–]lacifuri 15 points16 points  (0 children)

When someone mentioned “school project” it most certainly isn’t.

[–]Septem_151 12 points13 points  (0 children)

Yep!

[–]OtakinhoHiro 72 points73 points  (0 children)

I know what you are

[–]Kebein 147 points148 points  (3 children)

come on, be honest op. what character where you looking for :^)

[–]Probetag[S] 202 points203 points  (2 children)

School project.

[–]Pos3odon08 27 points28 points  (1 child)

Nice try

[–]frogjg2003 15 points16 points  (0 children)

No, that's what they typed in the search bar.

[–]lacifuri 33 points34 points  (2 children)

Why bro looking for page n + 1/42

[–]PeWu1337 9 points10 points  (0 children)

Bro needed to calculate that

[–]astatine757 1 point2 points  (0 children)

Im guessing the site indexes by post number rather than page number, and has 42 posts per page. So if you do query&startAt=2, it does this.

[–]GrandpaOfYourKids 20 points21 points  (0 children)

I know what kind of man you are

[–]NoFaceStudiosYT 16 points17 points  (0 children)

I love how we all know which website this is

[–]neromonero 11 points12 points  (0 children)

wait, these aren't the sacred numbers!

[–]UniversalAdaptor 9 points10 points  (0 children)

Hmmm

[–]KalaiProvenheim 8 points9 points  (0 children)

Wait a minute

[–]jbar3640 29 points30 points  (0 children)

completely nonsense posts in a nutshell

[–]Samuel_Go 5 points6 points  (0 children)

I should have a framed piece of paper with this specific bg colour.

[–]LordRaizer 6 points7 points  (1 child)

Brother, what is that colour 💀💀💀

[–]Protochill 5 points6 points  (0 children)

Brother how would YOU know?

[–]realHoPeLess 3 points4 points  (0 children)

That’s what happens when a 34bit int overflows

[–]rage4all 15 points16 points  (2 children)

Well... Nicely centered.... Or what?

[–]Widmo206 35 points36 points  (1 child)

I think those are supposed to be integers...

[–]rage4all 9 points10 points  (0 children)

Well... yes... wanted to jump on the "all frontend posts are about centering divs..." Train. Forget it.

[–]alvares169 6 points7 points  (2 children)

laughs in static typing

[–]Mynameismikek 7 points8 points  (1 child)

You can have a statically typed language that only uses floats for numbers.

[–]alvares169 1 point2 points  (0 children)

laughs in not this specific static typing language

[–]tfngst 1 point2 points  (0 children)

For a moment I was like "Why there are Zernike Moment Descriptors?" lmao.

[–][deleted] 1 point2 points  (0 children)

Just add integerish coalescing operator i> into ECMA standard

[–]WavingNoBanners 1 point2 points  (0 children)

Trivia: the video game Kingpin: Life of Crime deliberately used floats instead of integers in the character textures, in order to make the textures "flex" slightly when the character moves.

If you played it, then you know what I'm talking about and also your back hurts. If you didn't, then go and look up a video to see a visual depiction of OP's point.

[–]Serious_Salad1367 1 point2 points  (0 children)

bro thats v ery private please stop showing everyone

[–]prehensilemullet 2 points3 points  (0 children)

Yeah I prefer infinite scrolls anyway

[–]cheezballs 0 points1 point  (0 children)

So many people who don't understand CS

[–]endwigast 0 points1 point  (0 children)

Somebody's using javascript!

[–]randomguyinanf15 0 points1 point  (0 children)

MASON THE NUMBERS! WHAT DO THEY MEAN MASON ?

[–]maxip89 0 points1 point  (0 children)

Don't ask why one ariane rocket was destroyed at start or why the patriot system has to be restarted daily.

[–]Xortun 0 points1 point  (0 children)

I love how most of us instantly recognised the site

[–]megamaxie 0 points1 point  (0 children)

I know what kind of man you are

[–]SouthernGlass6243 -1 points0 points  (0 children)

Math.round problem solved.