<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: Strangeness with multiplying uint64_t and doubles</title>
		<link>http://forums.leaflabs.com/topic.php?id=1019</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:17:41 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=1019" rel="self" type="application/rss+xml" />

		<item>
			<title>robodude666 on "Strangeness with multiplying uint64_t and doubles"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1019#post-6207</link>
			<pubDate>Tue, 06 Sep 2011 18:10:41 +0000</pubDate>
			<dc:creator>robodude666</dc:creator>
			<guid isPermaLink="false">6207@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Oh oh, tell us so we can all laugh - I mean, er, learn from once other's mistakes.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gruvin on "Strangeness with multiplying uint64_t and doubles"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1019#post-6205</link>
			<pubDate>Tue, 06 Sep 2011 17:34:04 +0000</pubDate>
			<dc:creator>gruvin</dc:creator>
			<guid isPermaLink="false">6205@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Interesting that it's working for others. I guess the next step will be to examine the stored data at the binary level. Sheesh.&#60;/p&#62;
&#60;p&#62;....&#60;/p&#62;
&#60;p&#62;Hmm. Red faced now, after a good night's sleep. I found the ridiculously obvious cause of the problem. Perhaps not surprisingly, it's not the compiler. Yay \o/&#60;/p&#62;
&#60;p&#62;Enuf said.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>robodude666 on "Strangeness with multiplying uint64_t and doubles"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1019#post-6201</link>
			<pubDate>Tue, 06 Sep 2011 15:06:00 +0000</pubDate>
			<dc:creator>robodude666</dc:creator>
			<guid isPermaLink="false">6201@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;&#60;code&#62;uint64_t&#60;/code&#62; is only available if you include &#60;code&#62;stdint.h&#60;/code&#62; -- without it, &#60;code&#62;uint64&#60;/code&#62; has to be used for it to compile.&#60;/p&#62;
&#60;p&#62;The code is correct in either case, and works just fine on my Maple r5. It is more likely a corrupted USB transmission than it is a bug in the compiler. Have you tried sending the values out via Serial1, Serial2, or Serial3? They seem far more reliable than SerialUSB at the moment.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>nissarup on "Strangeness with multiplying uint64_t and doubles"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1019#post-6200</link>
			<pubDate>Tue, 06 Sep 2011 12:05:57 +0000</pubDate>
			<dc:creator>nissarup</dc:creator>
			<guid isPermaLink="false">6200@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Your code will not compile using the commandline on my computer. The below code does compile and returns the correct result:&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
uint64 u64 = 100;&#60;br /&#62;
double dbl = 1000.0;&#60;br /&#62;
double result = u64 * dbl;&#60;br /&#62;
SerialUSB.print(&#34;result=&#34;);&#60;br /&#62;
SerialUSB.println(result);&#60;br /&#62;
&#60;/code&#62;&#60;br /&#62;
result=100000.00&#60;/p&#62;
&#60;p&#62;Swapping uint64 for unsigned long and unsigned long long also works as expected.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gruvin on "Strangeness with multiplying uint64_t and doubles"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1019#post-6198</link>
			<pubDate>Tue, 06 Sep 2011 06:32:38 +0000</pubDate>
			<dc:creator>gruvin</dc:creator>
			<guid isPermaLink="false">6198@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello&#60;/p&#62;
&#60;p&#62;So I've been making great progress, getting to know my new Maple mini. But now I've hit a snag with, it seems, the GCC compiler (arm-none-eabi-g++ v4.4.1) -- or something else?&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;uint64_t u64 = 100;
double dbl = 1000.0;
double result = u64 * dbl;
SerialUSB.print(&#38;quot;result=&#38;quot;); SerialUSB.println(result);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Produces ...&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;result=&#38;lt;large double&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Without going into details, I enlisted sprintf to test the value and got &#34;inf&#34; out of that, too. Yet, of course, the mathematical answer should be simply 100000.00, which is certainly the results my calculator and my test code in test.cpp on my Mac, using standard GNU g++ each give.&#60;/p&#62;
&#60;p&#62;What on Earth is going on? This looks to be a compiler bug. No?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
