Tuesday, January 02, 2007

Orchid blooming!

So, I was going about my own business around the house this weekend when I suddenly noticed flowers on this. I've been trying to get the darn thing to bloom for ages!!!

Thursday, November 16, 2006

And now for something completely different...

Binary Floating Point Comparisons

You never expected that on this blog, did you? :P

(Edit: yes, I'm sure I'm getting this entire discussion rather wrong, but I never claimed to be a software engineer. I just hang out around them all the time and work at a software company, that's all. :P)

The Theory

Computers don't think like you or I. We think in this nifty thing called base 10. Everything is broken down into 10s and multiples of 10s. Everything in our system counts up 0-1-2-3-4-5-6-7-8-9 and then when it hits 10 it resets back to zero again. That's why when you look at a number your math teacher talked about the "ten's place" and the "hundred's place" (remember, a hundred is just 10 x 10 after all). All of this is sensible, given that we have 10 fingers ... humans just automatically assumed 10 was the "cool" number to use as a basis for their math. But it's not necessarily the only number you can use.

You can have base 5. Or base 16. Or base 127. It doesn't matter, they're all valid. But the most interesting one for this discussion is base 2. It's what computers think in. You count 0-1 in it, and then increment. One and zeros. On and off. Black and white.

And, it turns out that if you say 1/10 (AKA 0.1) in base 10 ... a computer says 0.110011001100110011001100 11001100110011001100110011.... and repeats on to infinity. O_o Freaky, yes?

The Problem
Numbers can't be represented infinitely in a computer. So, I need to round off that big, long representation of 0.1 somewhere. 0.11001100110011001100110011001100110011 001100110011010 is how it's usually done (in double precision floating point). But notice! The last few digits aren't quite in sequence anymore!

That's because the number was rounded by the computer. And suddenly it's not quite 0.1 anymore. It's actually more like 0.10000000149 now. O_o!

The Even Bigger Problem
Imagine having a software product that was all about making comparisons between floating point numbers. ... Yeah, suddenly you have to actually care about this. >_< The Solution
if(fabs(a - b) <= epsilon * fabs(a))
or
if(fabs(a - b) <= epsilon)
where you choose epsilon to be some reasonable small number.

Meaning, check to see if the difference between the two numbers is really, really small, and if so, just act like they're equal to each other.

Sunday, November 05, 2006

Voting

So, we vote by absentee ballot. Tonight I spent some time going through the Internet, digging up information about the various local, state, and Federal races. I tend to care about voting a lot. Especially since I present what I find to Dustin and brow-beat him into voting, usually the same way I do. Nothing like getting to vote twice. ^_^

Green Elephant aftermath

This morning my project was to plant all the things I got from the Green Elephant yesterday, as well as a bunch of things I've had sitting around in pots, being neglected, for far too long.

Well, before it started raining I managed to finish half of it at least.



*tsck* That photo doesn't look very impressive, but I shall put it up anyway. Things this doesn't really show:

  • I mixed in an entire wheelbarrow load of compost before starting.

  • I terraced the ground in a series of flat spaces, which I will eventually reinforce with mini rock walls. It's the only way I can water things and not have the water run straight downhill.



Anyway, I got everything dug out, dug in, smoothed out, set up, pictures taken ... and then it started to rain. I persevered long enough to plant the few things that most definitely needed it, such as the oriental poppy I dug up just to transplant to its new location, but eventually even wool couldn't help with the uncomfortable feeling of rain splashing down the back of my neck and I hightailed it indoors. Perhaps I can finish it next weekend. I can't do anything about it during the week, because it's always dark by the time I get home from work. -_-

Saturday, November 04, 2006

Green Elephant

I went to the Green Elephant today. =D I met Karee (strawberry lady) again, as well as the nice guy that always gives out honey. =D And I intended to get rid of some plants but all I got rid of were wood hyacinth/spanish bluebell bulbs. Instead I came back with an entire trunkfull of stuff. =D

Of course, it's been raining here nonstop for days now. (Welcome to Seattle!) We were all soaked at the swap and carrying around umbrellas. And when I came home I was trying to garden with an umbrella. I gave up on that quickly and relied on my heavy, wool sweater -- I love wool -- and a water-resistant jacket.

So, while I was out trying to figure out where to put all these plants, I hauled a load of things recently killed by the frost up to the compost heap. And was ecstatic to find that the compost apparently had started ginning since we've been getting rain and I suddenly had an entire wheelbarrowful of the stuff. =D Mmmm, black gold. =D

(I'm doing a lot of =D today. I think I'm in a good mood.)

Didn't actually end up planting anything. It's too wet out; the dirt would just make clumps and dry that way. Not a good thing. So instead I potted up the bareroot stuff I got, labeled what didn't have labels -- except for this one mystery plant ... I wrote down the name I was given, but Google and my Sunset Western Garden book both have no idea what it is -- and put everything on the porch to stay wet.

I also wandered through the garden long enough to dig up my dahlias. There was a very knowledgeable woman there talking about to store and grow them, and Karee and I were both absorbing knowledge.

Oh, I guess I also dug up the elephant garlic. Damn stuff still hasn't split. Well, 3 out of 4 heads didn't split. The 4th actualy did, and it was also the one that made flowers this year. I am going to try an experiment and leave two giant bulbs in the ground over the winter and keep two inside. If the ones left outside split, that will confirm the theory that they need to chill properly in order to split.



(Picture doesn't show it well, but the head with the long stem actually does have 4 cloves. Whereas the other one is a single onion-like gigantic clove.)