<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>(\_ -&#62; Phil Varner) &#187; puzzles</title>
	<atom:link href="http://www.philvarner.com/blog/category/puzzles/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.philvarner.com/blog</link>
	<description>mostly technical stuff</description>
	<lastBuildDate>Sat, 06 Mar 2010 18:01:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Shards in your Latte</title>
		<link>http://www.philvarner.com/blog/2008/01/20/shards-in-your-latte/</link>
		<comments>http://www.philvarner.com/blog/2008/01/20/shards-in-your-latte/#comments</comments>
		<pubDate>Sun, 20 Jan 2008 22:40:08 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[puzzles]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.philvarner.com/blog/2008/01/20/shards-in-your-latte/</guid>
		<description><![CDATA[Here are the slides from my &#034;Shards in your Latte&#034; PJUG presentation on January 15:
javasharpedges.pdf
The Josh Bloch / Bill Pugh puzzlers talk from JavaOne given at Google.  The Elvis example comes straight from here, and they do a better example of describing it than I did.
The Java Puzzlers book.
A couple of things that came [...]]]></description>
			<content:encoded><![CDATA[<p>Here are the slides from my &#034;Shards in your Latte&#034; PJUG presentation on January 15:</p>
<p><a href='http://www.philvarner.com/blog/wp-content/uploads/2008/01/javasharpedges.pdf' title='javasharpedges.pdf'>javasharpedges.pdf</a></p>
<p>The Josh Bloch / Bill Pugh <a href="http://tinyurl.com/2744gz">puzzlers talk</a> from JavaOne given at Google.  The Elvis example comes straight from here, and they do a better example of describing it than I did.</p>
<p>The <a href="http://tinyurl.com/33kyh7">Java Puzzlers book</a>.</p>
<p>A couple of things that came up at the talk:</p>
<ul>
<li>There&#039;s no version of String.replaceAll that takes a Pattern. I said I thought there was without thinking for more than a second about it.</li>
<li>Until the most recent version of Groovy, it didn&#039;t have a classical C-style &#039;for&#039; loop.  There was a lot of disagreement when I mentioned it, and I should have been more precise when I said that as to not imply that Groovy had no &#039;for&#039; loop constructs.</li>
</ul>
<p>Please add anything you think I got wrong, or anything you found interesting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.philvarner.com/blog/2008/01/20/shards-in-your-latte/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bubble, bubble, toil and Double</title>
		<link>http://www.philvarner.com/blog/2007/12/08/bubble-bubble-toil-and-double/</link>
		<comments>http://www.philvarner.com/blog/2007/12/08/bubble-bubble-toil-and-double/#comments</comments>
		<pubDate>Sat, 08 Dec 2007 18:41:37 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[puzzles]]></category>

		<guid isPermaLink="false">http://www.philvarner.com/blog/?p=26</guid>
		<description><![CDATA[Inspired by Weiqi Gao&#039;s Friday Java Quiz this week, I came up with a few more curiosities of Java double.  What do each of the calls to larger() print?  Hint: this puzzle has nothing to do with type conversion loss of precision, it is only about the specified behavior of doubles.

public class Foo [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired by Weiqi Gao&#039;s <a href="http://www.weiqigao.com/blog/2007/12/07/friday_java_quiz_know_your_java_lang_classes.html">Friday Java Quiz</a> this week, I came up with a few more curiosities of Java double.  What do each of the calls to larger() print?  Hint: this puzzle has nothing to do with type conversion loss of precision, it is only about the specified behavior of doubles.</p>
<pre>
public class Foo {
    public static void main(String[] args) {
        larger(0.0d, Double.MIN_VALUE);
        larger(1.0d, Double.MIN_VALUE*Double.MAX_VALUE);
        larger(1.0d, Double.MIN_VALUE*Double.MAX_VALUE*Double.MAX_VALUE);
        larger(1.0d/Double.MIN_VALUE, 1.0d/(1.0d/Double.MAX_VALUE));
        larger(1.0d/Double.MIN_VALUE, 1.0d/0.0d);
        larger(1.0d, Double.MIN_VALUE/Double.MIN_VALUE);
    }

    public static void larger(Double a, Double b){
        System.out.print(a + " or " + b + " ? ");
        if (a < b){
        System.out.println(b);
        } else if (a > b){
        System.out.println(a);
        } else {
        System.out.println("equal");
        }
    }
}
</pre>
<p>Highlight the hidden text below for the answers:<br />
<font color="white"><br />
0.0 or 4.9E-324 ? 4.9E-324<br />
1.0 or 8.881784197001251E-16 ? 1.0<br />
1.0 or 1.5966722476277755E293 ? 1.5966722476277755E293<br />
Infinity or Infinity ? equal<br />
Infinity or Infinity ? equal<br />
1.0 or 1.0 ? equal<br />
</font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.philvarner.com/blog/2007/12/08/bubble-bubble-toil-and-double/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
