| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 return Decimal(EncodedData(sign, EncodedData::ClassInfinity)); | 895 return Decimal(EncodedData(sign, EncodedData::ClassInfinity)); |
| 896 } | 896 } |
| 897 | 897 |
| 898 Decimal Decimal::nan() | 898 Decimal Decimal::nan() |
| 899 { | 899 { |
| 900 return Decimal(EncodedData(Positive, EncodedData::ClassNaN)); | 900 return Decimal(EncodedData(Positive, EncodedData::ClassNaN)); |
| 901 } | 901 } |
| 902 | 902 |
| 903 Decimal Decimal::remainder(const Decimal& rhs) const | 903 Decimal Decimal::remainder(const Decimal& rhs) const |
| 904 { | 904 { |
| 905 const Decimal quotient = (*this / rhs).round(); | 905 const Decimal quotient = *this / rhs; |
| 906 return quotient.isSpecial() ? quotient : *this - quotient * rhs; | 906 return quotient.isSpecial() ? quotient : *this - (quotient.isNegative() ? qu
otient.ceiling() : quotient.floor()) * rhs; |
| 907 } | 907 } |
| 908 | 908 |
| 909 Decimal Decimal::round() const | 909 Decimal Decimal::round() const |
| 910 { | 910 { |
| 911 if (isSpecial()) | 911 if (isSpecial()) |
| 912 return *this; | 912 return *this; |
| 913 | 913 |
| 914 if (exponent() >= 0) | 914 if (exponent() >= 0) |
| 915 return *this; | 915 return *this; |
| 916 | 916 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 } | 1025 } |
| 1026 return builder.toString(); | 1026 return builder.toString(); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 Decimal Decimal::zero(Sign sign) | 1029 Decimal Decimal::zero(Sign sign) |
| 1030 { | 1030 { |
| 1031 return Decimal(EncodedData(sign, EncodedData::ClassZero)); | 1031 return Decimal(EncodedData(sign, EncodedData::ClassZero)); |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 } // namespace WebCore | 1034 } // namespace WebCore |
| OLD | NEW |