<?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; User Favorites: alduxvm</title>
		<link><a href='http://forums.leaflabs.com/profile.php?id=394'>394</a></link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:19:51 +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?profile=394" rel="self" type="application/rss+xml" />

		<item>
			<title>snigelen on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3759</link>
			<pubDate>Sun, 27 Feb 2011 03:06:15 +0000</pubDate>
			<dc:creator>snigelen</dc:creator>
			<guid isPermaLink="false">3759@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I'm glad you got it to work, and sorry for the false information.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>alduxvm on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3758</link>
			<pubDate>Sun, 27 Feb 2011 02:03:45 +0000</pubDate>
			<dc:creator>alduxvm</dc:creator>
			<guid isPermaLink="false">3758@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Its working!!!!&#60;/p&#62;
&#60;p&#62;i found the issue...&#60;/p&#62;
&#60;p&#62;i had the libraries in these position:&#60;/p&#62;
&#60;p&#62;#include &#38;lt;Servo.h&#38;gt;&#60;br /&#62;
#include &#34;contexto.h&#34;&#60;br /&#62;
#include &#38;lt;stdlib.h&#38;gt;&#60;/p&#62;
&#60;p&#62;and when compiling, always get that error...&#60;/p&#62;
&#60;p&#62;i change stdlib to the upper position, and it worked...&#60;/p&#62;
&#60;p&#62;#include &#38;lt;stdlib.h&#38;gt;&#60;br /&#62;
#include &#38;lt;Servo.h&#38;gt;&#60;br /&#62;
#include &#34;contexto.h&#34;&#60;/p&#62;
&#60;p&#62;thanks a lot for the help!!&#60;/p&#62;
&#60;p&#62;maple rocks!!!!!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3757</link>
			<pubDate>Sun, 27 Feb 2011 01:53:11 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">3757@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Ok, we looked into it, and it's a bug in wirish_math.h (where we mimic the Arduino behavior by providing abs as a macro, instead of using math.h's version, which is a function).&#60;/p&#62;
&#60;p&#62;newlib's stdlib.h seems to rely on abs being a function; since it's not, you get the compile error you posted.&#60;/p&#62;
&#60;p&#62;We'll fix this in the next release.  For now, does the implementation from snigelen work for you?&#60;/p&#62;
&#60;p&#62;Bugtracker reference: &#60;a href=&#34;http://code.google.com/p/leaflabs/issues/detail?id=57&#34; rel=&#34;nofollow&#34;&#62;http://code.google.com/p/leaflabs/issues/detail?id=57&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3756</link>
			<pubDate>Sun, 27 Feb 2011 01:41:37 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">3756@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Can you maybe post your sketch in a pastebin?&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://pastebin.com&#34; rel=&#34;nofollow&#34;&#62;http://pastebin.com&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>alduxvm on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3755</link>
			<pubDate>Sat, 26 Feb 2011 23:45:57 +0000</pubDate>
			<dc:creator>alduxvm</dc:creator>
			<guid isPermaLink="false">3755@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I have already test it, is my ide bad?? hehehehe, i #include &#38;lt;stdlib.h&#38;gt; , use the function, and when i compile, i get this errors:&#60;/p&#62;
&#60;p&#62;Going to build using 'armcompiler' (ARM)&#60;br /&#62;
	Compiling core...&#60;br /&#62;
	Compiling libraries: Servo&#60;br /&#62;
	Compiling the sketch...&#60;/p&#62;
