Friday, August 25, 2006

Gotcha!

It isn't everyday that your code exposes a bug in a C compiler, that too, one which has been around for 7.4 versions. I've been writing code that tests a computer's floating point routines for compliance with IEEE 754 with respect to NaNs, denormals and the REM operation. gcc-2.95 has been my friend on all the various archs that I've tested, except on the SGI workstations, where I'm using the vendor supplied MIPSPro v7.4 compiler.

Now consider:

number != number

What will this condition evaluate to? False always? Right? Hence the compiler simply replaces the above with False (or zero) at compile time.

Except, it gets it wrong when it does the same to float variables. You see, if the float contains a NaN, then the above test is true! NaNs do not compare equal.

Aha! Now where do I report this bug?

Some other "crazy" stuff (called constant foldings, or compile-time evaluations done by GCC):

n * 1.0 => removed, as n is not changed
n / 1.0, likewise
n * 2.0 => n + n

And all of this with optimizations disabled! Wow!

Thursday, August 24, 2006

It's Raining Unices!

In pursuit of the execution of an assignment, I met and was introduced to:

Solaris (UltraSPARC) [actually, have met this during undergrad]
HP-UX (PA-RISC)
Tru64 (Alpha)
AIX (PowerPC)
Irix (MIPS-based SGI)

All of them are old. Lack decent shells (GNU bash), some lack decent editors (Emacs), all lack good GUIs, good browsers (Netscape 4 is everywhere!), decent compilers (GCC where present is 2.95 and ye gods, even 2.8!) etc.

Fun. Me thinks.

Friday, August 18, 2006

Farewell!

So it was finally laid to rest. The 7-year old 14" monitor, the last-but-one-remnant of my first computer, is no more. May it rest in peace.

The Samsung 4Bni was a nice monitor to work with, if a bit troublesome. Within two years, it had two "crashes", which caused it to hiss in a wierd manner. Those were fixed, albeit leaving movies a bit darker, and the next 5 years were peaceful. Last December, a curious high-pitched whistle started emanating at 1024x768, dying down only when I switched to 800x600. Within a few weeks, the hisses were back.

I was reluctant to repair it, given that it had served so long, and so set out to buy a new one. Shortage of funds meant that I would have to continue working with it. Thankfully (?), RSI made me largely stop using the computer, which rendered the question of when to buy it redundant.

When I did get back to it, it seemed better, but would not start up. Eventually, I would boot blind, and it was only in the 800x600 mode that it would come on. By July-end, it had stopped doing that too. Given that I would be moving soon at that time, and then could work headlessly, the computer was operated without the monitor.

But given I'm not the only user of the computer, pressure kept mounting, until it finally resulted in this 17" Samsung 793S:

Given my experience with the 793DF (that I'm typing on, and which differs only in the dot pitch with the 793S), it looks to be a good monitor. Here's wishing it a long life.

BTW, the Linux Addict is not me.