Timestamp:
Apr 27, 2004, 8:39:34 PM (22 years ago)
Author:
bird
Message:

GCC v3.3.3 sources.

Location:
branches/GNU/src/gcc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/gcc

    • Property svn:ignore
      •  

        old new  
        2626configure.vr
        2727configure.vrs
         28
        2829Makefile
        29 dir.info
        3030lost+found
        3131update.out
  • branches/GNU/src/gcc/libjava/java/math/BigDecimal.java

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r1390 r1391  
    179179    if (point < len)
    180180      {
    181         int exp = Integer.parseInt (num.substring (point + 1));
    182         exp -= scale;
    183         if (exp > 0)
     181        point++;
     182        if (num.charAt(point) == '+')
     183          point++;
     184
     185        if (point >= len )
     186          throw new NumberFormatException ("no exponent following e or E");
     187       
     188        try
    184189          {
    185             intVal = intVal.multiply (BigInteger.valueOf (10).pow (exp));
    186             scale = 0;
     190            int exp = Integer.parseInt (num.substring (point));
     191            exp -= scale;
     192            if (signum () == 0)
     193              scale = 0;
     194            else if (exp > 0)
     195              {
     196                intVal = intVal.multiply (BigInteger.valueOf (10).pow (exp));
     197                scale = 0;
     198              }
     199            else
     200              scale = - exp;
    187201          }
    188         else
    189           scale = - exp;
     202        catch (NumberFormatException ex)
     203          {
     204            throw new NumberFormatException ("malformed exponent");
     205          }
    190206      }
    191207  }
     
    199215    throws NumberFormatException
    200216  {
    201     if (scale == 0)
     217    if ()
    202218      switch ((int) val)
    203219        {
     
    253269
    254270    if (intVal.signum () == 0)  // handle special case of 0.0/0.0
    255       return ZERO;
     271      return ;
    256272   
    257273    // Ensure that pow gets a non-negative value.
     
    416432  }
    417433 
     434
     435
     436
     437
     438
    418439  public BigDecimal abs ()
    419440  {
     
    432453      return bigStr;
    433454
    434     int point = bigStr.length() - scale;
    435455    boolean negative = (bigStr.charAt(0) == '-');
    436     StringBuffer sb = new StringBuffer(bigStr.length() + 1 +
    437                                        (point <= 0 ? -point+1 : 0));
    438     if (negative)
    439       sb.append('-');
    440     while (point <= 0)
    441       {
    442         sb.append('0');
    443         point++;
    444       }
    445     sb.append(bigStr.substring(negative ? 1 : 0));
    446     sb.insert(point, '.');
     456
     457    int point = bigStr.length() - scale - (negative ? 1 : 0);
     458
     459    StringBuffer sb = new StringBuffer(bigStr.length() + 2 +
     460                                       (point <= 0 ? (-point + 1) : 0));
     461    if (point <= 0)
     462      {
     463        if (negative)
     464          sb.append('-');
     465        sb.append('0').append('.');
     466        while (point < 0)
     467          {
     468            sb.append('0');
     469            point++;
     470          }
     471        sb.append(bigStr.substring(negative ? 1 : 0));
     472      }
     473    else
     474      {
     475        sb.append(bigStr);
     476        sb.insert(point + (negative ? 1 : 0), '.');
     477      }
    447478    return sb.toString();
    448479  }
Note: See TracChangeset for help on using the changeset viewer.