&#60;p&#62;/Applications/MapleIDE.app/Contents/Resources/Java/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/stdlib.h:72: error: expected unqualified-id before 'int'&#60;/p&#62;
&#60;p&#62;/Applications/MapleIDE.app/Contents/Resources/Java/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/stdlib.h:72: error: expected ')' before 'int'&#60;/p&#62;
&#60;p&#62;/Applications/MapleIDE.app/Contents/Resources/Java/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/stdlib.h:72: error: expected ')' before 'int'&#60;/p&#62;
&#60;p&#62;/Applications/MapleIDE.app/Contents/Resources/Java/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/stdlib.h:72: error: expected ')' before 'int'&#60;/p&#62;
&#60;p&#62;What could it be???
&#60;/p&#62;</description>
		</item>
		<item>
			<title>perry on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3752</link>
			<pubDate>Sat, 26 Feb 2011 20:29:23 +0000</pubDate>
			<dc:creator>perry</dc:creator>
			<guid isPermaLink="false">3752@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;We link against newlib (a small libc variant), so atof should be available. #include &#38;lt;stdlib.h&#38;gt; should be enough.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3751</link>
			<pubDate>Sat, 26 Feb 2011 19:46:38 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">3751@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I should add atof is deprecated, and strtof/d/ld are the recommended way to do this type of conversion.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3749</link>
			<pubDate>Sat, 26 Feb 2011 17:37:34 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">3749@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;When I &#60;code&#62;#include &#38;lt;stdlib.h&#38;gt;&#60;/code&#62; both &#60;code&#62;atof(buf)&#60;/code&#62; and &#60;code&#62;strtof(buf, NULL)&#60;/code&#62; seem to exist.&#60;br /&#62;
I've compiled, uploaded, seen a print statement (so the program is running), but not tested.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>alduxvm on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3748</link>
			<pubDate>Sat, 26 Feb 2011 15:50:10 +0000</pubDate>
			<dc:creator>alduxvm</dc:creator>
			<guid isPermaLink="false">3748@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Very strange...&#60;/p&#62;
&#60;p&#62;i compile it, i upload it, but the D1 led starts to blink in a odd way, i never seen this... and of course, its not doing anything, what can it be???
&#60;/p&#62;</description>
		</item>
		<item>
			<title>snigelen on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3747</link>
			<pubDate>Sat, 26 Feb 2011 14:47:31 +0000</pubDate>
			<dc:creator>snigelen</dc:creator>
			<guid isPermaLink="false">3747@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Sorry, I forgot to add&#60;br /&#62;
&#60;code&#62;#include &#38;lt;ctype.h&#38;gt;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;(and to remove the unused variable dp)&#60;/p&#62;
&#60;p&#62;And to reset negative to zero if there's an exponent. Here's an updated version that also handles a leading '+'.&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;#include &#38;lt;ctype.h&#38;gt;

