dtoa.c (112158) | dtoa.c (165743) |
---|---|
1/**************************************************************** 2 3The author of this software is David M. Gay. 4 5Copyright (C) 1998, 1999 by Lucent Technologies 6All Rights Reserved 7 8Permission to use, copy, modify, and distribute this software and --- 12 unchanged lines hidden (view full) --- 21SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 22WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 23IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 24ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 25THIS SOFTWARE. 26 27****************************************************************/ 28 | 1/**************************************************************** 2 3The author of this software is David M. Gay. 4 5Copyright (C) 1998, 1999 by Lucent Technologies 6All Rights Reserved 7 8Permission to use, copy, modify, and distribute this software and --- 12 unchanged lines hidden (view full) --- 21SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 22WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 23IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 24ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 25THIS SOFTWARE. 26 27****************************************************************/ 28 |
29/* Please send bug reports to 30 David M. Gay 31 Bell Laboratories, Room 2C-463 32 600 Mountain Avenue 33 Murray Hill, NJ 07974-0636 34 U.S.A. 35 dmg@bell-labs.com 36 */ | 29/* Please send bug reports to David M. Gay (dmg at acm dot org, 30 * with " at " changed at "@" and " dot " changed to "."). */ |
37 38#include "gdtoaimp.h" 39 40/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. 41 * 42 * Inspired by "How to Print Floating-Point Numbers Accurately" by | 31 32#include "gdtoaimp.h" 33 34/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. 35 * 36 * Inspired by "How to Print Floating-Point Numbers Accurately" by |
43 * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 92-101]. | 37 * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126]. |
44 * 45 * Modifications: 46 * 1. Rather than iterating, we use a simple numeric overestimate 47 * to determine k = floor(log10(d)). We scale relevant 48 * quantities using O(log2(k)) rather than O(k) multiplications. 49 * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't 50 * try to generate digits strictly left to right. Instead, we 51 * compute with fewer bits and propagate the carry if necessary --- 708 unchanged lines hidden --- | 38 * 39 * Modifications: 40 * 1. Rather than iterating, we use a simple numeric overestimate 41 * to determine k = floor(log10(d)). We scale relevant 42 * quantities using O(log2(k)) rather than O(k) multiplications. 43 * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't 44 * try to generate digits strictly left to right. Instead, we 45 * compute with fewer bits and propagate the carry if necessary --- 708 unchanged lines hidden --- |