[PATCH] Clean up comment for mp_no

Andreas Jaeger aj@suse.com
Fri Jan 4 10:04:00 GMT 2013


On 01/04/2013 07:11 AM, Siddhesh Poyarekar wrote:
> Hi,
>
> I'm starting to clean up code formatting of the key files in mp code.
> I'll be following up with patches to reformat mpa.h and mpa.c, but
> first I figured that the code comment could do with a bit of love.
> I've rewritten the comment to make it more readable (it is to me, I
> hope it is for everyone else ;)).  Looks OK?
>
>
> Siddhesh
>
>
> 	* sysdeps/ieee754/dbl-64/mpa.h: Clean up comment for MP_NO.
>
>
> diff --git a/sysdeps/ieee754/dbl-64/mpa.h b/sysdeps/ieee754/dbl-64/mpa.h
> index dfd56ef..ad67c55 100644
> --- a/sysdeps/ieee754/dbl-64/mpa.h
> +++ b/sysdeps/ieee754/dbl-64/mpa.h
> @@ -39,18 +39,32 @@
>   /************************************************************************/
>
>
> -typedef struct {/* This structure holds the details of a multi-precision     */
> -  int e;        /* floating point number, x: d[0] holds its sign (-1,0 or 1) */
> -  double d[40]; /* e holds its exponent (...,-2,-1,0,1,2,...) and            */
> -} mp_no;        /* d[1]...d[p] hold its mantissa digits. The value of x is,  */
> -		/* x = d[1]*r**(e-1) + d[2]*r**(e-2) + ... + d[p]*r**(e-p).  */
> -		/* Here   r = 2**24,   0 <= d[i] < r  and  1 <= p <= 32.     */
> -		/* p is a global variable. A multi-precision number is       */
> -		/* always normalized. Namely, d[1] > 0. An exception is      */
> -		/* a zero which is characterized by d[0] = 0. The terms      */
> -		/* d[p+1], d[p+2], ... of a none zero number have no         */
> -		/* significance and so are the terms e, d[1],d[2],...        */
> -		/* of a zero.                                                */
> +/* The mp_no structure holds the details of a multi-precision floating point
> +   number.
> +
> +   - The radix of the number (R) is 2 ^ 24.
> +
> +   - E: The exponent of the number.
> +
> +   - D[0]: The sign (-1, 1) or 0 if the value is 0.  In the latter case, the
> +     values of the remaining members of the structure are ignored.
> +
> +   - D[1] - D[p]: The mantissa of the number where:
> +
> +	0 <= D[i] < R and
> +	P is the precision of the number and 1 <= p <= 32
> +
> +     D[p+1] ... D[39] have no significance.
> +
> +   - The value of the number is:
> +
> +	D[1] * R ^ (E - 1) + D[2] * R ^ (E - 2) ... D[p] * R ^ (E - p)
> +
> +   */
> +typedef struct {
> +  int e;
> +  double d[40];
> +} mp_no;
>
>   typedef union { int i[2]; double d; } number;
>
>

Thanks, looks fine,
Andreas
-- 
  Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
   SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
    GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
     GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126



More information about the Libc-alpha mailing list