float my_atof(char *s)
{
	float f = 0.0, fd = 0.0, d = 0.0;
	int fe = 0;
	char negative = 0;

	while (isspace(*s) &#38;amp;&#38;amp; *s != 0)
		s++;

	if (*s == &#38;#39;+&#38;#39;)
		s++;

	if (*s == &#38;#39;-&#38;#39;) {
		s++;
		negative = 1;
	}

	while (isdigit(*s) &#38;amp;&#38;amp; *s != 0) {
		f  *= 10;
		f += (*s - &#38;#39;0&#38;#39;);
		s++;
	}

	// Decimals
	if (*s == &#38;#39;.&#38;#39;) {
		s++;
		d = 1.0;
		while (isdigit(*s) &#38;amp;&#38;amp; *s != 0) {
			fd *= 10;
			d *= 10;
			fd += (*s - &#38;#39;0&#38;#39;);
			s++;
		}
		fd /= d;
	}

	f += fd;
	if (negative)
		f = -f;

	// Exponent
	if (*s == &#38;#39;e&#38;#39; &#124;&#124; *s == &#38;#39;E&#38;#39;) {
		s++;
		negative = 0;
		if (*s == &#38;#39;+&#38;#39;) {
			s++;
		} else if (*s == &#38;#39;-&#38;#39;) {
			s++;
			negative = 1;
		}
		while (isdigit(*s) &#38;amp;&#38;amp; *s != 0 ) {
			fe  *= 10;
			fe += (*s - &#38;#39;0&#38;#39;);
			s++;
		}
		if (negative)
			fe = -fe;
#if 1
		f *= pow(10,fe);
#else
		// A better way for this?
		for (; fe; fe--)
			if (negative)
				f /= 10;
			else
				f *= 10;
#endif
	}

	return f;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>alduxvm on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3746</link>
			<pubDate>Sat, 26 Feb 2011 14:27:08 +0000</pubDate>
			<dc:creator>alduxvm</dc:creator>
			<guid isPermaLink="false">3746@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks!!&#60;/p&#62;
&#60;p&#62;Im testing it...&#60;/p&#62;
&#60;p&#62;do you have the isspace() and isdigit() functions???&#60;/p&#62;
&#60;p&#62;10x!!!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>snigelen on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3745</link>
			<pubDate>Sat, 26 Feb 2011 13:45:45 +0000</pubDate>
			<dc:creator>snigelen</dc:creator>
			<guid isPermaLink="false">3745@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;There's no atof, but it can be done (some way I don't remember exactly how). But I wrote a quick and dirty (no fancy stuff) atof a couple of days ago. Here it is&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;float my_atof(char *s)
{
        float f = 0.0, fd = 0.0, d = 0.0;
        int fe = 0;
        char negative = 0, dp = 0;
        while (isspace(*s) &#38;amp;&#38;amp; *s != 0)
                s++;

        if (*s == &#38;#39;-&#38;#39;) {
                s++;
                negative = 1;
        }

        while (isdigit(*s) &#38;amp;&#38;amp; *s != 0 ) {
                f  *= 10;
                f += (*s - &#38;#39;0&#38;#39;);
                s++;
        }

        // Decimals
        if (*s == &#38;#39;.&#38;#39;) {
                s++;
                d = 1.0;
                while (isdigit(*s) &#38;amp;&#38;amp; *s != 0 ) {
                        fd *= 10;
                        d *= 10;
                        fd += (*s - &#38;#39;0&#38;#39;);
                        s++;
                }
                fd /= d;
        }

        f += fd;
        if (negative)
                f = -f;

        // Exponent
        if (*s == &#38;#39;e&#38;#39; &#124;&#124; *s == &#38;#39;E&#38;#39;) {
                s++;
                if (*s == &#38;#39;+&#38;#39;) {

                        s++;
                        negative = 0;
                } else if (*s == &#38;#39;-&#38;#39;) {
                        s++;
                        negative = 1;
                }
                while (isdigit(*s) &#38;amp;&#38;amp; *s != 0 ) {
                        fe  *= 10;
                        fe += (*s - &#38;#39;0&#38;#39;);
                        s++;
                }
#if 1
                if (negative)
                        fe = -fe;
                f *= pow(10,fe);
#else
                // A better way for this?
                for (; fe; fe--)
                        if (negative)
                                f /= 10;
                        else
                                f *= 10;
#endif

        }

        return f;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Not very well tested, but it seems to work for me (reading a couple of multimeters over rs232).&#60;/p&#62;
&#60;p&#62;(Changed all &#34;*s != tick backslash zero tick&#34; to &#34;*s != 0&#34;)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>alduxvm on "atof or strtod???"</title>
			<link>http://forums.leaflabs.com/topic.php?id=663#post-3744</link>
			<pubDate>Sat, 26 Feb 2011 11:14:44 +0000</pubDate>
			<dc:creator>alduxvm</dc:creator>
			<guid isPermaLink="false">3744@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi!!&#60;/p&#62;
&#60;p&#62;Im reading serial data that comes from a imu (razor 9dof, with a atmega onboard) when i read it, i store it in a char array, and in arduino, i just simply use atof, and it will be a floating variable, but, there is no atof define in the maple ide, right?? &#60;/p&#62;
&#60;p&#62;thanks!!&#60;/p&#62;
&#60;p&#62;cheers!!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
