▲ 342 ▼ which one are you? (switch or sub) (thelemmy.club) submitted 6 days ago by gandalf_der_12te@lemmy.blahaj.zone to c/femcelmemes@lemmy.blahaj.zone 22 comments fedilink hide all child comments
[–] Avicenna@programming.dev 12 points 5 days ago (1 child) sub overflow permalink fedilink source hideshow 2 child comments replies: [–] gandalf_der_12te@lemmy.blahaj.zone [S] 1 point 4 days ago (1 child) more like sub underflow? permalink fedilink source parent hideshow 2 child comments replies: [–] Avicenna@programming.dev 2 points 3 days ago (1 child) "so much of a sub that you dom" reminded me of integer overflow but sure why not (though don't really understand it...) permalink fedilink source parent hideshow 2 child comments replies: [–] gandalf_der_12te@lemmy.blahaj.zone [S] 2 points 3 days ago (1 child) there's integer overflow and integer underflow. when you have an 8-bit signed integer variable: signed char x = 127 and you try to increment it by 1: signed char y = x + 1 and then you print y: `printf("%d\n", int(y))", it will print -128. the reason is integer overflow, kinda like when you add 1 to 999, you get 1000. but if the variable can only store 3 digits, you get 000 instead, which is 0. the computer interprets that as a negative value though because of offset etc. the same works in reverse. -999 - 1 = -1000 which gets interpreted as -000 which gets interpreted as a positive number then. permalink fedilink source parent hideshow 2 child comments replies: [–] Avicenna@programming.dev 3 points 3 days ago* Hah for some reason I thought it was arithmetic underflow but given that the original joke was integer overflow and not arithmetic overflow it makes more sense for it to be integer underflow too. And I agree fits better. permalink fedilink source parent
[–] gandalf_der_12te@lemmy.blahaj.zone [S] 1 point 4 days ago (1 child) more like sub underflow? permalink fedilink source parent hideshow 2 child comments replies: [–] Avicenna@programming.dev 2 points 3 days ago (1 child) "so much of a sub that you dom" reminded me of integer overflow but sure why not (though don't really understand it...) permalink fedilink source parent hideshow 2 child comments replies: [–] gandalf_der_12te@lemmy.blahaj.zone [S] 2 points 3 days ago (1 child) there's integer overflow and integer underflow. when you have an 8-bit signed integer variable: signed char x = 127 and you try to increment it by 1: signed char y = x + 1 and then you print y: `printf("%d\n", int(y))", it will print -128. the reason is integer overflow, kinda like when you add 1 to 999, you get 1000. but if the variable can only store 3 digits, you get 000 instead, which is 0. the computer interprets that as a negative value though because of offset etc. the same works in reverse. -999 - 1 = -1000 which gets interpreted as -000 which gets interpreted as a positive number then. permalink fedilink source parent hideshow 2 child comments replies: [–] Avicenna@programming.dev 3 points 3 days ago* Hah for some reason I thought it was arithmetic underflow but given that the original joke was integer overflow and not arithmetic overflow it makes more sense for it to be integer underflow too. And I agree fits better. permalink fedilink source parent
[–] Avicenna@programming.dev 2 points 3 days ago (1 child) "so much of a sub that you dom" reminded me of integer overflow but sure why not (though don't really understand it...) permalink fedilink source parent hideshow 2 child comments replies: [–] gandalf_der_12te@lemmy.blahaj.zone [S] 2 points 3 days ago (1 child) there's integer overflow and integer underflow. when you have an 8-bit signed integer variable: signed char x = 127 and you try to increment it by 1: signed char y = x + 1 and then you print y: `printf("%d\n", int(y))", it will print -128. the reason is integer overflow, kinda like when you add 1 to 999, you get 1000. but if the variable can only store 3 digits, you get 000 instead, which is 0. the computer interprets that as a negative value though because of offset etc. the same works in reverse. -999 - 1 = -1000 which gets interpreted as -000 which gets interpreted as a positive number then. permalink fedilink source parent hideshow 2 child comments replies: [–] Avicenna@programming.dev 3 points 3 days ago* Hah for some reason I thought it was arithmetic underflow but given that the original joke was integer overflow and not arithmetic overflow it makes more sense for it to be integer underflow too. And I agree fits better. permalink fedilink source parent
[–] gandalf_der_12te@lemmy.blahaj.zone [S] 2 points 3 days ago (1 child) there's integer overflow and integer underflow. when you have an 8-bit signed integer variable: signed char x = 127 and you try to increment it by 1: signed char y = x + 1 and then you print y: `printf("%d\n", int(y))", it will print -128. the reason is integer overflow, kinda like when you add 1 to 999, you get 1000. but if the variable can only store 3 digits, you get 000 instead, which is 0. the computer interprets that as a negative value though because of offset etc. the same works in reverse. -999 - 1 = -1000 which gets interpreted as -000 which gets interpreted as a positive number then. permalink fedilink source parent hideshow 2 child comments replies: [–] Avicenna@programming.dev 3 points 3 days ago* Hah for some reason I thought it was arithmetic underflow but given that the original joke was integer overflow and not arithmetic overflow it makes more sense for it to be integer underflow too. And I agree fits better. permalink fedilink source parent
[–] Avicenna@programming.dev 3 points 3 days ago* Hah for some reason I thought it was arithmetic underflow but given that the original joke was integer overflow and not arithmetic overflow it makes more sense for it to be integer underflow too. And I agree fits better. permalink fedilink source parent