Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!pluto.hemel.bull.co.uk!peterh From: peterh@hemel.bull.co.uk (Peter Holditch) Newsgroups: comp.lang.c Subject: Re: Efficient way to transform float to string Message-ID: <1990Dec7.130640.9639@hemel.bull.co.uk> Date: 7 Dec 90 13:06:40 GMT References: Sender: @hemel.bull.co.uk Organization: Bull HN UK Lines: 39 Nntp-Posting-Host: brno rg2c+@andrew.cmu.edu (Robert Nelson Gasch) writes: >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: > [ Stuff Deleted ] >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 It may be that you don't consider it efficient enough, but why not just use char fltno[12]; ... sprintf (fltno,"%10f",your_float); That's what I'd do anyway. Peter Holditch. -- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # From: Peter.Holditch@hemel.bull.co.uk # # Tel: 0442-232222x4826 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # << If I said it, it was nobody else but me. >>