You're viewing a comment by Eric TF Bat and its responses.
You're viewing a comment by Eric TF Bat and its responses.
I am being sponsored by Syntress! They bought me an amazing dedicated server to run catonmat on. If you're looking web services, I highly recommend the Syntress guys!
I am being sponsored by A-Writer! If you ever need help with essay writing, look no further than A-Writer! They will help you with your writing in as quickly as 3 hours!
I love to read science books. They make my day and I get ideas for awesome blog posts, such as Busy Beaver, On Functors, Recursive Regular Expressions and many others.
Take a look at my
Amazon wish list, if you're curious about what I have planned reading next, and want to surprise me. :)
If you are interested in advertising on catonmat.net, contact me.
Free tools for coding on Vietstarsoft.com.
Programming homework help.


I couldn't figure out the inchworm-on-a-stick either (I learned Forth in my free time during university and got a High Distinction in Discrete Mathematics 1 because it enabled me to grok how stuff like two's complement arithmetic works). But the trick is that it's not the same as $x-- or --$x or $x-1: it's much weirder than that. Take a look at the output from this:
foreach my $x ((1,2,3,-1,-2,-3,0,1.5,2.5,3.1,4.9)) { printf qq/%+2.2f %+25.2f\n/, $x, ~-$x; } +1.00 +0.00 +2.00 +1.00 +3.00 +2.00 -1.00 +18446744073709551616.00 -2.00 +18446744073709551616.00 -3.00 +18446744073709551616.00 +0.00 +18446744073709551616.00 +1.50 +0.00 +2.50 +1.00 +3.10 +2.00 +4.90 +3.00Very odd indeed, especially when you replace the second %...f with %d, and then you get this:
What I don't know is what good it would be. I mean, if $x is non-negative, then it's the same as int($x)-1, but the weird result for negative $x confuses me...
Reply To This Comment