comparison lib/vasnprintf.c @ 15958:ed8603738240

vasnprintf: Fix comments. * lib/vasnprintf.c (decode_long_double, decode_double): Fix comments.
author Bruno Haible <bruno@clisp.org>
date Sat, 15 Oct 2011 12:13:07 +0200
parents 588ed4cdea87
children a18c505b7981
comparison
equal deleted inserted replaced
15957:ba6107133e6e 15958:ed8603738240
883 return NULL; 883 return NULL;
884 /* Split into exponential part and mantissa. */ 884 /* Split into exponential part and mantissa. */
885 y = frexpl (x, &exp); 885 y = frexpl (x, &exp);
886 if (!(y >= 0.0L && y < 1.0L)) 886 if (!(y >= 0.0L && y < 1.0L))
887 abort (); 887 abort ();
888 /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * LDBL_MANT_BIT), and the 888 /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * 2^LDBL_MANT_BIT), and the
889 latter is an integer. */ 889 latter is an integer. */
890 /* Convert the mantissa (y * LDBL_MANT_BIT) to a sequence of limbs. 890 /* Convert the mantissa (y * 2^LDBL_MANT_BIT) to a sequence of limbs.
891 I'm not sure whether it's safe to cast a 'long double' value between 891 I'm not sure whether it's safe to cast a 'long double' value between
892 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only 892 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
893 'long double' values between 0 and 2^16 (to 'unsigned int' or 'int', 893 'long double' values between 0 and 2^16 (to 'unsigned int' or 'int',
894 doesn't matter). */ 894 doesn't matter). */
895 # if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0 895 # if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0
971 return NULL; 971 return NULL;
972 /* Split into exponential part and mantissa. */ 972 /* Split into exponential part and mantissa. */
973 y = frexp (x, &exp); 973 y = frexp (x, &exp);
974 if (!(y >= 0.0 && y < 1.0)) 974 if (!(y >= 0.0 && y < 1.0))
975 abort (); 975 abort ();
976 /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * DBL_MANT_BIT), and the 976 /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * 2^DBL_MANT_BIT), and the
977 latter is an integer. */ 977 latter is an integer. */
978 /* Convert the mantissa (y * DBL_MANT_BIT) to a sequence of limbs. 978 /* Convert the mantissa (y * 2^DBL_MANT_BIT) to a sequence of limbs.
979 I'm not sure whether it's safe to cast a 'double' value between 979 I'm not sure whether it's safe to cast a 'double' value between
980 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only 980 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
981 'double' values between 0 and 2^16 (to 'unsigned int' or 'int', 981 'double' values between 0 and 2^16 (to 'unsigned int' or 'int',
982 doesn't matter). */ 982 doesn't matter). */
983 # if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0 983 # if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0