delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/25/22:49:27

From: aho450s AT nic DOT smsu DOT edu (Tony O'Bryan)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: printf("%.6f")
Date: Sun, 26 Jan 1997 00:53:21 GMT
Organization: Southwest Missouri State University
Lines: 19
Message-ID: <32eaa9e8.7439772@ursa.smsu.edu>
References: <5cdrp8$erp AT clark DOT zippo DOT com>
NNTP-Posting-Host: huwawa.p13.smsu.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 25 Jan 1997 20:51:52 GMT, jz AT bcsupernet DOT com wrote:

>Can anyone tell me why my printf("%.6f") is running so incredibly slowly?
>I'm running gcc on a 386 with no copro if that's a clue.  The same line 
>compiled under Borland C is MUCH faster.  this is more than a pmode problem I 
>am sure. Help.  Thanks.

Is this the only line in your program?  If so, then the program compiled under
DJGPP will always run slower.  This is because DJGPP spends a lot of time in
startup code compared to a single library function like printf().

Also, the line you provided is incomplete.  printf("%.6f") is a meaningless
call.  You will need to post the code that is giving you problems.

>Does anyone have/know of a library or routine to convert from float to a 
>string which is quick?  

Look at sprintf().  It does everything printf() does, except the output is sent
to a character array (string) which is automatically null-terminated.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019