[comp.sources.wanted] wanted - float to ascii - "ftoa

mjr@mimsy.umd.edu (Marcus J. Ranum) (12/26/89)

	I'm looking for a small and simple "ftoa()" routine - doesn't
need lots of formatting options - just has to take a float and return
a pointer to a string. I'd rather not hack it out of the various
_doprint() implementations that are floating around, if someone has
already done it.

mjr.
-- 
	He was in his room half awake, half asleep. The walls of the room
seemed to alter angles, elongating and shrinking alternately, then twisting
around completely so that he was in the opposite side of the room.
	"A trick of the light and too much caffeine," he thought.    -Bauhaus

bill@twwells.com (T. William Wells) (12/27/89)

In article <21435@mimsy.umd.edu> mjr@mimsy.umd.edu (Marcus J. Ranum) writes:
:       I'm looking for a small and simple "ftoa()" routine - doesn't
: need lots of formatting options - just has to take a float and return
: a pointer to a string. I'd rather not hack it out of the various
: _doprint() implementations that are floating around, if someone has
: already done it.

	void
	ftoa(buf, v)
	char    *buf;
	double  v;
	{
		sprintf(buf, "%g", v);
	}

Small and simple enough?

---
Bill                    { uunet | novavax | ankh | sunvice } !twwells!bill
bill@twwells.com

mjr@mimsy.umd.edu (Marcus J. Ranum) (12/27/89)

In article <1989Dec27.063527.5866@twwells.com> bill@twwells.com (T. William Wells) writes:
>		sprintf(buf, "%g", v);
>Small and simple enough?

	Everyone's a f***ing wit, aren't they ? I got 5 mail messages with
the same suggestion - you can all pat yourselves on the back, now. :-)
For various reasons too long to go into, _doprint() is not the way I want
to do this.

mjr.
-- 
	He was in his room half awake, half asleep. The walls of the room
seemed to alter angles, elongating and shrinking alternately, then twisting
around completely so that he was in the opposite side of the room.
	"A trick of the light and too much caffeine," he thought.    -Bauhaus