Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygengcvt.c
Go to the documentation of this file.
00001 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ 00002 #include <precomp.h> 00003 00004 /* 00005 * @implemented 00006 */ 00007 char * 00008 _gcvt (double value, int ndigits, char *buf) 00009 { 00010 char *p = buf; 00011 00012 sprintf (buf, "%-#.*g", ndigits, value); 00013 00014 /* It seems they expect us to return .XXXX instead of 0.XXXX */ 00015 if (*p == '-') 00016 p++; 00017 if (*p == '0' && p[1] == '.') 00018 memmove (p, p + 1, strlen (p + 1) + 1); 00019 00020 /* They want Xe-YY, not X.e-YY, and XXXX instead of XXXX. */ 00021 p = strchr (buf, 'e'); 00022 if (!p) 00023 { 00024 p = buf + strlen (buf); 00025 /* They don't want trailing zeroes. */ 00026 while (p[-1] == '0' && p > buf + 2) 00027 *--p = '\0'; 00028 } 00029 if (p > buf && p[-1] == '.') 00030 memmove (p - 1, p, strlen (p) + 1); 00031 return buf; 00032 } Generated on Sun May 27 2012 04:36:37 for ReactOS by
1.7.6.1
|