Saturday, August 4, 2012

Just published v1.1.0 of my framing protocol module for node.js. https://github.com/lleo/node-frap I rewrote the input parsing routine completely for v1.1.0. It wasn't broken before, but the current version is much cleaner/better looking code. I remove gobs of what I've come to call vomit code. All the verbosity for debugging and assert-bombing to die close to a bug (old C-coder debugging style of mine). Lots of lines-of-code reduction. Makes it easier to read casually. I implemented a lot of BDD tests, based on the mocha framework. I wrote better benchmark scrips. Better but not very good. Overall, I'd say it is more stable and healthier code than v1.0.0.

Saturday, June 23, 2012

IEEE 754 may not be such a kluge I thought it was

I just found out something elegant about double floating point numbers... or maybe this is just a Javascript thing.

function log2(v) { return Math.log(v)/Math.LN2 }
log2(Number.MAX_VALUE) //=> 1024
The Log base 2 of the Maximum double floating point number is 1024. There is something elegant about that. My respect for IEEE 754 just went up.