[BACK]Return to strtoIdd.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / gdtoa

Annotation of src/lib/libc/gdtoa/strtoIdd.c, Revision 1.2

1.2     ! christos    1: /* $NetBSD: strtoIdd.c,v 1.1.1.1 2006/01/25 15:18:49 kleink Exp $ */
1.1       kleink      2:
                      3: /****************************************************************
                      4:
                      5: The author of this software is David M. Gay.
                      6:
                      7: Copyright (C) 1998 by Lucent Technologies
                      8: All Rights Reserved
                      9:
                     10: Permission to use, copy, modify, and distribute this software and
                     11: its documentation for any purpose and without fee is hereby
                     12: granted, provided that the above copyright notice appear in all
                     13: copies and that both that the copyright notice and this
                     14: permission notice and warranty disclaimer appear in supporting
                     15: documentation, and that the name of Lucent or any of its entities
                     16: not be used in advertising or publicity pertaining to
                     17: distribution of the software without specific, written prior
                     18: permission.
                     19:
                     20: LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
                     21: INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
                     22: IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
                     23: SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     24: WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
                     25: IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
                     26: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
                     27: THIS SOFTWARE.
                     28:
                     29: ****************************************************************/
                     30:
                     31: /* Please send bug reports to David M. Gay (dmg at acm dot org,
                     32:  * with " at " changed at "@" and " dot " changed to ".").     */
                     33:
                     34: #include "gdtoaimp.h"
                     35:
                     36:  int
                     37: #ifdef KR_headers
                     38: strtoIdd(s, sp, f0, f1) CONST char *s; char **sp; double *f0, *f1;
                     39: #else
                     40: strtoIdd(CONST char *s, char **sp, double *f0, double *f1)
                     41: #endif
                     42: {
                     43: #ifdef Sudden_Underflow
                     44:        static FPI fpi = { 106, 1-1023, 2046-1023-106+1, 1, 1 };
                     45: #else
                     46:        static FPI fpi = { 106, 1-1023-53+1, 2046-1023-106+1, 1, 0 };
                     47: #endif
                     48:        Long exp[2];
                     49:        Bigint *B[2];
                     50:        int k, rv[2];
                     51:
                     52:        B[0] = Balloc(2);
1.2     ! christos   53:        if (B[0] == NULL)
        !            54:                return STRTOG_NoMemory;
1.1       kleink     55:        B[0]->wds = 4;
                     56:        k = strtoIg(s, sp, &fpi, exp, B, rv);
1.2     ! christos   57:        if (k == STRTOG_NoMemory)
        !            58:                return k;
1.1       kleink     59:        ULtodd((ULong*)f0, B[0]->x, exp[0], rv[0]);
                     60:        Bfree(B[0]);
                     61:        if (B[1]) {
                     62:                ULtodd((ULong*)f1, B[1]->x, exp[1], rv[1]);
                     63:                Bfree(B[1]);
                     64:                }
                     65:        else {
                     66:                ((ULong*)f1)[0] = ((ULong*)f0)[0];
                     67:                ((ULong*)f1)[1] = ((ULong*)f0)[1];
                     68:                ((ULong*)f1)[2] = ((ULong*)f0)[2];
                     69:                ((ULong*)f1)[3] = ((ULong*)f0)[3];
                     70:                }
                     71:        return k;
                     72:        }

CVSweb <webmaster@jp.NetBSD.org>