[plt-scheme] off (plt) topic (short koan in .c language and a question)

From: vladimir (vladimir at ok2home.net)
Date: Fri May 7 11:01:14 EDT 2010

Hello Andrew,

> I'm not sure I get it (as a koan).

Obviously not, because you already understand it ;-).

But some people (even good .c programmers who do mainly
higher level stuff as opposed to flipping voltages by
writing binary numbers to particular addresses) have hard time
to understand that:

1. let's have a |chunk of computer memory - e.g. 4 bytes|
2. initialise the above to e.g. integer 4444444
3. read the above as integer (one gets some number printed)
4. read the above as float (one gets potentially another number printed)
... read the above as set of characters
... other options

(basically on x86/64 the binary representation for float and integer
differ, so reading 4 bytes as ineger and then the same 4 bytes as
float will potentially display a different number).

but other interesting point is that math (as a science of patterns and
linguistic abstraction) is in the brain of the beholder and one person's
noise can be others persons signal (and one person's integer other
persons float)...

> even without pointers, allocation or dubious-looking type casts:

but none of that type casts should give any warning in decent .c
compiler (on arch where size of integer equals the size of float in

> Yes, you'll get a different answer on machines with different
> floating point representations, like Vaxes.

the 2 numbers printed (by both of our programs) are not the same on the
screen, even when initialised to the same binary pattern to start
with (kind of "what the ...?" for high level .c programmer who does not
understand the low level).

> http://xkcd.com/710/

Thank you very much, exactly what I was looking for.

(b.t.w my first name is Vladimir, but I know that having a surname
which is actually a first name in german: "hmm, what is he

Kind regards Vladimir

Posted on the users mailing list.