Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!udel!rochester!pt.cs.cmu.edu!o.gp.cs.cmu.edu!andrew.cmu.edu!rg2c+ From: rg2c+@andrew.cmu.edu (Robert Nelson Gasch) Newsgroups: comp.lang.c Subject: Efficient way to transform float to string Message-ID: Date: 7 Dec 90 06:14:25 GMT Organization: Class of '91, Carnegie Mellon, Pittsburgh, PA Lines: 14 Hi, I'm looking for an *efficient* algorithm to transform a float (10< f < 0) into a string. What I am doing right no is this: I get the first digit and put the appropriate number in array[0]. Array[1] gets the decimal point. I then make f < 1 and multiply it times 10, and get the aproriate character for the first digit and repeat this procedure until the number equals 0. Sounds OK, but when you do this alot, it's pretty damn slow. If anybody has any suggestions on how to do this faster, please let me know. Both actual code or algorithm descriptions are welcome. Thanx alot --> Rob