~ubuntu-branches/ubuntu/saucy/nspr/saucy-updates

« back to all changes in this revision

Viewing changes to mozilla/nsprpub/pr/src/misc/dtoa.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-11-27 17:39:22 UTC
  • mfrom: (1.1.15) (27.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20121127173922-1zfbtwmy1vczqwxq
Tags: 2:4.9.3-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - rules: Enable Thumb2 build on armel, armhf.
  - control: Change Vcs-* to XS-Debian-Vcs-*.
  - control: Add conflicts to evolution-documentation-*,
    language-support-translation-*.
  - control: Add Breaks: evolution-plugins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 *      standard (and are specified to be consistent, with fesetround()
80
80
 *      affecting the value of FLT_ROUNDS), but that some (Linux) systems
81
81
 *      do not work correctly in this regard, so using fegetround() is more
82
 
 *      portable than using FLT_FOUNDS directly.
 
82
 *      portable than using FLT_ROUNDS directly.
83
83
 * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3
84
84
 *      and Honor_FLT_ROUNDS is not #defined.
85
85
 * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines
669
669
#ifdef KR_headers
670
670
        (s, nd0, nd, y9, dplen) CONST char *s; int nd0, nd, dplen; ULong y9;
671
671
#else
672
 
        (CONST char *s, int nd0, int nd, ULong y9, int dplen)
 
672
        (const char *s, int nd0, int nd, ULong y9, int dplen)
673
673
#endif
674
674
{
675
675
        Bigint *b;
1538
1538
#ifdef KR_headers
1539
1539
        (sp, t) char **sp, *t;
1540
1540
#else
1541
 
        (CONST char **sp, char *t)
 
1541
        (const char **sp, const char *t)
1542
1542
#endif
1543
1543
{
1544
1544
        int c, d;
1560
1560
#ifdef KR_headers
1561
1561
        (rvp, sp) U *rvp; CONST char **sp;
1562
1562
#else
1563
 
        (U *rvp, CONST char **sp)
 
1563
        (U *rvp, const char **sp)
1564
1564
#endif
1565
1565
{
1566
1566
        ULong c, x[2];
1633
1633
#define kshift 4
1634
1634
#define kmask 15
1635
1635
#endif
 
1636
 
 
1637
#if !defined(NO_HEX_FP) || defined(Honor_FLT_ROUNDS) /*{*/
 
1638
 static Bigint *
 
1639
#ifdef KR_headers
 
1640
increment(b) Bigint *b;
 
1641
#else
 
1642
increment(Bigint *b)
 
1643
#endif
 
1644
{
 
1645
        ULong *x, *xe;
 
1646
        Bigint *b1;
 
1647
 
 
1648
        x = b->x;
 
1649
        xe = x + b->wds;
 
1650
        do {
 
1651
                if (*x < (ULong)0xffffffffL) {
 
1652
                        ++*x;
 
1653
                        return b;
 
1654
                        }
 
1655
                *x++ = 0;
 
1656
                } while(x < xe);
 
1657
        {
 
1658
                if (b->wds >= b->maxwds) {
 
1659
                        b1 = Balloc(b->k+1);
 
1660
                        Bcopy(b1,b);
 
1661
                        Bfree(b);
 
1662
                        b = b1;
 
1663
                        }
 
1664
                b->x[b->wds++] = 1;
 
1665
                }
 
1666
        return b;
 
1667
        }
 
1668
 
 
1669
#endif /*}*/
 
1670
 
1636
1671
#ifndef NO_HEX_FP /*{*/
1637
1672
 
1638
1673
 static void
1705
1740
        Round_down = 3
1706
1741
        };
1707
1742
 
1708
 
 static Bigint *
1709
 
#ifdef KR_headers
1710
 
increment(b) Bigint *b;
1711
 
#else
1712
 
increment(Bigint *b)
1713
 
#endif
1714
 
{
1715
 
        ULong *x, *xe;
1716
 
        Bigint *b1;
1717
 
 
1718
 
        x = b->x;
1719
 
        xe = x + b->wds;
1720
 
        do {
1721
 
                if (*x < (ULong)0xffffffffL) {
1722
 
                        ++*x;
1723
 
                        return b;
1724
 
                        }
1725
 
                *x++ = 0;
1726
 
                } while(x < xe);
1727
 
        {
1728
 
                if (b->wds >= b->maxwds) {
1729
 
                        b1 = Balloc(b->k+1);
1730
 
                        Bcopy(b1,b);
1731
 
                        Bfree(b);
1732
 
                        b = b1;
1733
 
                        }
1734
 
                b->x[b->wds++] = 1;
1735
 
                }
1736
 
        return b;
1737
 
        }
1738
 
 
1739
1743
 void
1740
1744
#ifdef KR_headers
1741
1745
gethex(sp, rvp, rounding, sign)
2263
2267
        (rv, s0, bc)
2264
2268
        U *rv; CONST char *s0; BCinfo *bc;
2265
2269
#else
2266
 
        (U *rv, CONST char *s0, BCinfo *bc)
 
2270
        (U *rv, const char *s0, BCinfo *bc)
2267
2271
#endif
2268
2272
{
2269
2273
        Bigint *b, *d;
2392
2396
                b = multadd(b, 10, 0);
2393
2397
                dig = quorem(b,d);
2394
2398
                }
2395
 
        if (b->x[0] || b->wds > 1)
 
2399
        if (b->x[0] || b->wds > 1 || dig > 0)
2396
2400
                dd = -1;
2397
2401
 ret:
2398
2402
        Bfree(b);
2471
2475
#ifdef KR_headers
2472
2476
        (s00, se) CONST char *s00; char **se;
2473
2477
#else
2474
 
        (CONST char *s00, char **se)
 
2478
        (const char *s00, char **se)
2475
2479
#endif
2476
2480
{
2477
2481
        int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, e, e1;
3570
3574
#ifdef KR_headers
3571
3575
nrv_alloc(s, rve, n) char *s, **rve; int n;
3572
3576
#else
3573
 
nrv_alloc(char *s, char **rve, int n)
 
3577
nrv_alloc(const char *s, char **rve, int n)
3574
3578
#endif
3575
3579
{
3576
3580
        char *rv, *t;
3693
3697
        U d2, eps, u;
3694
3698
        double ds;
3695
3699
        char *s, *s0;
 
3700
#ifndef No_leftright
3696
3701
#ifdef IEEE_Arith
3697
3702
        U eps1;
3698
3703
#endif
 
3704
#endif
3699
3705
#ifdef SET_INEXACT
3700
3706
        int inexact, oldinexact;
3701
3707
#endif