/* ---------------------------------------------------------------------------------------------------*/ /* Port of the Intel Decimal Floating-Point Math Library decimal128 type to Rust. */ /* decmathlib-rs - Copyright (C) 2023-2024 Carlos Guzmán Álvarez */ /* -------------------------------------------------------------------------------------------------- */ /* Licensed under the MIT license. See LICENSE file in the project root for full license information. */ /* -------------------------------------------------------------------------------------------------- */ /* Intel® Decimal Floating-Point Math Library - Copyright (c) 2018 Intel Corp. */ /* -------------------------------------------------------------------------------------------------- */ mod common; dec_test!(bid128_quantize_001, bid128_quantize, 0, 0x00000000000000000000100060000000u128, 0x820566eb80e0139418f566ef868385d2u128, 0x02040000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_002, bid128_quantize, 0, 0x00000000000000001610200006222111u128, 0x0002401020100241fffff7f7efffffffu128, 0x00020000000000000234d000009d034eu128, 0x20); dec_test!(bid128_quantize_003, bid128_quantize, 0, 0x0000074c00400450ffffffffffffffffu128, 0x8012011e02800364ed11b512401fe044u128, 0x0012000000001f5700cb7221e4090718u128, 0x20); dec_test!(bid128_quantize_004, bid128_quantize, 0, 0x0000082810280a10ffffffffffffffffu128, 0x00408000acdd28c0f8ece02f0f48244cu128, 0x00400000000000000000000000000002u128, 0x20); dec_test!(bid128_quantize_005, bid128_quantize, 0, 0x00005804812821006d42034c46a1f61fu128, 0x8000800100100200d3f9dfb2c5cef66du128, 0x00005804812821006d42034c46a1f61fu128, 0x00); dec_test!(bid128_quantize_006, bid128_quantize, 0, 0x00006000002000020240010000080000u128, 0x00025008001000408018a69708d9bb40u128, 0x00020999999ccccd003999b333340000u128, 0x00); dec_test!(bid128_quantize_007, bid128_quantize, 0, 0x0001ed09bead87c0378d8e62ffffffffu128, 0x0001ed09bead87c0378d8e62ffffffffu128, 0x0001ed09bead87c0378d8e62ffffffffu128, 0x00); dec_test!(bid128_quantize_008, bid128_quantize, 0, 0x0001ed09bead87c0378d8e62ffffffffu128, 0x0001ed09bead87c0378d8e64ffffffffu128, 0x0001ed09bead87c0378d8e62ffffffffu128, 0x00); dec_test!(bid128_quantize_009, bid128_quantize, 0, 0x0001ed09bead87c0378d8e62ffffffffu128, 0x7c003fffffffffff38c15b08ffffffffu128, 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_010, bid128_quantize, 0, 0x0001ed09bead87c0378d8e62ffffffffu128, 0x7c003fffffffffff38c15b0affffffffu128, 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_011, bid128_quantize, 0, 0x0001ed09bead87c0378d8e64ffffffffu128, 0x0001ed09bead87c0378d8e62ffffffffu128, 0x00000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_012, bid128_quantize, 0, 0x0001ed09bead87c0378d8e64ffffffffu128, 0x0001ed09bead87c0378d8e64ffffffffu128, 0x00000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_013, bid128_quantize, 0, 0x0001ed09bead87c0378d8e64ffffffffu128, 0x7c003fffffffffff38c15b08ffffffffu128, 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_014, bid128_quantize, 0, 0x0001ed09bead87c0378d8e64ffffffffu128, 0x7c003fffffffffff38c15b0affffffffu128, 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_015, bid128_quantize, 0, 0x001c1a6704b88825dbfb7bfe86a7fbbeu128, 0x804a9f3bc0032f0c2a802e4d7ed4eb0du128, 0x004a000000000000000000013f2f84e3u128, 0x20); dec_test!(bid128_quantize_016, bid128_quantize, 0, 0x0048340020520108fffffff7ffffffffu128, 0xbfc05700cd8d2603fadf57fabf5b59ffu128, 0x3fc00000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_017, bid128_quantize, 0, 0x01008424932b49013e84000801198090u128, 0xfefdbfbb77bef7d50000000000000000u128, 0xfc000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_018, bid128_quantize, 0, 0x0317ad53a2f38658ac702810b78c8969u128, 0x7c000da427cacaa02adb73ee8e5b5d09u128, 0x7c000da427cacaa02adb73ee8e5b5d09u128, 0x00); dec_test!(bid128_quantize_019, bid128_quantize, 0, 0x07a616f2d04f7332fb0032afc8539c88u128, 0x8bd82f907f0b99284046d547d95d54b8u128, 0x0bd80000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_020, bid128_quantize, 0, 0x0e460000000000000000000000000000u128, 0x55b099499050918f94d2a72b47746a89u128, 0x55b00000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_021, bid128_quantize, 0, "-0" , "Infinity" , 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_022, bid128_quantize, 0, 0 , "Infinity" , 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_023, bid128_quantize, 0, "-0" , "QNaN" , 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_024, bid128_quantize, 0, 0 , "QNaN" , 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_025, bid128_quantize, 0, "-110000.0010E0" , "-0" , 0xb040000000000000000000000001adb0u128, 0x20); dec_test!(bid128_quantize_026, bid128_quantize, 0, "+110.1110E0" , "-0" , 0x3040000000000000000000000000006eu128, 0x20); dec_test!(bid128_quantize_027, bid128_quantize, 0, 0x127ca4be7ad5bbfd4498c20609a39545u128, 0xb2b4b68ea656aae4143c13c5d6c97f46u128, 0x32b40000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_028, bid128_quantize, 0, 0x14600000000000000000000000000000u128, 0x15dc0000000000000000000000000000u128, 0x15dc0000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_029, bid128_quantize, 0, 0x15420000000000000000000000000000u128, 0x5396e39f16ea88ac86f61f04eb8a5f62u128, 0x53960000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_030, bid128_quantize, 0, 0x18658478fea6699101929d3e1993abceu128, 0x9885acebc94b8554aba2db078fcc5b91u128, 0x18840000000000000aef3d876944ddf5u128, 0x20); dec_test!(bid128_quantize_031, bid128_quantize, 0, 0x2008800040004000416a159ca87aab48u128, 0x2013000008000422698d7b970a5c01b2u128, 0x2012000053e3001522a71ed3e683aacau128, 0x20); dec_test!(bid128_quantize_032, bid128_quantize, 0, "-235966.842464759E0" , "-0" , 0xb04000000000000000000000000399bfu128, 0x20); dec_test!(bid128_quantize_033, bid128_quantize, 0, 0x25120000000000000000000000000000u128, 0xc390d9185dbc4017026b514940e3dc94u128, 0x43900000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_034, bid128_quantize, 0, 0x258cf530be36efede87019c05db9b066u128, 0xad0cc6f7d9582c434eed3d8189fc2cabu128, 0x2d0c0000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_035, bid128_quantize, 0, 0x278d4bdeb45d6a1b3bd2aef591340174u128, 0x097eecb487fc439634d6bf3c517b9b96u128, 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_036, bid128_quantize, 0, 0x2f4a0000000000000000000000000000u128, 0x497b8bb3a24afd37bafe778ff9d91e43u128, 0x497a0000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_037, bid128_quantize, 0, "+3536258257868.3E0" , 0 , 0x304000000000000000000337596ad3ccu128, 0x20); dec_test!(bid128_quantize_038, bid128_quantize, 0, 0x36ca0000000000000000000000000000u128, 0x9dec0000000000000000000000000000u128, 0x1dec0000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_039, bid128_quantize, 0, 0x378d6995f3537d4cb953fe8ffaa04ec6u128, 0x3c6cc5622e19c4b48fa2cd1f88e4bb1fu128, 0x3c6c0000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_040, bid128_quantize, 0, 0x3ebfbba58edd28f928da2fee723c8d53u128, 0x5585386f13b2c6ebc74b158f64409529u128, 0x55840000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_041, bid128_quantize, 0, 0x41740000000000000000000000000000u128, 0x20983d15325e37cbeb5d58cb61ee040cu128, 0x20980000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_042, bid128_quantize, 0, 0x487bd6cf88f54ebde851a54b7da97092u128, 0xf225cd5df9e39929249bcd1a45b817b2u128, 0x48960000000000052d36d9de86fb410fu128, 0x20); dec_test!(bid128_quantize_043, bid128_quantize, 0, 0x48f355a706021ca04d48e40b3146118au128, 0xeff968b27ffe5ded9020a0c036120428u128, 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_044, bid128_quantize, 0, 0x5b11554467e1276f3694dc660d713588u128, 0x7c0004df5c25ce73a780ffdfbcdb9ca7u128, 0x7c0004df5c25ce73a780ffdfbcdb9ca7u128, 0x00); dec_test!(bid128_quantize_045, bid128_quantize, 0, 0x6ffe7fbffffeffff8e15c3020082088du128, 0xf2bfa228d36adfab320db63346df258fu128, 0x4afe0000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_046, bid128_quantize, 0, 0x78000000000000000000000000000000u128, 0x5ffe04ee2d6d415b85acef8100000000u128, 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_047, bid128_quantize, 0, 0x78000000000000000000000000000000u128, 0x78000000000000000000000000000001u128, 0x78000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_048, bid128_quantize, 0, 0x78000000000000000000000000000001u128, 0x78000000000000000000000000000000u128, 0x78000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_049, bid128_quantize, 0, 0x79a1e0a3be2f5c99ff9ebfe374274b5fu128, 0xfbc19fe3ed75fa7d0000244020800084u128, 0x78000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_050, bid128_quantize, 0, 0x7c003fffffffffff38c15b08ffffffffu128, 0x0001ed09bead87c0378d8e62ffffffffu128, 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_051, bid128_quantize, 0, 0x7c003fffffffffff38c15b08ffffffffu128, 0x0001ed09bead87c0378d8e64ffffffffu128, 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_052, bid128_quantize, 0, 0x7c003fffffffffff38c15b08ffffffffu128, 0x7c003fffffffffff38c15b08ffffffffu128, 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_053, bid128_quantize, 0, 0x7c003fffffffffff38c15b08ffffffffu128, 0x7c003fffffffffff38c15b0affffffffu128, 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_054, bid128_quantize, 0, 0x7c003fffffffffff38c15b0affffffffu128, 0x0001ed09bead87c0378d8e62ffffffffu128, 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_055, bid128_quantize, 0, 0x7c003fffffffffff38c15b0affffffffu128, 0x0001ed09bead87c0378d8e64ffffffffu128, 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_056, bid128_quantize, 0, 0x7c003fffffffffff38c15b0affffffffu128, 0x7c003fffffffffff38c15b08ffffffffu128, 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_057, bid128_quantize, 0, 0x7c003fffffffffff38c15b0affffffffu128, 0x7c003fffffffffff38c15b0affffffffu128, 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_058, bid128_quantize, 0, 0x7ebfbeccd7abf7fdffffeffffffffefbu128, 0xfdfff7fdfdff9ffb154f9e0a8fb757a1u128, 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_059, bid128_quantize, 0, "+88.898E0" , 0 , 0x30400000000000000000000000000059u128, 0x20); dec_test!(bid128_quantize_060, bid128_quantize, 0, "+8989.88E0" , 0 , 0x3040000000000000000000000000231eu128, 0x20); dec_test!(bid128_quantize_061, bid128_quantize, 0, 0x8e339aa49d88979a5467866bb6b67349u128, 0xa2980000000000000000000000000000u128, 0xa2980000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_062, bid128_quantize, 0, "+96997.5E0" , 0 , 0x30400000000000000000000000017ae6u128, 0x20); dec_test!(bid128_quantize_063, bid128_quantize, 0, 0xa711835bb7fbf4fcfffef7ffbfffbfffu128, 0x69c9dbd1f8569db059f2b08e18c3d94au128, 0xa7260000000010a30c9e15558eea132fu128, 0x20); dec_test!(bid128_quantize_064, bid128_quantize, 0, 0xadff85b190fcaaac5219533da67d59cfu128, 0xbbbd44f5451646d7938da7fca7369c84u128, 0xbbbc0000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_065, bid128_quantize, 0, 0xba549782656c1244c82f4821be74a47cu128, 0x592516a2289ab46b6c9615a262c38a5au128, 0xd9240000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_066, bid128_quantize, 0, 0xbcbffbbddbdf9f730040000000420000u128, 0x808100001c0413010000000000000040u128, 0x80800000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_067, bid128_quantize, 0, 0xcf839565fa9f7d3cc86ab6eb6cd6c617u128, 0x50ff156783a76f7015d42d741a58546au128, 0xd0fe0000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_068, bid128_quantize, 0, 0xd5d00499b55b2e23eb11e80ebb7222f9u128, 0xfb01cf53833296690040002000008008u128, 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_069, bid128_quantize, 0, 0xfbcfe6e7fef79d7ffffffbfffffbf7ffu128, 0xcb9f7dabefcfa7eed9c39e5bfadc3fd7u128, 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_070, bid128_quantize, 0, 0xfc000000000000000000000000000000u128, 0x51cb36ec6afc888dae06b38c3248f1adu128, 0xfc000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_071, bid128_quantize, 0, 0xff7ddffffffdff7fa6fdfbefdf686fffu128, 0xe130acd3a2a5938e3f3bf4afc37a18d2u128, 0xfc001ffffffdff7fa6fdfbefdf686fffu128, 0x01); dec_test!(bid128_quantize_072, bid128_quantize, 0, "Infinity" , "Infinity" , 0x78000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_073, bid128_quantize, 0, "-Infinity" , "QNaN" , 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_074, bid128_quantize, 0, "QNaN" , "-0" , 0x7c000000000000000000000000000000u128, 0x00); dec_test!(bid128_quantize_075, bid128_quantize, 0, "SNaN" , "-0" , 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_076, bid128_quantize, 0, "SNaN" , "QNaN" , 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_077, bid128_quantize, 0, "SNaN" , "SNaN" , 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_078, bid128_quantize, 1, 0x00000080000040000fa4fae5db1944d8u128, 0x00404040410600002046024420006000u128, 0x00400000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_079, bid128_quantize, 1, 0x0000074c00400450ffffffffffffffffu128, 0x8012011e02800364ed11b512401fe044u128, 0x0012000000001f5700cb7221e4090718u128, 0x20); dec_test!(bid128_quantize_080, bid128_quantize, 1, 0x2008800040004000416a159ca87aab48u128, 0x2013000008000422698d7b970a5c01b2u128, 0x2012000053e3001522a71ed3e683aacau128, 0x20); dec_test!(bid128_quantize_081, bid128_quantize, 1, 0x487bd6cf88f54ebde851a54b7da97092u128, 0xf225cd5df9e39929249bcd1a45b817b2u128, 0x48960000000000052d36d9de86fb410eu128, 0x20); dec_test!(bid128_quantize_082, bid128_quantize, 1, 0x78000000000000000000000000000000u128, 0x5ffe04ee2d6d415b85acef8100000000u128, 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_083, bid128_quantize, 1, 0x8828fab4bc1daddd70227c1045808242u128, 0x882ab42214100200502c5007a28f9582u128, 0x882a191212cfc49624d03f9b3a26736du128, 0x00); dec_test!(bid128_quantize_084, bid128_quantize, 1, 0xa711835bb7fbf4fcfffef7ffbfffbfffu128, 0x69c9dbd1f8569db059f2b08e18c3d94au128, 0xa7260000000010a30c9e15558eea132fu128, 0x20); dec_test!(bid128_quantize_085, bid128_quantize, 1, 0xa76363b853b50105af79156d828f06cbu128, 0xf7f7ffdbfff367fd0040000000080004u128, 0xdfde0000000000000000000000000001u128, 0x20); dec_test!(bid128_quantize_086, bid128_quantize, 2, 0x00000080000040000fa4fae5db1944d8u128, 0x00404040410600002046024420006000u128, 0x00400000000000000000000000000001u128, 0x20); dec_test!(bid128_quantize_087, bid128_quantize, 2, 0x0000074c00400450ffffffffffffffffu128, 0x8012011e02800364ed11b512401fe044u128, 0x0012000000001f5700cb7221e4090719u128, 0x20); dec_test!(bid128_quantize_088, bid128_quantize, 2, 0x00028040800a20405ddfffbfbf75ffffu128, 0x0010114024388c818bd73bd596f311ccu128, 0x0010000000d72bcb70e256688cb0e7ffu128, 0x20); dec_test!(bid128_quantize_089, bid128_quantize, 2, 0x2008800040004000416a159ca87aab48u128, 0x2013000008000422698d7b970a5c01b2u128, 0x2012000053e3001522a71ed3e683aacbu128, 0x20); dec_test!(bid128_quantize_090, bid128_quantize, 2, 0x487bd6cf88f54ebde851a54b7da97092u128, 0xf225cd5df9e39929249bcd1a45b817b2u128, 0x48960000000000052d36d9de86fb410fu128, 0x20); dec_test!(bid128_quantize_091, bid128_quantize, 2, 0x78000000000000000000000000000000u128, 0x5ffe04ee2d6d415b85acef8100000000u128, 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_092, bid128_quantize, 2, 0x8828fab4bc1daddd70227c1045808242u128, 0x882ab42214100200502c5007a28f9582u128, 0x882a191212cfc49624d03f9b3a26736du128, 0x00); dec_test!(bid128_quantize_093, bid128_quantize, 2, 0xa711835bb7fbf4fcfffef7ffbfffbfffu128, 0x69c9dbd1f8569db059f2b08e18c3d94au128, 0xa7260000000010a30c9e15558eea132eu128, 0x20); dec_test!(bid128_quantize_094, bid128_quantize, 2, 0xa76363b853b50105af79156d828f06cbu128, 0xf7f7ffdbfff367fd0040000000080004u128, 0xdfde0000000000000000000000000000u128, 0x20); dec_test!(bid128_quantize_095, bid128_quantize, 2, 0xb366e0e4b7f9d2187631d010364abdcfu128, 0x33a3c57766f0455bb37286067a508e5bu128, 0xb3a200000000000000000000000011d1u128, 0x20); dec_test!(bid128_quantize_096, bid128_quantize, 3, 0x0000074c00400450ffffffffffffffffu128, 0x8012011e02800364ed11b512401fe044u128, 0x0012000000001f5700cb7221e4090718u128, 0x20); dec_test!(bid128_quantize_097, bid128_quantize, 3, 0x2008800040004000416a159ca87aab48u128, 0x2013000008000422698d7b970a5c01b2u128, 0x2012000053e3001522a71ed3e683aacau128, 0x20); dec_test!(bid128_quantize_098, bid128_quantize, 3, 0x487bd6cf88f54ebde851a54b7da97092u128, 0xf225cd5df9e39929249bcd1a45b817b2u128, 0x48960000000000052d36d9de86fb410eu128, 0x20); dec_test!(bid128_quantize_099, bid128_quantize, 3, 0x78000000000000000000000000000000u128, 0x5ffe04ee2d6d415b85acef8100000000u128, 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_100, bid128_quantize, 3, 0xa711835bb7fbf4fcfffef7ffbfffbfffu128, 0x69c9dbd1f8569db059f2b08e18c3d94au128, 0xa7260000000010a30c9e15558eea132eu128, 0x20); dec_test!(bid128_quantize_101, bid128_quantize, 4, 0x0000074c00400450ffffffffffffffffu128, 0x8012011e02800364ed11b512401fe044u128, 0x0012000000001f5700cb7221e4090718u128, 0x20); dec_test!(bid128_quantize_102, bid128_quantize, 4, 0x2008800040004000416a159ca87aab48u128, 0x2013000008000422698d7b970a5c01b2u128, 0x2012000053e3001522a71ed3e683aacau128, 0x20); dec_test!(bid128_quantize_103, bid128_quantize, 4, 0x487bd6cf88f54ebde851a54b7da97092u128, 0xf225cd5df9e39929249bcd1a45b817b2u128, 0x48960000000000052d36d9de86fb410fu128, 0x20); dec_test!(bid128_quantize_104, bid128_quantize, 4, 0x78000000000000000000000000000000u128, 0x5ffe04ee2d6d415b85acef8100000000u128, 0x7c000000000000000000000000000000u128, 0x01); dec_test!(bid128_quantize_105, bid128_quantize, 4, 0xa711835bb7fbf4fcfffef7ffbfffbfffu128, 0x69c9dbd1f8569db059f2b08e18c3d94au128, 0xa7260000000010a30c9e15558eea132fu128, 0x20);