» About     » Archive     » Submit     » Authors     » Search     » Random     » Specials     » Statistics     » Forum     » RSS Feed     Updates Daily

No. 3552: The root of the problem

First | Previous | 2019-02-08 | Next | Latest

The root of the problem

First | Previous | 2019-02-08 | Next | Latest

Permanent URL: https://mezzacotta.net/garfield/?comic=3552

Strip by: Levellass

3802124083.2858277830327062577414

The author writes:

One question that has yet to be answered on this site is what exactly the square root of minus Garfield actually is. Initially this might seem like a non sequitur; 'Garfield' is a string of letters, not a number. But, it doesn't take much to develop a logically coherent system for determining this.

Firstly we encode the text string 'Garfield' as ASCII. This will convert it from text to a string of hexadecimal numbers: 47 61 72 66 69 65 6C 64. If we simply run this all together we get the hexadecimal number $4761726669656C64 or 5'143'518'033'614'302'308.

'But wait!' you may object. 'If we make that number negative, then, when we take the (principal) square root, we get an imaginary number with an irrational coefficient!' And you would be correct, that's a very messy thing to have. But this is why we chose hexadecimal ASCII as our system! In hex, or more specifically in computing, it's possible for numbers to come in two types, signed and unsigned.

Consider a single byte with possible values of 00-FF. If the byte is unsigned then these values, represented as base ten integers, range from 0-255. BUT if the byte is signed then the values it can have range from -128 to 127. How do we represent negative numbers? Well, while 1 is $01, -1 is $FF. $02/$FE, $03/$FD and so on. To get a negative value, simply subtract that value from 256. A bit odd, but let's roll with it.

Now 'Garfield' just so happens to be an 8-byte string. To make it negative under this system we merely need to subtract its hex value from $10000000000000000. This gives us the hex value $C89E8D99969A939C which, if we interpret it as an unsigned base ten integer, is 14'456'147'544'702'096'284 or about 14 quadrillion.

The square root of this is positive, but irrational; 3'802'124'083.285... or about 3 billion. Can we do better than this mess? Well yes we can! 3'802'124'083.28582778303 squared gives us a value that rounds up to minus Garfield.

But we can take this further: in computing there's something called 'IEEE-754 Floating Point'. This is how computers store numbers as a string of 32 bits (4 bytes).

The value of a IEEE-754 number is computed as:

sign 2exponent mantissa

The sign is stored in bit 32. The exponent can be computed from bits 24-31 by subtracting 127. The mantissa (also known as significand or fraction) is stored in bits 1-23. An invisible leading bit (i.e. it is not actually stored) with value 1.0 is placed in front, then bit 23 has a value of 1/2, bit 22 has value 1/4 etc. As a result, the mantissa has a value between 1.0 and 2. If the exponent reaches -127 (binary 00000000), the leading 1 is no longer used to enable gradual underflow. If you didn't understand a word in this paragraph, ignore it. This has gone on long enough as it is.

The final result of this is that the decimal value 1331863503 (binary 01001111011000101001111111001111) represents root -Garfield in Floating Point. Well... not quite. It turns out that a lot of values CAN'T be represented this way and this is one of them. The actual value stored is 3802124032 which is significantly different from the decimal value we calculated. Still, that's the best that 32 bit computing can offer.

So there we have it, the true value of the square root of minus Garfield at last. I should also note that this submission was designed to be the smallest submission in terms of area, side lengths and file size in an attempt to break my own laziness record. Sadly the thinking that went into its construction may have sabotaged this.