Questions about the BASICtools and MakeItC
Post Reply
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am


Post by YahooArchive » Sun Oct 28, 2012 7:45 pm

>The c allows for me to set a float or double data type but there does
>not seem to be any way to print them out. The conversion characters
>%f, %e or %g do not produce any errors nor do they print anything out
>in the printf command. In looking over the printf.c file, it appears
>that you have made no accomodations for decimals. Do you have such a
>file available?

Traditionally the embedded world has not used printf. The reason
being is that the printf of the gcc library was written with linux and
its environment in mind. What that means is that gcc printf brings in
a huge amount of code, that most likely is not something you really
need or expect. The first C we were using (which was mainly to
implement the BASIC) used no printf at all, and used some simple puts,
printhex and printdecimal routines that were quite small. I found the
open source printf which expanded on this, and it was not much bigger
than what we had been using.

The printf probably should add errors for format strings it can not
interpret, it hadn't been checked before.

Its possible there is a small float string conversion routine out
there, I haven't looked, the gnuarm or lpc2000 groups should probably
be queried.

printf has been expanded to support single precision floats, and it can also be called from BASIC

Post Reply