0001: /* Licensed to the Apache Software Foundation (ASF) under one or more
0002: * contributor license agreements. See the NOTICE file distributed with
0003: * this work for additional information regarding copyright ownership.
0004: * The ASF licenses this file to You under the Apache License, Version 2.0
0005: * (the "License"); you may not use this file except in compliance with
0006: * the License. You may obtain a copy of the License at
0007: *
0008: * http://www.apache.org/licenses/LICENSE-2.0
0009: *
0010: * Unless required by applicable law or agreed to in writing, software
0011: * distributed under the License is distributed on an "AS IS" BASIS,
0012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013: * See the License for the specific language governing permissions and
0014: * limitations under the License.
0015: */
0016:
0017: package org.apache.harmony.luni.tests.java.lang;
0018:
0019: import java.util.Locale;
0020:
0021: import junit.framework.TestCase;
0022:
0023: public class DoubleTest extends TestCase {
0024: private static final long rawBitsFor3_4en324ToN1[] = { 0x1L, 0x7L,
0025: 0x45L, 0x2b0L, 0x1ae2L, 0x10cd1L, 0xa8028L, 0x69018dL,
0026: 0x41a0f7eL, 0x29049aedL, 0x19a2e0d44L, 0x1005cc84acL,
0027: 0xa039fd2ebdL, 0x64243e3d361L, 0x3e96a6e641c6L,
0028: 0x271e284fe91b8L, 0x1872d931f1b131L, 0x4e8f8f7e6e1d7dL,
0029: 0x8319b9af04d26eL, 0xb7e0281ac6070aL, 0xedd832217788ccL,
0030: 0x122a71f54eab580L, 0x15750e72a2562e0L, 0x18d2520f4aebb98L,
0031: 0x1c2373498ed353fL, 0x1f6c501bf28828eL, 0x22c76422ef2a332L,
0032: 0x261c9e95d57a5ffL, 0x2963c63b4ad8f7fL, 0x2cbcb7ca1d8f35fL,
0033: 0x3015f2de527981bL, 0x335b6f95e717e22L, 0x36b24b7b60dddabL,
0034: 0x3a0f6f2d1c8aa8bL, 0x3d534af863ad52dL, 0x40a81db67c98a79L,
0035: 0x440912920ddf68bL, 0x474b5736915742eL, 0x4a9e2d0435ad13aL,
0036: 0x4e02dc22a18c2c4L, 0x5143932b49ef375L, 0x549477f61c6b052L,
0037: 0x57f995f3a385c67L, 0x5b3bfdb846339c0L, 0x5e8afd2657c0830L,
0038: 0x61edbc6fedb0a3dL, 0x653495c5f48e666L, 0x6881bb3771b1fffL,
0039: 0x6be22a054e1e7ffL, 0x6f2d5a4350d30ffL, 0x7278b0d42507d3fL,
0040: 0x75d6dd092e49c8fL, 0x79264a25bcee1daL, 0x7c6fdcaf2c29a50L,
0041: 0x7fcbd3daf7340e4L, 0x831f6468da8088eL, 0x86673d831120ab2L,
0042: 0x89c10ce3d568d5fL, 0x8d18a80e656185bL, 0x905ed211feb9e72L,
0043: 0x93b686967e6860eL, 0x9712141e0f013c9L, 0x9a56992592c18bbL,
0044: 0x9dac3f6ef771eeaL, 0xa10ba7a55aa7352L, 0xa44e918eb151027L,
0045: 0xa7a235f25da5430L, 0xab0561b77a8749eL, 0xae46ba2559291c6L,
0046: 0xb19868aeaf73637L, 0xb4fe82da5b503c5L, 0xb83f11c8791225bL,
0047: 0xbb8ed63a9756af2L, 0xbef28bc93d2c5afL, 0xc237975dc63bb8dL,
0048: 0xc5857d3537caa70L, 0xc8e6dc8285bd50cL, 0xcc3049d19396528L,
0049: 0xcf7c5c45f87be72L, 0xd2db7357769ae0eL, 0xd6292816aa20cc9L,
0050: 0xd973721c54a8ffbL, 0xdcd04ea369d33faL, 0xe0223126222407cL,
0051: 0xe36abd6faaad09bL, 0xe6c56ccb95584c2L, 0xea1b63ff3d572f9L,
0052: 0xed623cff0cacfb8L, 0xf0bacc3ecfd83a5L, 0xf414bfa741e7247L,
0053: 0xf759ef911260ed9L, 0xfab06b7556f9290L, 0xfe0e4329565bb9aL,
0054: 0x10151d3f3abf2a80L, 0x104a648f096ef520L,
0055: 0x10807ed965e55934L, 0x10b49e8fbf5eaf81L,
0056: 0x10e9c633af365b61L, 0x11201be04d81f91dL,
0057: 0x115422d860e27764L, 0x11892b8e791b153dL,
0058: 0x11bf76721761da8cL, 0x11f3aa074e9d2898L,
0059: 0x12289489224472beL, 0x125eb9ab6ad58f6dL,
0060: 0x1293340b22c579a4L, 0x12c8010deb76d80dL,
0061: 0x12fe015166548e11L, 0x1332c0d2dff4d8caL,
0062: 0x1367710797f20efdL, 0x139d4d497dee92bcL,
0063: 0x13d2504deeb51bb6L, 0x1406e4616a6262a3L,
0064: 0x143c9d79c4fafb4cL, 0x1471e26c1b1cdd0fL,
0065: 0x14a65b0721e41453L, 0x14dbf1c8ea5d1968L,
0066: 0x1511771d927a2fe1L, 0x1545d4e4f718bbd9L,
0067: 0x157b4a1e34deead0L, 0x15b10e52e10b52c2L,
0068: 0x15e551e7994e2772L, 0x161aa6617fa1b14fL,
0069: 0x1650a7fcefc50ed1L, 0x1684d1fc2bb65286L,
0070: 0x16ba067b36a3e727L, 0x16f0440d02267078L,
0071: 0x1724551042b00c96L, 0x17596a54535c0fbcL,
0072: 0x178fc4e9683313abL, 0x17c3db11e11fec4bL,
0073: 0x17f8d1d65967e75eL, 0x182f064befc1e135L,
0074: 0x186363ef75d92cc1L, 0x18983ceb534f77f1L,
0075: 0x18ce4c26282355eeL, 0x1902ef97d91615b5L,
0076: 0x1937ab7dcf5b9b22L, 0x196d965d433281eaL,
0077: 0x19a27dfa49ff9132L, 0x19d71d78dc7f757fL,
0078: 0x1a0ce4d7139f52dfL, 0x1a420f066c4393cbL,
0079: 0x1a7692c8075478beL, 0x1aac377a092996edL,
0080: 0x1ae1a2ac45b9fe54L, 0x1b160b5757287de9L,
0081: 0x1b4b8e2d2cf29d64L, 0x1b8138dc3c17a25eL,
0082: 0x1bb587134b1d8af6L, 0x1beae8d81de4edb4L,
0083: 0x1c20d18712af1490L, 0x1c5505e8d75ad9b4L,
0084: 0x1c8a47630d319021L, 0x1cc06c9de83efa15L,
0085: 0x1cf487c5624eb89aL, 0x1d29a9b6bae266c1L,
0086: 0x1d600a1234cd8038L, 0x1d940c96c200e046L,
0087: 0x1dc90fbc72811858L, 0x1dff53ab8f215e6eL,
0088: 0x1e33944b3974db05L, 0x1e68795e07d211c6L,
0089: 0x1e9e97b589c69637L, 0x1ed31ed1761c1de3L,
0090: 0x1f07e685d3a3255bL, 0x1f3de027488beeb2L,
0091: 0x1f72ac188d57752fL, 0x1fa7571eb0ad527bL,
0092: 0x1fdd2ce65cd8a71aL, 0x20123c0ffa076870L,
0093: 0x2046cb13f889428cL, 0x207c7dd8f6ab932fL,
0094: 0x20b1cea79a2b3bfeL, 0x20e6425180b60afdL,
0095: 0x211bd2e5e0e38dbcL, 0x215163cfac8e3896L,
0096: 0x2185bcc397b1c6bbL, 0x21bb2bf47d9e386aL,
0097: 0x21f0fb78ce82e342L, 0x22253a5702239c13L,
0098: 0x225a88ecc2ac8317L, 0x22909593f9abd1efL,
0099: 0x22c4baf8f816c66aL, 0x22f9e9b7361c7805L,
0100: 0x2330321281d1cb03L, 0x23643e9722463dc4L,
0101: 0x23994e3cead7cd35L, 0x23cfa1cc258dc082L,
0102: 0x2403c51f97789851L, 0x2438b6677d56be65L,
0103: 0x246ee4015cac6dffL, 0x24a34e80d9ebc4bfL,
0104: 0x24d822211066b5efL, 0x250e2aa95480636bL,
0105: 0x2542daa9d4d03e23L, 0x257791544a044dabL,
0106: 0x25ad75a95c856116L, 0x25e26989d9d35caeL,
0107: 0x261703ec504833d9L, 0x264cc4e7645a40d0L,
0108: 0x2681fb109eb86882L, 0x26b679d4c66682a2L,
0109: 0x26ec1849f800234bL, 0x27218f2e3b00160fL,
0110: 0x2755f2f9c9c01b93L, 0x278b6fb83c302277L,
0111: 0x27c125d3259e158bL, 0x27f56f47ef059aedL,
0112: 0x282acb19eac701a8L, 0x2860bef032bc6109L,
0113: 0x2894eeac3f6b794cL, 0x28ca2a574f46579eL,
0114: 0x29005a76918bf6c3L, 0x2934711435eef474L,
0115: 0x29698d59436ab191L, 0x299ff0af94455df5L,
0116: 0x29d3f66dbcab5ab9L, 0x2a08f4092bd63167L,
0117: 0x2a3f310b76cbbdc1L, 0x2a737ea72a3f5699L,
0118: 0x2aa85e50f4cf2c3fL, 0x2ade75e53202f74fL,
0119: 0x2b1309af3f41da91L, 0x2b47cc1b0f125135L,
0120: 0x2b7dbf21d2d6e583L, 0x2bb2977523c64f72L,
0121: 0x2be73d526cb7e34eL, 0x2c1d0ca707e5dc22L,
0122: 0x2c5227e864efa995L, 0x2c86b1e27e2b93faL,
0123: 0x2cbc5e5b1db678f9L, 0x2cf1baf8f2920b9cL,
0124: 0x2d2629b72f368e83L, 0x2d5bb424fb043223L,
0125: 0x2d9150971ce29f56L, 0x2dc5a4bce41b472bL,
0126: 0x2dfb0dec1d2218f6L, 0x2e30e8b392354f9aL,
0127: 0x2e6522e076c2a380L, 0x2e9a6b9894734c61L,
0128: 0x2ed0833f5cc80fbcL, 0x2f04a40f33fa13abL,
0129: 0x2f39cd1300f89896L, 0x2f70202be09b5f5eL,
0130: 0x2fa42836d8c23735L, 0x2fd932448ef2c503L,
0131: 0x300f7ed5b2af7643L, 0x3043af458fada9eaL,
0132: 0x30789b16f3991465L, 0x30aec1dcb07f597eL,
0133: 0x30e33929ee4f97efL, 0x3118077469e37deaL,
0134: 0x314e0951845c5d65L, 0x3182c5d2f2b9ba5fL,
0135: 0x31b77747af6828f7L, 0x31ed55199b423335L,
0136: 0x3222553001096001L, 0x3256ea7c014bb801L,
0137: 0x328ca51b019ea601L, 0x32c1e730e10327c1L,
0138: 0x32f660fd1943f1b1L, 0x332bf93c5f94ee1dL,
0139: 0x33617bc5bbbd14d2L, 0x3395dab72aac5a07L,
0140: 0x33cb5164f5577089L, 0x340112df1956a655L,
0141: 0x34355796dfac4febL, 0x346aad7c979763e5L,
0142: 0x34a0ac6ddebe9e6fL, 0x34d4d789566e460bL,
0143: 0x350a0d6bac09d78eL, 0x354048634b8626b9L,
0144: 0x35745a7c1e67b067L, 0x35a9711b26019c81L,
0145: 0x35dfcd61ef8203a1L, 0x3613e05d35b14245L,
0146: 0x3648d874831d92d6L, 0x367f0e91a3e4f78bL,
0147: 0x36b3691b066f1ab7L, 0x36e84361c80ae165L,
0148: 0x371e543a3a0d99beL, 0x3752f4a464488017L,
0149: 0x3787b1cd7d5aa01cL, 0x37bd9e40dcb14823L,
0150: 0x37f282e889eecd16L, 0x382723a2ac6a805cL,
0151: 0x385cec8b57852073L, 0x389213d716b33448L,
0152: 0x38c698ccdc60015aL, 0x38fc3f00137801b0L,
0153: 0x3931a7600c2b010eL, 0x396611380f35c151L,
0154: 0x399b9586130331a6L, 0x39d13d73cbe1ff08L,
0155: 0x3a058cd0beda7ec9L, 0x3a3af004ee911e7cL,
0156: 0x3a70d603151ab30dL, 0x3aa50b83da615fd1L,
0157: 0x3ada4e64d0f9b7c5L, 0x3b1070ff029c12dbL,
0158: 0x3b448d3ec3431792L, 0x3b79b08e7413dd76L,
0159: 0x3bb00e59088c6a6aL, 0x3be411ef4aaf8504L,
0160: 0x3c19166b1d5b6646L, 0x3c4f5c05e4b23fd7L,
0161: 0x3c839983aeef67e6L, 0x3cb87fe49aab41e0L,
0162: 0x3cee9fddc1561258L, 0x3d2323ea98d5cb77L,
0163: 0x3d57ece53f0b3e55L, 0x3d8de81e8ece0deaL,
0164: 0x3dc2b1131940c8b2L, 0x3df75d57df90fadfL,
0165: 0x3e2d34add7753996L, 0x3e6240eca6a943feL,
0166: 0x3e96d127d05394fdL, 0x3ecc8571c4687a3dL,
0167: 0x3f01d3671ac14c66L, 0x3f364840e1719f80L,
0168: 0x3f6bda5119ce075fL, 0x3fa16872b020c49cL,
0169: 0x3fd5c28f5c28f5c3L, 0x400B333333333333L };
0170:
0171: private static final long rawBitsFor1_2e0To309[] = {
0172: 0x3ff3333333333333L, 0x4028000000000000L,
0173: 0x405e000000000000L, 0x4092c00000000000L,
0174: 0x40c7700000000000L, 0x40fd4c0000000000L,
0175: 0x41324f8000000000L, 0x4166e36000000000L,
0176: 0x419c9c3800000000L, 0x41d1e1a300000000L,
0177: 0x42065a0bc0000000L, 0x423bf08eb0000000L,
0178: 0x427176592e000000L, 0x42a5d3ef79800000L,
0179: 0x42db48eb57e00000L, 0x43110d9316ec0000L,
0180: 0x434550f7dca70000L, 0x437aa535d3d0c000L,
0181: 0x43b0a741a4627800L, 0x43e4d1120d7b1600L,
0182: 0x441a055690d9db80L, 0x445043561a882930L,
0183: 0x4484542ba12a337cL, 0x44b969368974c05bL,
0184: 0x44efc3842bd1f072L, 0x4523da329b633647L,
0185: 0x4558d0bf423c03d9L, 0x458f04ef12cb04cfL,
0186: 0x45c363156bbee301L, 0x45f83bdac6ae9bc2L,
0187: 0x462e4ad1785a42b2L, 0x4662eec2eb3869afL,
0188: 0x4697aa73a606841bL, 0x46cd95108f882522L,
0189: 0x47027d2a59b51735L, 0x47371c74f0225d03L,
0190: 0x476ce3922c2af443L, 0x47a20e3b5b9ad8aaL,
0191: 0x47d691ca32818ed5L, 0x480c363cbf21f28aL,
0192: 0x4841a1e5f7753796L, 0x48760a5f7552857cL,
0193: 0x48ab8cf752a726daL, 0x48e1381a93a87849L,
0194: 0x491586213892965bL, 0x494ae7a986b73bf1L,
0195: 0x4980d0c9f4328577L, 0x49b504fc713f26d5L,
0196: 0x49ea463b8d8ef08aL, 0x4a206be538795656L,
0197: 0x4a5486de8697abecL, 0x4a89a896283d96e6L,
0198: 0x4ac0095dd9267e50L, 0x4af40bb54f701de4L,
0199: 0x4b290ea2a34c255dL, 0x4b5f524b4c1f2eb4L,
0200: 0x4b93936f0f937d31L, 0x4bc8784ad3785c7dL,
0201: 0x4bfe965d8856739cL, 0x4c331dfa75360842L,
0202: 0x4c67e57912838a52L, 0x4c9dded757246ce6L,
0203: 0x4cd2ab469676c410L, 0x4d0756183c147514L,
0204: 0x4d3d2b9e4b199259L, 0x4d723b42eeeffb78L,
0205: 0x4da6ca13aaabfa56L, 0x4ddc7c989556f8ebL,
0206: 0x4e11cddf5d565b93L, 0x4e46415734abf278L,
0207: 0x4e7bd1ad01d6ef15L, 0x4eb1630c2126556dL,
0208: 0x4ee5bbcf296feac9L, 0x4f1b2ac2f3cbe57bL,
0209: 0x4f50fab9d85f6f6dL, 0x4f8539684e774b48L,
0210: 0x4fba87c262151e1aL, 0x4ff094d97d4d32d0L,
0211: 0x5024ba0fdca07f84L, 0x5059e893d3c89f65L,
0212: 0x5090315c645d639fL, 0x50c43db37d74bc87L,
0213: 0x50f94d205cd1eba9L, 0x512fa06874066693L,
0214: 0x5163c4414884001cL, 0x5198b5519aa50023L,
0215: 0x51cee2a6014e402cL, 0x52034da7c0d0e81bL,
0216: 0x52382111b1052222L, 0x526e29561d466aabL,
0217: 0x52a2d9d5d24c02abL, 0x52d7904b46df0355L,
0218: 0x530d745e1896c42bL, 0x534268bacf5e3a9bL,
0219: 0x537702e98335c941L, 0x53acc3a3e4033b92L,
0220: 0x53e1fa466e82053bL, 0x541678d80a22868aL,
0221: 0x544c170e0cab282cL, 0x54818e68c7eaf91cL,
0222: 0x54b5f202f9e5b763L, 0x54eb6e83b85f253bL,
0223: 0x55212512533b7745L, 0x55556e56e80a5516L,
0224: 0x558ac9eca20cea5cL, 0x55c0be33e5481279L,
0225: 0x55f4edc0de9a1718L, 0x562a293116409cdeL,
0226: 0x566059beade8620bL, 0x5694702e59627a8dL,
0227: 0x56c98c39efbb1931L, 0x56ffef486ba9df7dL,
0228: 0x5733f58d434a2baeL, 0x5768f2f0941cb699L,
0229: 0x579f2facb923e440L, 0x57d37dcbf3b66ea8L,
0230: 0x58085d3ef0a40a52L, 0x583e748eaccd0ce6L,
0231: 0x587308d92c002810L, 0x58a7cb0f77003214L,
0232: 0x58ddbdd354c03e99L, 0x591296a414f82720L,
0233: 0x59473c4d1a3630e8L, 0x597d0b6060c3bd21L,
0234: 0x59b2271c3c7a5635L, 0x59e6b0e34b98ebc2L,
0235: 0x5a1c5d1c1e7f26b3L, 0x5a51ba31930f7830L,
0236: 0x5a8628bdf7d3563cL, 0x5abbb2ed75c82bcaL,
0237: 0x5af14fd4699d1b5fL, 0x5b25a3c984046236L,
0238: 0x5b5b0cbbe5057ac4L, 0x5b90e7f56f236cbaL,
0239: 0x5bc521f2caec47e9L, 0x5bfa6a6f7da759e3L,
0240: 0x5c308285ae88982eL, 0x5c64a3271a2abe39L,
0241: 0x5c99cbf0e0b56dc8L, 0x5cd01f768c71649dL,
0242: 0x5d0427542f8dbdc4L, 0x5d3931293b712d35L,
0243: 0x5d6f7d738a4d7882L, 0x5da3ae6836706b51L,
0244: 0x5dd89a02440c8626L, 0x5e0ec082d50fa7afL,
0245: 0x5e433851c529c8ceL, 0x5e78066636743b01L,
0246: 0x5eae07ffc41149c1L, 0x5ee2c4ffda8ace19L,
0247: 0x5f17763fd12d819fL, 0x5f4d53cfc578e207L,
0248: 0x5f825461db6b8d44L, 0x5fb6e97a52467095L,
0249: 0x5feca3d8e6d80cbbL, 0x6021e667904707f5L,
0250: 0x605660017458c9f2L, 0x608bf801d16efc6eL,
0251: 0x60c17b0122e55dc5L, 0x60f5d9c16b9eb536L,
0252: 0x612b5031c6866284L, 0x6161121f1c13fd92L,
0253: 0x619556a6e318fcf7L, 0x61caac509bdf3c34L,
0254: 0x6200abb2616b85a1L, 0x6234d69ef9c66709L,
0255: 0x626a0c46b83800cbL, 0x62a047ac3323007fL,
0256: 0x62d459973febc09fL, 0x63096ffd0fe6b0c6L,
0257: 0x633fcbfc53e05cf8L, 0x6373df7db46c3a1bL,
0258: 0x63a8d75d218748a2L, 0x63df0d3469e91acaL,
0259: 0x64136840c231b0beL, 0x64484250f2be1ceeL,
0260: 0x647e52e52f6da42aL, 0x64b2f3cf3da4869aL,
0261: 0x64e7b0c30d0da840L, 0x651d9cf3d0511251L,
0262: 0x655282186232ab72L, 0x6587229e7abf564fL,
0263: 0x65bceb46196f2be3L, 0x65f2130bcfe57b6eL,
0264: 0x662697cec3deda49L, 0x665c3dc274d690dbL,
0265: 0x6691a69989061a89L, 0x66c6103feb47a12bL,
0266: 0x66fb944fe6198976L, 0x67313cb1efcff5eaL,
0267: 0x67658bde6bc3f364L, 0x679aeed606b4f03dL,
0268: 0x67d0d545c4311626L, 0x68050a97353d5bb0L,
0269: 0x683a4d3d028cb29cL, 0x687070462197efa2L,
0270: 0x68a48c57a9fdeb8aL, 0x68d9af6d947d666cL,
0271: 0x69100da47cce6004L, 0x6944110d9c01f805L,
0272: 0x6979155103027606L, 0x69af5aa543c31387L,
0273: 0x69e398a74a59ec35L, 0x6a187ed11cf06742L,
0274: 0x6a4e9e85642c8112L, 0x6a8323135e9bd0abL,
0275: 0x6ab7ebd83642c4d6L, 0x6aede6ce43d3760cL,
0276: 0x6b22b040ea6429c7L, 0x6b575c5124fd3439L,
0277: 0x6b8d33656e3c8147L, 0x6bc2401f64e5d0cdL,
0278: 0x6bf6d0273e1f4500L, 0x6c2c84310da71640L,
0279: 0x6c61d29ea8886de8L, 0x6c96474652aa8962L,
0280: 0x6ccbd917e7552bbaL, 0x6d0167aef0953b54L,
0281: 0x6d35c19aacba8a29L, 0x6d6b320157e92cb4L,
0282: 0x6da0ff40d6f1bbf0L, 0x6dd53f110cae2aedL,
0283: 0x6e0a8ed54fd9b5a8L, 0x6e40994551e81189L,
0284: 0x6e74bf96a66215ebL, 0x6ea9ef7c4ffa9b66L,
0285: 0x6ee035adb1fca120L, 0x6f1443191e7bc967L,
0286: 0x6f4953df661abbc1L, 0x6f7fa8d73fa16ab2L,
0287: 0x6fb3c98687c4e2afL, 0x6fe8bbe829b61b5bL,
0288: 0x701eeae23423a232L, 0x705352cd6096455fL,
0289: 0x70882780b8bbd6b7L, 0x70be3160e6eacc64L,
0290: 0x70f2dedc9052bfbfL, 0x71279693b4676faeL,
0291: 0x715d7c38a1814b9aL, 0x71926da364f0cf40L,
0292: 0x71c7090c3e2d0310L, 0x71fccb4f4db843d4L,
0293: 0x7231ff1190932a65L, 0x72667ed5f4b7f4feL,
0294: 0x729c1e8b71e5f23dL, 0x72d19317272fb766L,
0295: 0x7305f7dcf0fba540L, 0x733b75d42d3a8e90L,
0296: 0x737129a49c44991aL, 0x73a5740dc355bf60L,
0297: 0x73dad111342b2f39L, 0x7410c2aac09afd83L,
0298: 0x7444f35570c1bce4L, 0x747a302accf22c1dL,
0299: 0x74b05e1ac0175b92L, 0x74e475a1701d3277L,
0300: 0x75199309cc247f15L, 0x754ff7cc3f2d9edaL,
0301: 0x7583fadfa77c8348L, 0x75b8f997915ba41aL,
0302: 0x75ef37fd75b28d21L, 0x762382fe698f9834L,
0303: 0x765863be03f37e41L, 0x768e7cad84f05dd2L,
0304: 0x76c30dec73163aa3L, 0x76f7d1678fdbc94cL,
0305: 0x772dc5c173d2bb9fL, 0x77629b98e863b543L,
0306: 0x7797427f227ca294L, 0x77cd131eeb1bcb39L,
0307: 0x78022bf352f15f04L, 0x7836b6f027adb6c5L,
0308: 0x786c64ac31992476L, 0x78a1beeb9effb6caL,
0309: 0x78d62ea686bfa47cL, 0x790bba50286f8d9bL,
0310: 0x794154721945b881L, 0x7975a98e9f9726a1L,
0311: 0x79ab13f2477cf049L, 0x79e0ec776cae162eL,
0312: 0x7a15279547d99bb9L, 0x7a4a717a99d002a8L,
0313: 0x7a8086eca02201a9L, 0x7ab4a8a7c82a8213L,
0314: 0x7ae9d2d1ba352298L, 0x7b2023c31461359fL,
0315: 0x7b542cb3d9798307L, 0x7b8937e0cfd7e3c8L,
0316: 0x7bbf85d903cddcbaL, 0x7bf3b3a7a260a9f4L,
0317: 0x7c28a0918af8d472L, 0x7c5ec8b5edb7098eL,
0318: 0x7c933d71b49265f9L, 0x7cc80cce21b6ff77L,
0319: 0x7cfe1001aa24bf55L, 0x7d32ca010a56f795L,
0320: 0x7d677c814cecb57aL, 0x7d9d5ba1a027e2d9L,
0321: 0x7dd259450418edc7L, 0x7e06ef96451f2939L,
0322: 0x7e3cab7bd666f388L, 0x7e71eb2d66005835L,
0323: 0x7ea665f8bf806e42L, 0x7edbff76ef6089d2L,
0324: 0x7f117faa559c5623L, 0x7f45df94eb036bacL,
0325: 0x7f7b577a25c44697L, 0x7fb116ac579aac1fL,
0326: 0x7fe55c576d815726L, 0x7ff0000000000000L };
0327:
0328: private void doTestCompareRawBits(String originalDoubleString,
0329: long expectedRawBits, String expectedString) {
0330: double result;
0331: long rawBits;
0332: String convertedString;
0333: result = Double.parseDouble(originalDoubleString);
0334: rawBits = Double.doubleToLongBits(result);
0335: convertedString = new Double(result).toString();
0336: assertEquals(expectedRawBits, rawBits);
0337: assertEquals(expectedString.toLowerCase(Locale.US),
0338: convertedString.toLowerCase(Locale.US));
0339: }
0340:
0341: private void test_toString(double dd, String answer) {
0342: assertEquals(answer, Double.toString(dd));
0343: Double d = new Double(dd);
0344: assertEquals(answer, Double.toString(d.doubleValue()));
0345: assertEquals(answer, d.toString());
0346: }
0347:
0348: /**
0349: * @tests java.lang.Double#Double(double)
0350: */
0351: public void test_ConstructorD() {
0352: Double d = new Double(39089.88888888888888888888888888888888);
0353: assertEquals("Created incorrect double",
0354: 39089.88888888888888888888888888888888,
0355: d.doubleValue(), 0D);
0356: }
0357:
0358: /**
0359: * @tests java.lang.Double#Double(java.lang.String)
0360: */
0361: public void test_ConstructorLjava_lang_String() {
0362: Double d = new Double("39089.88888888888888888888888888888888");
0363: assertEquals("Created incorrect double",
0364: 39089.88888888888888888888888888888888,
0365: d.doubleValue(), 0D);
0366:
0367: // REGRESSION for HARMONY-489
0368: try {
0369: d = new Double("1E+-20");
0370: fail("new Double(\"1E+-20\") should throw exception");
0371: } catch (NumberFormatException e) {
0372: // expected
0373: }
0374: }
0375:
0376: /**
0377: * @tests java.lang.Double#byteValue()
0378: */
0379: public void test_byteValue() {
0380: Double d = new Double(1923311.47712);
0381: assertEquals("Returned incorrect byte value", (byte) -17, d
0382: .byteValue());
0383: }
0384:
0385: /**
0386: * @tests java.lang.Double#compareTo(java.lang.Double)
0387: * @tests java.lang.Double#compare(double, double)
0388: */
0389: public void test_compare() {
0390: double[] values = new double[] { Double.NEGATIVE_INFINITY,
0391: -Double.MAX_VALUE, -2d, -Double.MIN_VALUE, -0d, 0d,
0392: Double.MIN_VALUE, 2d, Double.MAX_VALUE,
0393: Double.POSITIVE_INFINITY, Double.NaN };
0394: for (int i = 0; i < values.length; i++) {
0395: double d1 = values[i];
0396: assertTrue("compare() should be equal: " + d1, Double
0397: .compare(d1, d1) == 0);
0398: Double D1 = new Double(d1);
0399: assertTrue("compareTo() should be equal: " + d1, D1
0400: .compareTo(D1) == 0);
0401: for (int j = i + 1; j < values.length; j++) {
0402: double d2 = values[j];
0403: assertTrue("compare() " + d1 + " should be less " + d2,
0404: Double.compare(d1, d2) == -1);
0405: assertTrue("compare() " + d2 + " should be greater "
0406: + d1, Double.compare(d2, d1) == 1);
0407: Double D2 = new Double(d2);
0408: assertTrue("compareTo() " + d1 + " should be less "
0409: + d2, D1.compareTo(D2) == -1);
0410: assertTrue("compareTo() " + d2 + " should be greater "
0411: + d1, D2.compareTo(D1) == 1);
0412: }
0413: }
0414:
0415: try {
0416: new Double(0.0D).compareTo(null);
0417: fail("No NPE");
0418: } catch (NullPointerException e) {
0419: }
0420: }
0421:
0422: /**
0423: * @tests java.lang.Double#doubleToLongBits(double)
0424: */
0425: public void test_doubleToLongBitsD() {
0426: // Test for method long java.lang.Double.doubleToLongBits(double)
0427: Double d = new Double(Double.MAX_VALUE);
0428: long lbits = Double.doubleToLongBits(d.doubleValue());
0429: double r = Double.longBitsToDouble(lbits);
0430:
0431: assertTrue("Bit conversion failed", d.doubleValue() == r);
0432: }
0433:
0434: /**
0435: * @tests java.lang.Double#doubleToRawLongBits(double)
0436: */
0437: public void test_doubleToRawLongBitsD() {
0438: long l = 0x7ff80000000004d2L;
0439: double d = Double.longBitsToDouble(l);
0440: assertTrue("Wrong raw bits", Double.doubleToRawLongBits(d) == l);
0441: }
0442:
0443: /**
0444: * @tests java.lang.Double#doubleValue()
0445: */
0446: public void test_doubleValue() {
0447: assertEquals("Incorrect double value returned",
0448: 999999999999999.9999999999999, new Double(
0449: 999999999999999.9999999999999).doubleValue(),
0450: 0D);
0451: }
0452:
0453: /**
0454: * @tests java.lang.Double#floatValue()
0455: */
0456: public void test_floatValue() {
0457: // Test for method float java.lang.Double.floatValue()
0458: assertTrue(
0459: "Incorrect float value returned ",
0460: Math.abs(new Double(999999999999999.9999999999999d)
0461: .floatValue() - 999999999999999.9999999999999f) < 1);
0462: }
0463:
0464: /**
0465: * @tests java.lang.Double#hashCode()
0466: */
0467: public void test_hashCode() {
0468: // Test for method int java.lang.Double.hashCode()
0469: for (int i = -1000; i < 1000; i++) {
0470: Double d = new Double(i);
0471: Double dd = new Double(i);
0472: assertTrue("Should not be identical ", d != dd);
0473: assertTrue("Should be equals 1 ", d.equals(dd));
0474: assertTrue("Should be equals 2 ", dd.equals(d));
0475: assertTrue("Should have identical values ", dd
0476: .doubleValue() == d.doubleValue());
0477: assertTrue(
0478: "Invalid hash for equal but not identical doubles ",
0479: d.hashCode() == dd.hashCode());
0480: }
0481: assertEquals("Magic assumption hasCode (0.0) = 0 failed", 0,
0482: new Double(0.0).hashCode());
0483: }
0484:
0485: /**
0486: * @tests java.lang.Double#intValue()
0487: */
0488: public void test_intValue() {
0489: // Test for method int java.lang.Double.intValue()
0490: Double d = new Double(1923311.47712);
0491: assertEquals("Returned incorrect int value", 1923311, d
0492: .intValue());
0493: }
0494:
0495: /**
0496: * @tests java.lang.Double#isInfinite()
0497: */
0498: public void test_isInfinite() {
0499: // Test for method boolean java.lang.Double.isInfinite()
0500: assertTrue("NEGATIVE_INFINITY returned false", new Double(
0501: Double.NEGATIVE_INFINITY).isInfinite());
0502: assertTrue("POSITIVE_INFINITY returned false", new Double(
0503: Double.POSITIVE_INFINITY).isInfinite());
0504: assertTrue("Non infinite number returned true", !(new Double(
0505: 1000).isInfinite()));
0506: }
0507:
0508: /**
0509: * @tests java.lang.Double#isInfinite(double)
0510: */
0511: public void test_isInfiniteD() {
0512: // Test for method boolean java.lang.Double.isInfinite(double)
0513: assertTrue("Infinity check failed", Double
0514: .isInfinite(Double.NEGATIVE_INFINITY)
0515: && (Double.isInfinite(Double.POSITIVE_INFINITY))
0516: && !(Double.isInfinite(Double.MAX_VALUE)));
0517: }
0518:
0519: /**
0520: * @tests java.lang.Double#isNaN()
0521: */
0522: public void test_isNaN() {
0523: // Test for method boolean java.lang.Double.isNaN()
0524: Double d = new Double(0.0 / 0.0);
0525: assertTrue("NAN returned false", d.isNaN());
0526: d = new Double(0);
0527: assertTrue("Non NAN returned true", !d.isNaN());
0528: }
0529:
0530: /**
0531: * @tests java.lang.Double#isNaN(double)
0532: */
0533: public void test_isNaND() {
0534: // Test for method boolean java.lang.Double.isNaN(double)
0535:
0536: Double d = new Double(0.0 / 0.0);
0537: assertTrue("NAN check failed", Double.isNaN(d.doubleValue()));
0538: }
0539:
0540: /**
0541: * @tests java.lang.Double#longBitsToDouble(long)
0542: */
0543: public void test_longBitsToDoubleJ() {
0544: // Test for method double java.lang.Double.longBitsToDouble(long)
0545:
0546: Double d = new Double(Double.MAX_VALUE);
0547: long lbits = Double.doubleToLongBits(d.doubleValue());
0548: double r = Double.longBitsToDouble(lbits);
0549:
0550: assertTrue("Bit conversion failed", d.doubleValue() == r);
0551: }
0552:
0553: /**
0554: * @tests java.lang.Double#longValue()
0555: */
0556: public void test_longValue() {
0557: // Test for method long java.lang.Double.longValue()
0558: Double d = new Double(1923311.47712);
0559: assertEquals("Returned incorrect long value", 1923311, d
0560: .longValue());
0561: }
0562:
0563: /**
0564: * @tests java.lang.Double#parseDouble(java.lang.String)
0565: */
0566: public void test_parseDoubleLjava_lang_String() {
0567: assertEquals(
0568: "Incorrect double returned, expected zero.",
0569: 0.0,
0570: Double
0571: .parseDouble("2.4703282292062327208828439643411e-324"),
0572: 0.0);
0573: assertTrue(
0574: "Incorrect double returned, expected minimum double.",
0575: Double
0576: .parseDouble("2.4703282292062327208828439643412e-324") == Double.MIN_VALUE);
0577:
0578: for (int i = 324; i > 0; i--) {
0579: Double.parseDouble("3.4e-" + i);
0580: }
0581: for (int i = 0; i <= 309; i++) {
0582: Double.parseDouble("1.2e" + i);
0583: }
0584:
0585: /*
0586: * The first two cases and the last four cases have to placed outside
0587: * the loop due to the difference in the expected output string.
0588: */
0589: doTestCompareRawBits("3.4e-324", rawBitsFor3_4en324ToN1[0],
0590: "4.9e-324");
0591: doTestCompareRawBits("3.4e-323", rawBitsFor3_4en324ToN1[1],
0592: "3.5e-323");
0593: for (int i = 322; i > 3; i--) {
0594: String testString, expectedString;
0595: testString = expectedString = "3.4e-" + i;
0596: doTestCompareRawBits(testString,
0597: rawBitsFor3_4en324ToN1[324 - i], expectedString);
0598: }
0599: doTestCompareRawBits("3.4e-3", rawBitsFor3_4en324ToN1[321],
0600: "0.0034");
0601: doTestCompareRawBits("3.4e-2", rawBitsFor3_4en324ToN1[322],
0602: "0.034");
0603: doTestCompareRawBits("3.4e-1", rawBitsFor3_4en324ToN1[323],
0604: "0.34");
0605: doTestCompareRawBits("3.4e-0", rawBitsFor3_4en324ToN1[324],
0606: "3.4");
0607:
0608: doTestCompareRawBits("1.2e0", rawBitsFor1_2e0To309[0], "1.2");
0609: doTestCompareRawBits("1.2e1", rawBitsFor1_2e0To309[1], "12.0");
0610: doTestCompareRawBits("1.2e2", rawBitsFor1_2e0To309[2], "120.0");
0611: doTestCompareRawBits("1.2e3", rawBitsFor1_2e0To309[3], "1200.0");
0612: doTestCompareRawBits("1.2e4", rawBitsFor1_2e0To309[4],
0613: "12000.0");
0614: doTestCompareRawBits("1.2e5", rawBitsFor1_2e0To309[5],
0615: "120000.0");
0616: doTestCompareRawBits("1.2e6", rawBitsFor1_2e0To309[6],
0617: "1200000.0");
0618: for (int i = 7; i <= 308; i++) {
0619: String testString, expectedString;
0620: testString = expectedString = "1.2e" + i;
0621: doTestCompareRawBits(testString, rawBitsFor1_2e0To309[i],
0622: expectedString);
0623: }
0624: doTestCompareRawBits("1.2e309", rawBitsFor1_2e0To309[309],
0625: "Infinity");
0626:
0627: doTestCompareRawBits(
0628: "111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000.92233720368547758079223372036854775807",
0629: 0x7e054218c295e43fL, "1.1122233344455567E299");
0630: doTestCompareRawBits(
0631: "-111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000111222333444555666777888999000.92233720368547758079223372036854775807",
0632: 0xfe054218c295e43fL, "-1.1122233344455567E299");
0633:
0634: doTestCompareRawBits("1.234123412431233E107",
0635: 0x562ae7a25fe706ebL, "1.234123412431233E107");
0636: doTestCompareRawBits("1.2341234124312331E107",
0637: 0x562ae7a25fe706ecL, "1.2341234124312331E107");
0638: doTestCompareRawBits("1.2341234124312332E107",
0639: 0x562ae7a25fe706ecL, "1.2341234124312331E107");
0640: doTestCompareRawBits("-1.234123412431233E107",
0641: 0xd62ae7a25fe706ebL, "-1.234123412431233E107");
0642: doTestCompareRawBits("-1.2341234124312331E107",
0643: 0xd62ae7a25fe706ecL, "-1.2341234124312331E107");
0644: doTestCompareRawBits("-1.2341234124312332E107",
0645: 0xd62ae7a25fe706ecL, "-1.2341234124312331E107");
0646:
0647: doTestCompareRawBits("1e23", 0x44b52d02c7e14af6L, "1.0e23");
0648:
0649: /*
0650: * These particular tests verify that the extreme boundary conditions
0651: * are converted correctly.
0652: */
0653: doTestCompareRawBits("0.0e-309", 0L, "0.0");
0654: doTestCompareRawBits("-0.0e-309", 0x8000000000000000L, "-0.0");
0655: doTestCompareRawBits("0.0e309", 0L, "0.0");
0656: doTestCompareRawBits("-0.0e309", 0x8000000000000000L, "-0.0");
0657: doTestCompareRawBits("0.1e309", 0x7fe1ccf385ebc8a0L, "1.0e308");
0658: doTestCompareRawBits("0.2e309", 0x7ff0000000000000L, "Infinity");
0659: doTestCompareRawBits("65e-325", 1L, "4.9e-324");
0660: doTestCompareRawBits("1000e-326", 2L, "1.0e-323");
0661:
0662: doTestCompareRawBits("4.0e-306", 0x86789e3750f791L, "4.0e-306");
0663: doTestCompareRawBits("2.22507e-308", 0xffffe2e8159d0L,
0664: "2.22507e-308");
0665: doTestCompareRawBits(
0666: "111222333444555666777888999000111228999000.92233720368547758079223372036854775807",
0667: 0x48746da623f1dd8bL, "1.1122233344455567E41");
0668: doTestCompareRawBits(
0669: "-111222333444555666777888999000111228999000.92233720368547758079223372036854775807",
0670: 0xc8746da623f1dd8bL, "-1.1122233344455567E41");
0671: doTestCompareRawBits(
0672: "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210",
0673: 0x54820fe0ba17f469L, "1.2345678901234567E99");
0674: doTestCompareRawBits(
0675: "-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210",
0676: 0xd4820fe0ba17f469L, "-1.2345678901234567E99");
0677:
0678: doTestCompareRawBits(
0679: "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.01",
0680: 0x7fefffffffffffffL, "1.7976931348623157E308");
0681: doTestCompareRawBits(
0682: "-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.01",
0683: 0xffefffffffffffffL, "-1.7976931348623157E308");
0684: doTestCompareRawBits(
0685: "1112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001234567890",
0686: 0x7ff0000000000000L, "Infinity");
0687: doTestCompareRawBits(
0688: "-1112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001112223334445556667778889990001234567890",
0689: 0xfff0000000000000L, "-Infinity");
0690: doTestCompareRawBits(
0691: "179769313486231590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.01",
0692: 0x7ff0000000000000L, "Infinity");
0693: doTestCompareRawBits(
0694: "-179769313486231590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.01",
0695: 0xfff0000000000000L, "-Infinity");
0696: doTestCompareRawBits(
0697: "0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017976931348623157",
0698: 0x2b392a32afcc661eL, "1.7976931348623157E-100");
0699: doTestCompareRawBits(
0700: "-0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017976931348623157",
0701: 0xab392a32afcc661eL, "-1.7976931348623157E-100");
0702: doTestCompareRawBits(
0703: "0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017976931348623157",
0704: 0x1b3432f0cb68e61L, "1.7976931348623157E-300");
0705: doTestCompareRawBits(
0706: "-0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017976931348623157",
0707: 0x81b3432f0cb68e61L, "-1.7976931348623157E-300");
0708: doTestCompareRawBits(
0709: "0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017976931348623157",
0710: 0x2117b590b942L, "1.79769313486234E-310");
0711: doTestCompareRawBits(
0712: "-0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017976931348623157",
0713: 0x80002117b590b942L, "-1.79769313486234E-310");
0714: doTestCompareRawBits(
0715: "0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017976931348623157",
0716: 0xe37L, "1.798E-320");
0717: doTestCompareRawBits(
0718: "-0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017976931348623157",
0719: 0x8000000000000e37L, "-1.798E-320");
0720: doTestCompareRawBits(
0721: "0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
0722: 0x2L, "1.0E-323");
0723: doTestCompareRawBits(
0724: "-0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
0725: 0x8000000000000002L, "-1.0E-323");
0726: doTestCompareRawBits(
0727: "0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055595409854908458349204328908234982349050934129878452378432452458968024357823490509341298784523784324524589680243578234905093412987845237843245245896802435782349050934129878452378432452458968024357868024357823490509341298784523784324524589680243578234905093412987845237843245245896802435786802435782349050934129878452378432452458968024357823490509341298784523784324524589680243578",
0728: 0x1L, "4.9E-324");
0729: doTestCompareRawBits(
0730: "-0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055595409854908458349204328908234982349050934129878452378432452458968024357823490509341298784523784324524589680243578234905093412987845237843245245896802435782349050934129878452378432452458968024357868024357823490509341298784523784324524589680243578234905093412987845237843245245896802435786802435782349050934129878452378432452458968024357823490509341298784523784324524589680243578",
0731: 0x8000000000000001L, "-4.9E-324");
0732: }
0733:
0734: /**
0735: * @tests java.lang.Double#parseDouble(java.lang.String)
0736: */
0737: public void test_parseDouble_LString_Illegal() {
0738: try {
0739: Double.parseDouble("0.0p0D");
0740: fail("Should throw NumberFormatException.");
0741: } catch (NumberFormatException e) {
0742: // expected
0743: }
0744:
0745: try {
0746: Double.parseDouble("+0x.p1d");
0747: fail("Should throw NumberFormatException.");
0748: } catch (NumberFormatException e) {
0749: // expected
0750: }
0751:
0752: try {
0753: Double.parseDouble("0Xg.gp1D");
0754: fail("Should throw NumberFormatException.");
0755: } catch (NumberFormatException e) {
0756: // expected
0757: }
0758:
0759: try {
0760: Double.parseDouble("-0x1.1p");
0761: fail("Should throw NumberFormatException.");
0762: } catch (NumberFormatException e) {
0763: // expected
0764: }
0765:
0766: try {
0767: Double.parseDouble("+0x 1.1 p2d");
0768: fail("Should throw NumberFormatException.");
0769: } catch (NumberFormatException e) {
0770: // expected
0771: }
0772:
0773: try {
0774: Double.parseDouble("x1.1p2d");
0775: fail("Should throw NumberFormatException.");
0776: } catch (NumberFormatException e) {
0777: // expected
0778: }
0779:
0780: try {
0781: Double.parseDouble(" 0x-2.1p2");
0782: fail("Should throw NumberFormatException.");
0783: } catch (NumberFormatException e) {
0784: // expected
0785: }
0786:
0787: try {
0788: Double.parseDouble(" 0x2.1pad");
0789: fail("Should throw NumberFormatException.");
0790: } catch (NumberFormatException e) {
0791: // expected
0792: }
0793:
0794: try {
0795: Double.parseDouble(" 0x111.222p 22d");
0796: fail("Should throw NumberFormatException.");
0797: } catch (NumberFormatException e) {
0798: // expected
0799: }
0800: }
0801:
0802: /**
0803: * @tests java.lang.Double#parseDouble(java.lang.String)
0804: */
0805: public void test_parseDouble_LString_FromHexString() {
0806: double actual;
0807: double expected;
0808:
0809: actual = Double.parseDouble("0x0.0p0D");
0810: assertEquals("Returned incorrect value", 0.0d, actual, 0.0D);
0811:
0812: actual = Double.parseDouble("0xa.ap+9d");
0813: assertEquals("Returned incorrect value", 5440.0d, actual, 0.0D);
0814:
0815: actual = Double.parseDouble("+0Xb.10ap8");
0816: assertEquals("Returned incorrect value", 2832.625d, actual,
0817: 0.0D);
0818:
0819: actual = Double.parseDouble("-0X.a0P2D");
0820: assertEquals("Returned incorrect value", -2.5d, actual, 0.0D);
0821:
0822: actual = Double.parseDouble("\r 0x22.1p2d \t");
0823: assertEquals("Returned incorrect value", 136.25d, actual, 0.0D);
0824:
0825: actual = Double.parseDouble("0x1.0p-1");
0826: assertEquals("Returned incorrect value", 0.5, actual, 0.0D);
0827:
0828: actual = Double
0829: .parseDouble("0x00000000000000000000000000000000001.0p-1");
0830: assertEquals("Returned incorrect value", 0.5, actual, 0.0D);
0831:
0832: actual = Double
0833: .parseDouble("0x1.0p-00000000000000000000000000001");
0834: assertEquals("Returned incorrect value", 0.5, actual, 0.0D);
0835:
0836: actual = Double
0837: .parseDouble("0x.100000000000000000000000000000000p1");
0838: assertEquals("Returned incorrect value", 0.125, actual, 0.0D);
0839:
0840: actual = Double
0841: .parseDouble("0x0.0p999999999999999999999999999999999999999999999999999999999999999");
0842: assertEquals("Returned incorrect value", 0.0, actual, 0.0D);
0843:
0844: actual = Double
0845: .parseDouble("0xf1.0p9999999999999999999999999999999999999999999999999999999999999999");
0846: assertEquals("Returned incorrect value",
0847: Double.POSITIVE_INFINITY, actual, 0.0D);
0848:
0849: actual = Double
0850: .parseDouble("0xffffffffffffffffffffffffffffffffffff.ffffffffffffffffffffffffffffffffffffffffffffffp1");
0851: expected = Double.longBitsToDouble(0x4900000000000000L);
0852: assertEquals("Returned incorrect value", expected, actual, 0.0D);
0853:
0854: actual = Double
0855: .parseDouble("0x0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001p1600");
0856: expected = Double.longBitsToDouble(0x7f30000000000000L);
0857: assertEquals("Returned incorrect value", expected, actual, 0.0D);
0858:
0859: actual = Double
0860: .parseDouble("0x0.0p-999999999999999999999999999999999999999999999999999999");
0861: assertEquals("Returned incorrect value", 0.0, actual, 0.0D);
0862:
0863: actual = Double
0864: .parseDouble("0xf1.0p-9999999999999999999999999999999999999999999999999999999999999999");
0865: assertEquals("Returned incorrect value", 0.0, actual, 0.0D);
0866:
0867: actual = Double
0868: .parseDouble("0x10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000p-1600");
0869: expected = Double.longBitsToDouble(0xf0000000000000L);
0870: assertEquals("Returned incorrect value", expected, actual, 0.0D);
0871:
0872: actual = Double.parseDouble("0x1.p9223372036854775807");
0873: assertEquals("Returned incorrect value",
0874: Double.POSITIVE_INFINITY, actual, 0.0D);
0875:
0876: actual = Double.parseDouble("0x1.p9223372036854775808");
0877: assertEquals("Returned incorrect value",
0878: Double.POSITIVE_INFINITY, actual, 0.0D);
0879:
0880: actual = Double.parseDouble("0x10.p9223372036854775808");
0881: assertEquals("Returned incorrect value",
0882: Double.POSITIVE_INFINITY, actual, 0.0D);
0883:
0884: actual = Double.parseDouble("0xabcd.ffffffffp+2000");
0885: assertEquals("Returned incorrect value",
0886: Double.POSITIVE_INFINITY, actual, 0.0D);
0887:
0888: actual = Double.parseDouble("0x1.p-9223372036854775808");
0889: assertEquals("Returned incorrect value", 0.0, actual, 0.0D);
0890:
0891: actual = Double.parseDouble("0x1.p-9223372036854775809");
0892: assertEquals("Returned incorrect value", 0.0, actual, 0.0D);
0893:
0894: actual = Double.parseDouble("0x.1p-9223372036854775809");
0895: assertEquals("Returned incorrect value", 0.0, actual, 0.0D);
0896:
0897: actual = Double.parseDouble("0xabcd.ffffffffffffffp-2000");
0898: assertEquals("Returned incorrect value", 0.0, actual, 0.0D);
0899: }
0900:
0901: /**
0902: * @tests java.lang.Double#parseDouble(java.lang.String)
0903: */
0904: public void test_parseDouble_LString_NormalPositiveExponent() {
0905: long[] expecteds = { 0x3f323456789abcdfL, 0x40e111012345678aL,
0906: 0x41a1110091a2b3c5L, 0x4259998091a2b3c5L,
0907: 0x4311110048d159e2L, 0x43c5554048d159e2L,
0908: 0x4479998048d159e2L, 0x452dddc048d159e2L,
0909: 0x45e111002468acf1L, 0x469333202468acf1L,
0910: 0x4751011001234568L, 0x4802112101234568L,
0911: 0x48b3213201234568L, 0x4964314301234568L,
0912: 0x4a15415401234568L, 0x4ac6516501234568L,
0913: 0x4b77617601234568L, 0x4c28718701234568L,
0914: 0x4cd9819801234568L, 0x4d9049048091a2b4L,
0915: 0x4e4101100091a2b4L, 0x4ef189188091a2b4L,
0916: 0x4fa211210091a2b4L, 0x505299298091a2b4L,
0917: 0x510321320091a2b4L, 0x51b3a93a8091a2b4L,
0918: 0x526431430091a2b4L, 0x5314b94b8091a2b4L,
0919: 0x53c841840091a2b4L, 0x5478c98c8091a2b4L,
0920: 0x552981980091a2b4L, 0x55da09a08091a2b4L,
0921: 0x568a91a90091a2b4L, 0x573b19b18091a2b4L,
0922: 0x57eba1ba0091a2b4L, 0x589c29c28091a2b4L,
0923: 0x594cb1cb0091a2b4L, 0x5a001d01c048d15aL,
0924: 0x5ab061060048d15aL, 0x5b60a50a4048d15aL,
0925: 0x5c1101100048d15aL, 0x5cc145144048d15aL,
0926: 0x5d7189188048d15aL, 0x5e21cd1cc048d15aL,
0927: 0x5ed211210048d15aL, 0x5f8255254048d15aL,
0928: 0x603419418048d15aL, 0x60e45d45c048d15aL,
0929: 0x6194a14a0048d15aL, 0x6244e54e4048d15aL,
0930: 0x62f541540048d15aL, 0x63a585584048d15aL,
0931: 0x6455c95c8048d15aL, 0x65060d60c048d15aL,
0932: 0x65b651650048d15aL, 0x666815814048d15aL,
0933: 0x671859858048d15aL, 0x67c89d89c048d15aL,
0934: 0x6878e18e0048d15aL, 0x692925924048d15aL,
0935: 0x69d981980048d15aL, 0x6a89c59c4048d15aL,
0936: 0x6b3a09a08048d15aL, 0x6bea4da4c048d15aL,
0937: 0x6c9c11c10048d15aL, 0x6d4c55c54048d15aL,
0938: 0x6dfc99c98048d15aL, 0x6eacddcdc048d15aL,
0939: 0x6f5d21d20048d15aL, 0x700d65d64048d15aL,
0940: 0x70bdc1dc0048d15aL, 0x716e05e04048d15aL,
0941: 0x721e49e48048d15aL, 0x72d00700602468adL,
0942: 0x73802902802468adL, 0x74304b04a02468adL,
0943: 0x74e06d06c02468adL, 0x75908f08e02468adL,
0944: 0x7640b10b002468adL, 0x76f0d30d202468adL,
0945: 0x77a10110002468adL, 0x78512312202468adL,
0946: 0x79020520402468adL, 0x79b22722602468adL,
0947: 0x7a624924802468adL, 0x7b126b26a02468adL,
0948: 0x7bc28d28c02468adL, 0x7c72af2ae02468adL,
0949: 0x7d22d12d002468adL, 0x7dd2f32f202468adL,
0950: 0x7e832132002468adL, 0x7f40011001012345L,
0951: 0x7ff0000000000000L, 0x7ff0000000000000L,
0952: 0x7ff0000000000000L, 0x7ff0000000000000L,
0953: 0x7ff0000000000000L, 0x7ff0000000000000L,
0954: 0x7ff0000000000000L, 0x7ff0000000000000L,
0955: 0x7ff0000000000000L, 0x7ff0000000000000L,
0956: 0x7ff0000000000000L, 0x7ff0000000000000L,
0957: 0x7ff0000000000000L, 0x7ff0000000000000L,
0958: 0x7ff0000000000000L, 0x7ff0000000000000L,
0959: 0x7ff0000000000000L, 0x7ff0000000000000L,
0960: 0x7ff0000000000000L, 0x7ff0000000000000L,
0961: 0x7ff0000000000000L };
0962:
0963: for (int i = 0; i < expecteds.length; i++) {
0964: int part = i * 11;
0965: String inputString = "0x" + part + "." + part
0966: + "0123456789abcdefp" + part;
0967:
0968: double actual = Double.parseDouble(inputString);
0969: double expected = Double.longBitsToDouble(expecteds[i]);
0970:
0971: String expectedString = "0x"
0972: + Long.toHexString(Double
0973: .doubleToLongBits(expected));
0974: String actualString = "0x"
0975: + Long.toHexString(Double.doubleToLongBits(actual));
0976: String errorMsg = i + "th input string is:<" + inputString
0977: + ">.The expected result should be:<"
0978: + expectedString + ">, but was: <" + actualString
0979: + ">. ";
0980:
0981: assertEquals(errorMsg, expected, actual, 0.0D);
0982: }
0983: }
0984:
0985: /**
0986: * @tests java.lang.Double#parseDouble(java.lang.String)
0987: */
0988: public void test_parseDouble_LString_NormalNegativeExponent() {
0989: long[] expecteds = { 0x3f323456789abcdfL, 0x3f8111012345678aL,
0990: 0x3ee1110091a2b3c5L, 0x3e39998091a2b3c5L,
0991: 0x3d91110048d159e2L, 0x3ce5554048d159e2L,
0992: 0x3c39998048d159e2L, 0x3b8dddc048d159e2L,
0993: 0x3ae111002468acf1L, 0x3a3333202468acf1L,
0994: 0x3991011001234568L, 0x38e2112101234568L,
0995: 0x3833213201234568L, 0x3784314301234568L,
0996: 0x36d5415401234568L, 0x3626516501234568L,
0997: 0x3577617601234568L, 0x34c8718701234568L,
0998: 0x3419819801234568L, 0x337049048091a2b4L,
0999: 0x32c101100091a2b4L, 0x321189188091a2b4L,
1000: 0x316211210091a2b4L, 0x30b299298091a2b4L,
1001: 0x300321320091a2b4L, 0x2f53a93a8091a2b4L,
1002: 0x2ea431430091a2b4L, 0x2df4b94b8091a2b4L,
1003: 0x2d4841840091a2b4L, 0x2c98c98c8091a2b4L,
1004: 0x2be981980091a2b4L, 0x2b3a09a08091a2b4L,
1005: 0x2a8a91a90091a2b4L, 0x29db19b18091a2b4L,
1006: 0x292ba1ba0091a2b4L, 0x287c29c28091a2b4L,
1007: 0x27ccb1cb0091a2b4L, 0x27201d01c048d15aL,
1008: 0x267061060048d15aL, 0x25c0a50a4048d15aL,
1009: 0x251101100048d15aL, 0x246145144048d15aL,
1010: 0x23b189188048d15aL, 0x2301cd1cc048d15aL,
1011: 0x225211210048d15aL, 0x21a255254048d15aL,
1012: 0x20f419418048d15aL, 0x20445d45c048d15aL,
1013: 0x1f94a14a0048d15aL, 0x1ee4e54e4048d15aL,
1014: 0x1e3541540048d15aL, 0x1d8585584048d15aL,
1015: 0x1cd5c95c8048d15aL, 0x1c260d60c048d15aL,
1016: 0x1b7651650048d15aL, 0x1ac815814048d15aL,
1017: 0x1a1859858048d15aL, 0x19689d89c048d15aL,
1018: 0x18b8e18e0048d15aL, 0x180925924048d15aL,
1019: 0x175981980048d15aL, 0x16a9c59c4048d15aL,
1020: 0x15fa09a08048d15aL, 0x154a4da4c048d15aL,
1021: 0x149c11c10048d15aL, 0x13ec55c54048d15aL,
1022: 0x133c99c98048d15aL, 0x128cddcdc048d15aL,
1023: 0x11dd21d20048d15aL, 0x112d65d64048d15aL,
1024: 0x107dc1dc0048d15aL, 0xfce05e04048d15aL,
1025: 0xf1e49e48048d15aL, 0xe700700602468adL,
1026: 0xdc02902802468adL, 0xd104b04a02468adL,
1027: 0xc606d06c02468adL, 0xbb08f08e02468adL,
1028: 0xb00b10b002468adL, 0xa50d30d202468adL,
1029: 0x9a10110002468adL, 0x8f12312202468adL,
1030: 0x8420520402468adL, 0x7922722602468adL,
1031: 0x6e24924802468adL, 0x6326b26a02468adL,
1032: 0x5828d28c02468adL, 0x4d2af2ae02468adL,
1033: 0x422d12d002468adL, 0x372f32f202468adL,
1034: 0x2c32132002468adL, 0x220011001012345L,
1035: 0x170121012012345L, 0xc0231023012345L,
1036: 0x10341034012345L, 0x208a208a024L, 0x41584158L,
1037: 0x83388L, 0x108L, 0x0L, 0x0L, 0x0L, 0x0L, 0x0L, 0x0L,
1038: 0x0L, 0x0L, 0x0L, 0x0L, 0x0L, 0x0L, 0x0L, 0x0L };
1039:
1040: for (int i = 0; i < expecteds.length; i++) {
1041: int part = i * 11;
1042: String inputString = "0x" + part + "." + part
1043: + "0123456789abcdefp-" + part;
1044:
1045: double actual = Double.parseDouble(inputString);
1046: double expected = Double.longBitsToDouble(expecteds[i]);
1047:
1048: String expectedString = "0x"
1049: + Long.toHexString(Double
1050: .doubleToLongBits(expected));
1051: String actualString = "0x"
1052: + Long.toHexString(Double.doubleToLongBits(actual));
1053: String errorMsg = i + "th input string is:<" + inputString
1054: + ">.The expected result should be:<"
1055: + expectedString + ">, but was: <" + actualString
1056: + ">. ";
1057:
1058: assertEquals(errorMsg, expected, actual, 0.0D);
1059: }
1060: }
1061:
1062: /**
1063: * @tests java.lang.Double#parseDouble(java.lang.String)
1064: */
1065: public void test_parseDouble_LString_MaxNormalBoundary() {
1066: long[] expecteds = { 0x7fefffffffffffffL, 0x7fefffffffffffffL,
1067: 0x7fefffffffffffffL, 0x7fefffffffffffffL,
1068: 0x7fefffffffffffffL, 0x7fefffffffffffffL,
1069: 0x7fefffffffffffffL, 0x7ff0000000000000L,
1070: 0x7ff0000000000000L, 0x7ff0000000000000L,
1071: 0x7ff0000000000000L, 0x7ff0000000000000L,
1072: 0x7ff0000000000000L, 0x7ff0000000000000L,
1073: 0x7ff0000000000000L,
1074:
1075: 0xffefffffffffffffL, 0xffefffffffffffffL,
1076: 0xffefffffffffffffL, 0xffefffffffffffffL,
1077: 0xffefffffffffffffL, 0xffefffffffffffffL,
1078: 0xffefffffffffffffL, 0xfff0000000000000L,
1079: 0xfff0000000000000L, 0xfff0000000000000L,
1080: 0xfff0000000000000L, 0xfff0000000000000L,
1081: 0xfff0000000000000L, 0xfff0000000000000L,
1082: 0xfff0000000000000L };
1083:
1084: String[] inputs = {
1085: "0x1.fffffffffffffp1023",
1086: "0x1.fffffffffffff000000000000000000000000001p1023",
1087: "0x1.fffffffffffff1p1023",
1088: "0x1.fffffffffffff100000000000000000000000001p1023",
1089: "0x1.fffffffffffff1fffffffffffffffffffffffffffffffffffffffffffffp1023",
1090: "0x1.fffffffffffff7p1023",
1091: "0x1.fffffffffffff700000000000000000000000001p1023",
1092: "0x1.fffffffffffff8p1023",
1093: "0x1.fffffffffffff800000000000000000000000001p1023",
1094: "0x1.fffffffffffff8fffffffffffffffffffffffffffffffffffffffffffffp1023",
1095: "0x1.fffffffffffff9p1023",
1096: "0x1.fffffffffffff900000000000000000000000001p1023",
1097: "0x1.ffffffffffffffp1023",
1098: "0x1.ffffffffffffff00000000000000000000000001p1023",
1099: "0x1.fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffp1023",
1100:
1101: "-0x1.fffffffffffffp1023",
1102: "-0x1.fffffffffffff000000000000000000000000001p1023",
1103: "-0x1.fffffffffffff1p1023",
1104: "-0x1.fffffffffffff100000000000000000000000001p1023",
1105: "-0x1.fffffffffffff1fffffffffffffffffffffffffffffffffffffffffffffp1023",
1106: "-0x1.fffffffffffff7p1023",
1107: "-0x1.fffffffffffff700000000000000000000000001p1023",
1108: "-0x1.fffffffffffff8p1023",
1109: "-0x1.fffffffffffff800000000000000000000000001p1023",
1110: "-0x1.fffffffffffff8fffffffffffffffffffffffffffffffffffffffffffffp1023",
1111: "-0x1.fffffffffffff9p1023",
1112: "-0x1.fffffffffffff900000000000000000000000001p1023",
1113: "-0x1.ffffffffffffffp1023",
1114: "-0x1.ffffffffffffff00000000000000000000000001p1023",
1115: "-0x1.fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffp1023" };
1116:
1117: for (int i = 0; i < inputs.length; i++) {
1118: double actual = Double.parseDouble(inputs[i]);
1119: double expected = Double.longBitsToDouble(expecteds[i]);
1120:
1121: String expectedString = "0x"
1122: + Long.toHexString(Double
1123: .doubleToLongBits(expected));
1124: String actualString = "0x"
1125: + Long.toHexString(Double.doubleToLongBits(actual));
1126: String errorMsg = i + "th input string is:<" + inputs[i]
1127: + ">.The expected result should be:<"
1128: + expectedString + ">, but was: <" + actualString
1129: + ">. ";
1130:
1131: assertEquals(errorMsg, expected, actual, 0.0D);
1132: }
1133: }
1134:
1135: /**
1136: * @tests java.lang.Double#parseDouble(java.lang.String)
1137: */
1138: public void test_parseDouble_LString_MinNormalBoundary() {
1139: long[] expecteds = { 0x10000000000000L, 0x10000000000000L,
1140: 0x10000000000000L, 0x10000000000000L,
1141: 0x10000000000000L, 0x10000000000000L,
1142: 0x10000000000000L, 0x10000000000000L,
1143: 0x10000000000001L, 0x10000000000001L,
1144: 0x10000000000001L, 0x10000000000001L,
1145: 0x10000000000001L, 0x10000000000001L,
1146: 0x10000000000001L,
1147:
1148: 0x8010000000000000L, 0x8010000000000000L,
1149: 0x8010000000000000L, 0x8010000000000000L,
1150: 0x8010000000000000L, 0x8010000000000000L,
1151: 0x8010000000000000L, 0x8010000000000000L,
1152: 0x8010000000000001L, 0x8010000000000001L,
1153: 0x8010000000000001L, 0x8010000000000001L,
1154: 0x8010000000000001L, 0x8010000000000001L,
1155: 0x8010000000000001L };
1156:
1157: String[] inputs = {
1158: "0x1.0p-1022",
1159: "0x1.00000000000001p-1022",
1160: "0x1.000000000000010000000000000000001p-1022",
1161: "0x1.00000000000001fffffffffffffffffffffffffffffffffp-1022",
1162: "0x1.00000000000007p-1022",
1163: "0x1.000000000000070000000000000000001p-1022",
1164: "0x1.00000000000007fffffffffffffffffffffffffffffffffp-1022",
1165: "0x1.00000000000008p-1022",
1166: "0x1.000000000000080000000000000000001p-1022",
1167: "0x1.00000000000008fffffffffffffffffffffffffffffffffp-1022",
1168: "0x1.00000000000009p-1022",
1169: "0x1.000000000000090000000000000000001p-1022",
1170: "0x1.00000000000009fffffffffffffffffffffffffffffffffp-1022",
1171: "0x1.0000000000000fp-1022",
1172: "0x1.0000000000000ffffffffffffffffffffffffffffffffffp-1022",
1173:
1174: "-0x1.0p-1022",
1175: "-0x1.00000000000001p-1022",
1176: "-0x1.000000000000010000000000000000001p-1022",
1177: "-0x1.00000000000001fffffffffffffffffffffffffffffffffp-1022",
1178: "-0x1.00000000000007p-1022",
1179: "-0x1.000000000000070000000000000000001p-1022",
1180: "-0x1.00000000000007fffffffffffffffffffffffffffffffffp-1022",
1181: "-0x1.00000000000008p-1022",
1182: "-0x1.000000000000080000000000000000001p-1022",
1183: "-0x1.00000000000008fffffffffffffffffffffffffffffffffp-1022",
1184: "-0x1.00000000000009p-1022",
1185: "-0x1.000000000000090000000000000000001p-1022",
1186: "-0x1.00000000000009fffffffffffffffffffffffffffffffffp-1022",
1187: "-0x1.0000000000000fp-1022",
1188: "-0x1.0000000000000ffffffffffffffffffffffffffffffffffp-1022" };
1189:
1190: for (int i = 0; i < inputs.length; i++) {
1191: double actual = Double.parseDouble(inputs[i]);
1192: double expected = Double.longBitsToDouble(expecteds[i]);
1193:
1194: String expectedString = "0x"
1195: + Long.toHexString(Double
1196: .doubleToLongBits(expected));
1197: String actualString = "0x"
1198: + Long.toHexString(Double.doubleToLongBits(actual));
1199: String errorMsg = i + "th input string is:<" + inputs[i]
1200: + ">.The expected result should be:<"
1201: + expectedString + ">, but was: <" + actualString
1202: + ">. ";
1203:
1204: assertEquals(errorMsg, expected, actual, 0.0D);
1205: }
1206: }
1207:
1208: /**
1209: * @tests java.lang.Double#parseDouble(java.lang.String)
1210: */
1211: public void test_parseDouble_LString_MaxSubNormalBoundary() {
1212: long[] expecteds = { 0xfffffffffffffL, 0xfffffffffffffL,
1213: 0xfffffffffffffL, 0xfffffffffffffL, 0xfffffffffffffL,
1214: 0xfffffffffffffL, 0xfffffffffffffL, 0x10000000000000L,
1215: 0x10000000000000L, 0x10000000000000L,
1216: 0x10000000000000L, 0x10000000000000L,
1217: 0x10000000000000L, 0x10000000000000L,
1218: 0x10000000000000L,
1219:
1220: 0x800fffffffffffffL, 0x800fffffffffffffL,
1221: 0x800fffffffffffffL, 0x800fffffffffffffL,
1222: 0x800fffffffffffffL, 0x800fffffffffffffL,
1223: 0x800fffffffffffffL, 0x8010000000000000L,
1224: 0x8010000000000000L, 0x8010000000000000L,
1225: 0x8010000000000000L, 0x8010000000000000L,
1226: 0x8010000000000000L, 0x8010000000000000L,
1227: 0x8010000000000000L };
1228:
1229: String[] inputs = {
1230: "0x0.fffffffffffffp-1022",
1231: "0x0.fffffffffffff00000000000000000000000000000000001p-1022",
1232: "0x0.fffffffffffff1p-1022",
1233: "0x0.fffffffffffff10000000000000000000000000000000001p-1022",
1234: "0x0.fffffffffffff1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffp-1022",
1235: "0x0.fffffffffffff7p-1022",
1236: "0x0.fffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffp-1022",
1237: "0x0.fffffffffffff8p-1022",
1238: "0x0.fffffffffffff80000000000000000000000000000000001p-1022",
1239: "0x0.fffffffffffff8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffp-1022",
1240: "0x0.fffffffffffff9p-1022",
1241: "0x0.fffffffffffff9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffp-1022",
1242: "0x0.ffffffffffffffp-1022",
1243: "0x0.ffffffffffffff0000000000000000000000000000000001p-1022",
1244: "0x0.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffp-1022",
1245:
1246: "-0x0.fffffffffffffp-1022",
1247: "-0x0.fffffffffffff00000000000000000000000000000000001p-1022",
1248: "-0x0.fffffffffffff1p-1022",
1249: "-0x0.fffffffffffff10000000000000000000000000000000001p-1022",
1250: "-0x0.fffffffffffff1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffp-1022",
1251: "-0x0.fffffffffffff7p-1022",
1252: "-0x0.fffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffp-1022",
1253: "-0x0.fffffffffffff8p-1022",
1254: "-0x0.fffffffffffff80000000000000000000000000000000001p-1022",
1255: "-0x0.fffffffffffff8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffp-1022",
1256: "-0x0.fffffffffffff9p-1022",
1257: "-0x0.fffffffffffff9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffp-1022",
1258: "-0x0.ffffffffffffffp-1022",
1259: "-0x0.ffffffffffffff0000000000000000000000000000000001p-1022",
1260: "-0x0.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffp-1022" };
1261:
1262: for (int i = 0; i < inputs.length; i++) {
1263: double actual = Double.parseDouble(inputs[i]);
1264: double expected = Double.longBitsToDouble(expecteds[i]);
1265:
1266: String expectedString = "0x"
1267: + Long.toHexString(Double
1268: .doubleToLongBits(expected));
1269: String actualString = "0x"
1270: + Long.toHexString(Double.doubleToLongBits(actual));
1271: String errorMsg = i + "th input string is:<" + inputs[i]
1272: + ">.The expected result should be:<"
1273: + expectedString + ">, but was: <" + actualString
1274: + ">. ";
1275:
1276: assertEquals(errorMsg, expected, actual, 0.0D);
1277: }
1278: }
1279:
1280: /**
1281: * @tests java.lang.Double#parseDouble(java.lang.String)
1282: */
1283: public void test_parseDouble_LString_MinSubNormalBoundary() {
1284: long[] expecteds = { 0x1L, 0x1L, 0x2L, 0x1L, 0x1L, 0x1L, 0x2L,
1285: 0x2L, 0x2L, 0x2L, 0x2L, 0x2L, 0x2L, 0x2L, 0x2L,
1286:
1287: 0x8000000000000001L, 0x8000000000000001L,
1288: 0x8000000000000002L, 0x8000000000000001L,
1289: 0x8000000000000001L, 0x8000000000000001L,
1290: 0x8000000000000002L, 0x8000000000000002L,
1291: 0x8000000000000002L, 0x8000000000000002L,
1292: 0x8000000000000002L, 0x8000000000000002L,
1293: 0x8000000000000002L, 0x8000000000000002L,
1294: 0x8000000000000002L };
1295:
1296: String[] inputs = {
1297: "0x0.0000000000001p-1022",
1298: "0x0.00000000000010000000000000000001p-1022",
1299: "0x0.0000000000001fffffffffffffffffffffffffffffffffp-1022",
1300: "0x0.00000000000017p-1022",
1301: "0x0.000000000000170000000000000000001p-1022",
1302: "0x0.00000000000017fffffffffffffffffffffffffffffffffp-1022",
1303: "0x0.00000000000018p-1022",
1304: "0x0.000000000000180000000000000000001p-1022",
1305: "0x0.00000000000018fffffffffffffffffffffffffffffffffp-1022",
1306: "0x0.00000000000019p-1022",
1307: "0x0.000000000000190000000000000000001p-1022",
1308: "0x0.00000000000019fffffffffffffffffffffffffffffffffp-1022",
1309: "0x0.0000000000001fp-1022",
1310: "0x0.0000000000001f0000000000000000001p-1022",
1311: "0x0.0000000000001ffffffffffffffffffffffffffffffffffp-1022",
1312:
1313: "-0x0.0000000000001p-1022",
1314: "-0x0.00000000000010000000000000000001p-1022",
1315: "-0x0.0000000000001fffffffffffffffffffffffffffffffffp-1022",
1316: "-0x0.00000000000017p-1022",
1317: "-0x0.000000000000170000000000000000001p-1022",
1318: "-0x0.00000000000017fffffffffffffffffffffffffffffffffp-1022",
1319: "-0x0.00000000000018p-1022",
1320: "-0x0.000000000000180000000000000000001p-1022",
1321: "-0x0.00000000000018fffffffffffffffffffffffffffffffffp-1022",
1322: "-0x0.00000000000019p-1022",
1323: "-0x0.000000000000190000000000000000001p-1022",
1324: "-0x0.00000000000019fffffffffffffffffffffffffffffffffp-1022",
1325: "-0x0.0000000000001fp-1022",
1326: "-0x0.0000000000001f0000000000000000001p-1022",
1327: "-0x0.0000000000001ffffffffffffffffffffffffffffffffffp-1022" };
1328:
1329: for (int i = 0; i < inputs.length; i++) {
1330: double actual = Double.parseDouble(inputs[i]);
1331: double expected = Double.longBitsToDouble(expecteds[i]);
1332:
1333: String expectedString = "0x"
1334: + Long.toHexString(Double
1335: .doubleToLongBits(expected));
1336: String actualString = "0x"
1337: + Long.toHexString(Double.doubleToLongBits(actual));
1338: String errorMsg = i + "th input string is:<" + inputs[i]
1339: + ">.The expected result should be:<"
1340: + expectedString + ">, but was: <" + actualString
1341: + ">. ";
1342:
1343: assertEquals(errorMsg, expected, actual, 0.0D);
1344: }
1345: }
1346:
1347: /**
1348: * @tests java.lang.Double#parseDouble(java.lang.String)
1349: */
1350: public void test_parseDouble_LString_ZeroBoundary() {
1351: long[] expecteds = { 0x0L, 0x0L, 0x0L, 0x1L, 0x1L, 0x1L, 0x1L,
1352: 0x1L, 0x1L, 0x8000000000000000L, 0x8000000000000000L,
1353: 0x8000000000000000L, 0x8000000000000001L,
1354: 0x8000000000000001L, 0x8000000000000001L,
1355: 0x8000000000000001L, 0x8000000000000001L,
1356: 0x8000000000000001L };
1357:
1358: String[] inputs = {
1359: "0x0.00000000000004p-1022",
1360: "0x0.00000000000007ffffffffffffffffffffffp-1022",
1361: "0x0.00000000000008p-1022",
1362: "0x0.000000000000080000000000000000001p-1022",
1363: "0x0.00000000000008fffffffffffffffffffffffffffffffp-1022",
1364: "0x0.00000000000009p-1022",
1365: "0x0.000000000000090000000000000000001p-1022",
1366: "0x0.00000000000009fffffffffffffffffffffffffffffffffp-1022",
1367: "0x0.0000000000000fffffffffffffffffffffffffffffffffffp-1022",
1368:
1369: "-0x0.00000000000004p-1022",
1370: "-0x0.00000000000007ffffffffffffffffffffffp-1022",
1371: "-0x0.00000000000008p-1022",
1372: "-0x0.000000000000080000000000000000001p-1022",
1373: "-0x0.00000000000008fffffffffffffffffffffffffffffffp-1022",
1374: "-0x0.00000000000009p-1022",
1375: "-0x0.000000000000090000000000000000001p-1022",
1376: "-0x0.00000000000009fffffffffffffffffffffffffffffffffp-1022",
1377: "-0x0.0000000000000fffffffffffffffffffffffffffffffffffp-1022" };
1378:
1379: for (int i = 0; i < inputs.length; i++) {
1380: double actual = Double.parseDouble(inputs[i]);
1381: double expected = Double.longBitsToDouble(expecteds[i]);
1382:
1383: String expectedString = "0x"
1384: + Long.toHexString(Double
1385: .doubleToLongBits(expected));
1386: String actualString = "0x"
1387: + Long.toHexString(Double.doubleToLongBits(actual));
1388: String errorMsg = i + "th input string is:<" + inputs[i]
1389: + ">.The expected result should be:<"
1390: + expectedString + ">, but was: <" + actualString
1391: + ">. ";
1392:
1393: assertEquals(errorMsg, expected, actual, 0.0D);
1394: }
1395: }
1396:
1397: /**
1398: * @tests java.lang.Double#shortValue()
1399: */
1400: public void test_shortValue() {
1401: // Test for method short java.lang.Double.shortValue()
1402: Double d = new Double(1923311.47712);
1403: assertEquals("Returned incorrect short value", 22767, d
1404: .shortValue());
1405: }
1406:
1407: /**
1408: * @tests java.lang.Double#toString()
1409: */
1410: public void test_toString() {
1411: // Test for method java.lang.String java.lang.Double.toString()
1412: test_toString(1.7976931348623157E308, "1.7976931348623157E308");
1413: test_toString(5.0E-4, "5.0E-4");
1414: }
1415:
1416: /**
1417: * @tests java.lang.Double#toString(double)
1418: */
1419: public void test_toStringD() {
1420: // Test for method java.lang.String java.lang.Double.toString(double)
1421: test_toString(1.7976931348623157E308, "1.7976931348623157E308");
1422: test_toString(1.0 / 0.0, "Infinity");
1423: test_toString(0.0 / 0.0, "NaN");
1424: test_toString(-1.0 / 0.0, "-Infinity");
1425:
1426: double d;
1427: d = Double.longBitsToDouble(0x470fffffffffffffL);
1428: test_toString(d, "2.0769187434139308E34");
1429: d = Double.longBitsToDouble(0x4710000000000000L);
1430: test_toString(d, "2.076918743413931E34");
1431:
1432: d = Double.longBitsToDouble(0x470000000000000aL);
1433: test_toString(d, "1.0384593717069678E34");
1434: d = Double.longBitsToDouble(0x470000000000000bL);
1435: test_toString(d, "1.038459371706968E34");
1436:
1437: d = Double.longBitsToDouble(0x4700000000000017L);
1438: test_toString(d, "1.0384593717069708E34");
1439: d = Double.longBitsToDouble(0x4700000000000018L);
1440: test_toString(d, "1.038459371706971E34");
1441:
1442: d = Double.longBitsToDouble(0x4700000000000024L);
1443: test_toString(d, "1.0384593717069738E34");
1444: d = Double.longBitsToDouble(0x4700000000000025L);
1445: test_toString(d, "1.038459371706974E34");
1446:
1447: d = Double.longBitsToDouble(0x4700000000000031L);
1448: test_toString(d, "1.0384593717069768E34");
1449: d = Double.longBitsToDouble(0x4700000000000032L);
1450: test_toString(d, "1.038459371706977E34");
1451:
1452: d = Double.longBitsToDouble(0x470000000000003eL);
1453: test_toString(d, "1.0384593717069798E34");
1454: d = Double.longBitsToDouble(0x470000000000003fL);
1455: test_toString(d, "1.03845937170698E34");
1456:
1457: d = Double.longBitsToDouble(0x7e00000000000003L);
1458: test_toString(d, "8.371160993642719E298");
1459: d = Double.longBitsToDouble(0x7e00000000000004L);
1460: test_toString(d, "8.37116099364272E298");
1461:
1462: d = Double.longBitsToDouble(0x7e00000000000008L);
1463: test_toString(d, "8.371160993642728E298");
1464: d = Double.longBitsToDouble(0x7e00000000000009L);
1465: test_toString(d, "8.37116099364273E298");
1466:
1467: d = Double.longBitsToDouble(0x7e00000000000013L);
1468: test_toString(d, "8.371160993642749E298");
1469: d = Double.longBitsToDouble(0x7e00000000000014L);
1470: test_toString(d, "8.37116099364275E298");
1471:
1472: d = Double.longBitsToDouble(0x7e00000000000023L);
1473: test_toString(d, "8.371160993642779E298");
1474: d = Double.longBitsToDouble(0x7e00000000000024L);
1475: test_toString(d, "8.37116099364278E298");
1476:
1477: d = Double.longBitsToDouble(0x7e0000000000002eL);
1478: test_toString(d, "8.371160993642799E298");
1479: d = Double.longBitsToDouble(0x7e0000000000002fL);
1480: test_toString(d, "8.3711609936428E298");
1481:
1482: d = Double.longBitsToDouble(0xda00000000000001L);
1483: test_toString(d, "-3.3846065602060736E125");
1484: d = Double.longBitsToDouble(0xda00000000000002L);
1485: test_toString(d, "-3.384606560206074E125");
1486:
1487: d = Double.longBitsToDouble(0xda00000000000005L);
1488: test_toString(d, "-3.3846065602060766E125");
1489: d = Double.longBitsToDouble(0xda00000000000006L);
1490: test_toString(d, "-3.384606560206077E125");
1491:
1492: d = Double.longBitsToDouble(0xda00000000000009L);
1493: test_toString(d, "-3.3846065602060796E125");
1494: d = Double.longBitsToDouble(0xda0000000000000aL);
1495: test_toString(d, "-3.38460656020608E125");
1496:
1497: d = Double.longBitsToDouble(0xda0000000000000dL);
1498: test_toString(d, "-3.3846065602060826E125");
1499: d = Double.longBitsToDouble(0xda0000000000000eL);
1500: test_toString(d, "-3.384606560206083E125");
1501: }
1502:
1503: /**
1504: * @tests java.lang.Double#valueOf(java.lang.String)
1505: */
1506: public void test_valueOfLjava_lang_String() {
1507: // Test for method java.lang.Double
1508: // java.lang.Double.valueOf(java.lang.String)
1509: assertTrue("Incorrect double returned",
1510: Math.abs(Double.valueOf("999999999999.999")
1511: .doubleValue() - 999999999999.999d) < 1);
1512:
1513: try {
1514: Double.valueOf(null);
1515: fail("Expected Double.valueOf(null) to throw NPE.");
1516: } catch (NullPointerException ex) {
1517: // expected
1518: }
1519:
1520: try {
1521: Double.valueOf("");
1522: fail("Expected Double.valueOf(\"\") to throw NFE");
1523: } catch (NumberFormatException e) {
1524: // expected
1525: }
1526:
1527: Double pi = Double.valueOf("3.141592654");
1528: assertEquals(3.141592654, pi.doubleValue(), 0D);
1529:
1530: Double posZero = Double.valueOf("+0.0");
1531: Double negZero = Double.valueOf("-0.0");
1532: assertFalse("Doubletest0", posZero.equals(negZero));
1533:
1534: // Tests for double values by name.
1535: Double expectedNaN = new Double(Double.NaN);
1536:
1537: Double posNaN = Double.valueOf("NaN");
1538: assertTrue("Doubletest1", posNaN.equals(expectedNaN));
1539:
1540: Double posNaNSigned = Double.valueOf("+NaN");
1541: assertTrue("Doubletest2", posNaNSigned.equals(expectedNaN));
1542:
1543: Double negNaNSigned = Double.valueOf("-NaN");
1544: assertTrue("Doubletest3", negNaNSigned.equals(expectedNaN));
1545:
1546: Double posInfinite = Double.valueOf("Infinity");
1547: assertTrue("Doubletest4", posInfinite.equals(new Double(
1548: Double.POSITIVE_INFINITY)));
1549:
1550: Double posInfiniteSigned = Double.valueOf("+Infinity");
1551: assertTrue("Doubletest5", posInfiniteSigned.equals(new Double(
1552: Double.POSITIVE_INFINITY)));
1553:
1554: Double negInfiniteSigned = Double.valueOf("-Infinity");
1555: assertTrue("Doubletest6", negInfiniteSigned.equals(new Double(
1556: Double.NEGATIVE_INFINITY)));
1557: }
1558:
1559: /**
1560: * @tests java.lang.Double#compareTo(java.lang.Double)
1561: * @tests java.lang.Double#compare(double, double)
1562: */
1563: public void test_compareToLjava_lang_Double() {
1564: // A selection of double values in ascending order.
1565: double[] values = new double[] { Double.NEGATIVE_INFINITY,
1566: -Double.MAX_VALUE, -2d, -Double.MIN_VALUE, -0d, 0d,
1567: Double.MIN_VALUE, 2d, Double.MAX_VALUE,
1568: Double.POSITIVE_INFINITY, Double.NaN };
1569: for (int i = 0; i < values.length; i++) {
1570: double d1 = values[i];
1571:
1572: // Test that each value compares equal to itself; and each object is
1573: // equal to another object like itself.
1574: assertTrue("Assert 0: compare() should be equal: " + d1,
1575: Double.compare(d1, d1) == 0);
1576: Double objDouble = new Double(d1);
1577: assertTrue("Assert 1: compareTo() should be equal: " + d1,
1578: objDouble.compareTo(objDouble) == 0);
1579:
1580: // Test that the Double-defined order is respected
1581: for (int j = i + 1; j < values.length; j++) {
1582: double d2 = values[j];
1583: assertTrue("Assert 2: compare() " + d1
1584: + " should be less " + d2, Double.compare(d1,
1585: d2) == -1);
1586: assertTrue("Assert 3: compare() " + d2
1587: + " should be greater " + d1, Double.compare(
1588: d2, d1) == 1);
1589: Double D2 = new Double(d2);
1590: assertTrue("Assert 4: compareTo() " + d1
1591: + " should be less " + d2, objDouble
1592: .compareTo(D2) == -1);
1593: assertTrue("Assert 5: compareTo() " + d2
1594: + " should be greater " + d1, D2
1595: .compareTo(objDouble) == 1);
1596: }
1597: }
1598:
1599: try {
1600: new Double(0.0D).compareTo(null);
1601: fail("No NPE");
1602: } catch (NullPointerException e) {
1603: }
1604: }
1605:
1606: /**
1607: * @tests java.lang.Double#equals(java.lang.Object)
1608: */
1609: public void test_equalsLjava_lang_Object() {
1610: Double d1 = new Double(87654321.12345d);
1611: Double d2 = new Double(87654321.12345d);
1612: Double d3 = new Double(0.0002f);
1613: assertTrue("Assert 0: Equality test failed", d1.equals(d2)
1614: && !(d1.equals(d3)));
1615:
1616: assertTrue("Assert 2: NaN should not be == Nan",
1617: Double.NaN != Double.NaN);
1618: assertTrue("Assert 3: NaN should not be == Nan", new Double(
1619: Double.NaN).equals(new Double(Double.NaN)));
1620: assertTrue("Assert 4: -0d should be == 0d", 0d == -0d);
1621: assertTrue("Assert 5: -0d should not be equals() 0d",
1622: !new Double(0d).equals(new Double(-0d)));
1623:
1624: Double dmax = new Double(Double.MAX_VALUE);
1625: Double dmax1 = new Double(Double.MAX_VALUE);
1626:
1627: assertTrue("Equality test failed", dmax.equals(dmax1)
1628: && !(dmax.equals(new Object())));
1629: }
1630:
1631: /**
1632: * @tests java.lang.Double#toHexString(double)
1633: */
1634: public void test_toHexStringF() {
1635: // the follow values come from the Double Javadoc/Spec
1636: assertEquals("0x0.0p0", Double.toHexString(0.0D));
1637: assertEquals("-0x0.0p0", Double.toHexString(-0.0D));
1638: assertEquals("0x1.0p0", Double.toHexString(1.0D));
1639: assertEquals("-0x1.0p0", Double.toHexString(-1.0D));
1640: assertEquals("0x1.0p1", Double.toHexString(2.0D));
1641: assertEquals("0x1.8p1", Double.toHexString(3.0D));
1642: assertEquals("0x1.0p-1", Double.toHexString(0.5D));
1643: assertEquals("0x1.0p-2", Double.toHexString(0.25D));
1644: assertEquals("0x1.fffffffffffffp1023", Double
1645: .toHexString(Double.MAX_VALUE));
1646: assertEquals("0x0.0000000000001p-1022", Double
1647: .toHexString(Double.MIN_VALUE));
1648:
1649: // test edge cases
1650: assertEquals("NaN", Double.toHexString(Double.NaN));
1651: assertEquals("-Infinity", Double
1652: .toHexString(Double.NEGATIVE_INFINITY));
1653: assertEquals("Infinity", Double
1654: .toHexString(Double.POSITIVE_INFINITY));
1655:
1656: // test various numbers
1657: assertEquals("-0x1.da8p6", Double.toHexString(-118.625D));
1658: assertEquals("0x1.2957874cccccdp23", Double
1659: .toHexString(9743299.65D));
1660: assertEquals("0x1.2957874cccccdp23", Double
1661: .toHexString(9743299.65000D));
1662: assertEquals("0x1.2957874cccf63p23", Double
1663: .toHexString(9743299.650001234D));
1664: assertEquals("0x1.700d1061d3333p33", Double
1665: .toHexString(12349743299.65000D));
1666:
1667: // test HARMONY-2132
1668: assertEquals("0x1.01p10", Double.toHexString(0x1.01p10));
1669: }
1670:
1671: /**
1672: * @tests java.lang.Double#valueOf(double)
1673: */
1674: public void test_valueOfD() {
1675: assertEquals(new Double(Double.MIN_VALUE), Double
1676: .valueOf(Double.MIN_VALUE));
1677: assertEquals(new Double(Double.MAX_VALUE), Double
1678: .valueOf(Double.MAX_VALUE));
1679: assertEquals(new Double(0), Double.valueOf(0));
1680:
1681: int s = -128;
1682: while (s < 128) {
1683: assertEquals(new Double(s), Double.valueOf(s));
1684: assertEquals(new Double(s + 0.1D), Double.valueOf(s + 0.1D));
1685: s++;
1686: }
1687: }
1688: }
|