5 ms·
You can carry a maximum of 255 rupees in the original Legend of Zelda, and back in the day magazines commented on the "oddly specific" number.
by city41 7y ago
You can carry a maximum of 255 rupees in the original Legend of Zelda, and back in the day magazines commented on the "oddly specific" number.
- Bayart 7y agoThat reminds me back when WoW was still 32 bits and people discovered the gold cap was 2 147 483 647 copper coins.
- reificator 7y agoSo your gold value was signed? Does WoW allow for debt by tracking negative values, or was it just an oversight?
- saalweachter 7y agoSome people just really, really dislike unsigned ints.
- Gibbon1 7y agoI've run into programmers that think something terrible is going to happen if you use an unsigned int for anything.
- perl4ever 7y agoIs there a popular language these days that throws an exception whenever an unsigned int overflows?
- vertex-four 7y agoRust in debug mode or with a compiler option will panic if a number overflows.
- perl4ever 7y agoHuh. That doesn't sound like something people use in production code. Maybe a hardware feature is needed? I mean, it's normal with floating point to handle overflow in a more sensible way, isn't it...
- poilcn 7y agoThere are safe operation extensions like "save add", "save mul" for numbers in Rust which would detect overflows, but you'd have a drawback as it won't return just the number (of type u64, for example), it would return result<u64> and you'd be forced to handle it.
- vertex-four 7y agoThere's also functions which people do use to specify specific behaviour no matter the release mode, where handling overflows properly is particularly important - e.g. cryptography-related code.
- Gibbon1 7y agoI think you can specify 'checked' in C# which will result in an exception on overflow.
- xxs 7y agoSigned numbers are preferred. Imaging you try to buy something checking if the remaining balance would be greater than zero is pretty much guaranteed, resulting in 4+ billion instead. Signed number (just 64bit) is the correct number type for such operations.
- reificator 7y agoPushing it off to the negatives does not solve the issue of overflow.
- deleted 7y ago[deleted]
- xxs 7y ago> Pushing it off to the negatives does not solve the issue of overflow. it allows for comparison with errors. Working with unsigned numbers is error prone... and I started with 6502 that didn't have signed numbers. The idea is preventing the overflow by being able to check for negatives easily. Having negative gold is likely better than leaving someone with 4billons of. For instance stuff like "max(0, balance)" just doesn't work with unsigned ones.
- dTal 7y agoIf the domain is known to be positive, you can use the sign bit as an overflow flag.
- xxs 7y agoSomething even cooler, Lineage 2 (inception times similar to wow, say 2004) had a Karma system for killing other players. Pretty much it was possible to kill anyone, without their consent outside towns. Karma required cleaning -- killing normal mobs (instead players), having karma and having unrepented sins (killed 5+ players who didn't fight back), dying - including being killed by other players resulted in gear drop. Overall it was possible to hunt such players. There was one player who managed to kill so many new players that his 32bit karma turned negative via integer overflow and he was free from all the filthy red status.