delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/08/26/10:05:08

Date: Wed 26 Aug 92 09:56:35
From: ronis AT ronis DOT chem DOT mcgill DOT ca (David M. Ronis)
To: buers AT dg1 DOT chemie DOT uni-konstanz DOT de (Dieter Buerssner)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Bug & fix in %g format

Deiter Buerssner has informed me that my patch to doprnt.c should
have been made using a context diff.  The results f 

diff -c doprnt.old doprnt.new 


follows.  Sorry for any inconvenience.

David Ronis

===========================Cut Here===================================
*** doprnt.old	Wed Aug 26 08:46:50 1992
--- doprnt.c	Mon Aug 24 17:41:04 1992
***************
*** 598,618 ****
  		else
  			dotrim = 0;
  		/* if requires more precision and some fraction left */
! 		if (fract) {
! 			if (prec) {
! 				do {
  					fract = modf(fract * 10, &tmp);
  					*t++ = tochar((int)tmp);
! 				} while(!tmp);
! 				while (--prec && fract) {
! 					fract = modf(fract * 10, &tmp);
! 					*t++ = tochar((int)tmp);
  				}
- 			}
  			if (fract)
  				startp = round(fract, (int *)NULL, startp,
  				    t - 1, (char)0, signp);
- 		}
  		/* alternate format, adds 0's for precision, else trim 0's */
  		if (flags&ALT)
  			for (; prec--; *t++ = '0');
--- 598,611 ----
  		else
  			dotrim = 0;
  		/* if requires more precision and some fraction left */
! 				while (prec && fract) {
  					fract = modf(fract * 10, &tmp);
  					*t++ = tochar((int)tmp);
! 					prec--;
  				}
  			if (fract)
  				startp = round(fract, (int *)NULL, startp,
  				    t - 1, (char)0, signp);
  		/* alternate format, adds 0's for precision, else trim 0's */
  		if (flags&ALT)
  			for (; prec--; *t++ = '0');
===========================CUT HERE===================================



- Raw text -


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