/* the following examples come from the paper "Number-theoretic Test Generation for Directed Rounding" from Michael Parks, Table 1 */ static void check_float (void) { check24("8388609.0", "8388609.0", MPFR_RNDN, "70368760954880.0"); check24("16777213.0", "8388609.0", MPFR_RNDN, "140737479966720.0"); check24("8388611.0", "8388609.0", MPFR_RNDN, "70368777732096.0"); check24("12582911.0", "8388610.0", MPFR_RNDN, "105553133043712.0"); check24("12582914.0", "8388610.0", MPFR_RNDN, "105553158209536.0"); check24("13981013.0", "8388611.0", MPFR_RNDN, "117281279442944.0"); check24("11184811.0", "8388611.0", MPFR_RNDN, "93825028587520.0"); check24("11184810.0", "8388611.0", MPFR_RNDN, "93825020198912.0"); check24("13981014.0", "8388611.0", MPFR_RNDN, "117281287831552.0"); check24("8388609.0", "8388609.0", MPFR_RNDZ, "70368760954880.0"); check24("16777213.0", "8388609.0", MPFR_RNDZ, "140737471578112.0"); check24("8388611.0", "8388609.0", MPFR_RNDZ, "70368777732096.0"); check24("12582911.0", "8388610.0", MPFR_RNDZ, "105553124655104.0"); check24("12582914.0", "8388610.0", MPFR_RNDZ, "105553158209536.0"); check24("13981013.0", "8388611.0", MPFR_RNDZ, "117281271054336.0"); check24("11184811.0", "8388611.0", MPFR_RNDZ, "93825028587520.0"); check24("11184810.0", "8388611.0", MPFR_RNDZ, "93825011810304.0"); check24("13981014.0", "8388611.0", MPFR_RNDZ, "117281287831552.0"); check24("8388609.0", "8388609.0", MPFR_RNDU, "70368769343488.0"); check24("16777213.0", "8388609.0", MPFR_RNDU, "140737479966720.0"); check24("8388611.0", "8388609.0", MPFR_RNDU, "70368786120704.0"); check24("12582911.0", "8388610.0", MPFR_RNDU, "105553133043712.0"); check24("12582914.0", "8388610.0", MPFR_RNDU, "105553166598144.0"); check24("13981013.0", "8388611.0", MPFR_RNDU, "117281279442944.0"); check24("11184811.0", "8388611.0", MPFR_RNDU, "93825036976128.0"); check24("11184810.0", "8388611.0", MPFR_RNDU, "93825020198912.0"); check24("13981014.0", "8388611.0", MPFR_RNDU, "117281296220160.0"); check24("8388609.0", "8388609.0", MPFR_RNDD, "70368760954880.0"); check24("16777213.0", "8388609.0", MPFR_RNDD, "140737471578112.0"); check24("8388611.0", "8388609.0", MPFR_RNDD, "70368777732096.0"); check24("12582911.0", "8388610.0", MPFR_RNDD, "105553124655104.0"); check24("12582914.0", "8388610.0", MPFR_RNDD, "105553158209536.0"); check24("13981013.0", "8388611.0", MPFR_RNDD, "117281271054336.0"); check24("11184811.0", "8388611.0", MPFR_RNDD, "93825028587520.0"); check24("11184810.0", "8388611.0", MPFR_RNDD, "93825011810304.0"); check24("13981014.0", "8388611.0", MPFR_RNDD, "117281287831552.0"); }
/* the following examples come from the paper "Number-theoretic Test Generation for Directed Rounding" from Michael Parks, Table 2 */ static void check_float(void) { check24("70368760954880.0", "8388609.0", MPFR_RNDN, "8.388609e6"); check24("140737479966720.0", "16777213.0", MPFR_RNDN, "8.388609e6"); check24("70368777732096.0", "8388611.0", MPFR_RNDN, "8.388609e6"); check24("105553133043712.0", "12582911.0", MPFR_RNDN, "8.38861e6"); /* the exponent for the following example was forgotten in the Arith'14 version of Parks' paper */ check24 ("12582913.0", "12582910.0", MPFR_RNDN, "1.000000238"); check24 ("105553124655104.0", "12582910.0", MPFR_RNDN, "8388610.0"); check24("140737479966720.0", "8388609.0", MPFR_RNDN, "1.6777213e7"); check24("70368777732096.0", "8388609.0", MPFR_RNDN, "8.388611e6"); check24("105553133043712.0", "8388610.0", MPFR_RNDN, "1.2582911e7"); check24("105553124655104.0", "8388610.0", MPFR_RNDN, "1.258291e7"); check24("70368760954880.0", "8388609.0", MPFR_RNDZ, "8.388608e6"); check24("140737479966720.0", "16777213.0", MPFR_RNDZ, "8.388609e6"); check24("70368777732096.0", "8388611.0", MPFR_RNDZ, "8.388608e6"); check24("105553133043712.0", "12582911.0", MPFR_RNDZ, "8.38861e6"); check24("12582913.0", "12582910.0", MPFR_RNDZ, "1.000000238"); check24 ("105553124655104.0", "12582910.0", MPFR_RNDZ, "8388610.0"); check24("140737479966720.0", "8388609.0", MPFR_RNDZ, "1.6777213e7"); check24("70368777732096.0", "8388609.0", MPFR_RNDZ, "8.38861e6"); check24("105553133043712.0", "8388610.0", MPFR_RNDZ, "1.2582911e7"); check24("105553124655104.0", "8388610.0", MPFR_RNDZ, "1.258291e7"); check24("70368760954880.0", "8388609.0", MPFR_RNDU, "8.388609e6"); check24("140737479966720.0", "16777213.0", MPFR_RNDU, "8.38861e6"); check24("70368777732096.0", "8388611.0", MPFR_RNDU, "8.388609e6"); check24("105553133043712.0", "12582911.0", MPFR_RNDU, "8.388611e6"); check24("12582913.0", "12582910.0", MPFR_RNDU, "1.000000357"); check24 ("105553124655104.0", "12582910.0", MPFR_RNDU, "8388611.0"); check24("140737479966720.0", "8388609.0", MPFR_RNDU, "1.6777214e7"); check24("70368777732096.0", "8388609.0", MPFR_RNDU, "8.388611e6"); check24("105553133043712.0", "8388610.0", MPFR_RNDU, "1.2582912e7"); check24("105553124655104.0", "8388610.0", MPFR_RNDU, "1.2582911e7"); check24("70368760954880.0", "8388609.0", MPFR_RNDD, "8.388608e6"); check24("140737479966720.0", "16777213.0", MPFR_RNDD, "8.388609e6"); check24("70368777732096.0", "8388611.0", MPFR_RNDD, "8.388608e6"); check24("105553133043712.0", "12582911.0", MPFR_RNDD, "8.38861e6"); check24("12582913.0", "12582910.0", MPFR_RNDD, "1.000000238"); check24 ("105553124655104.0", "12582910.0", MPFR_RNDD, "8388610.0"); check24("140737479966720.0", "8388609.0", MPFR_RNDD, "1.6777213e7"); check24("70368777732096.0", "8388609.0", MPFR_RNDD, "8.38861e6"); check24("105553133043712.0", "8388610.0", MPFR_RNDD, "1.2582911e7"); check24("105553124655104.0", "8388610.0", MPFR_RNDD, "1.258291e7"); check24("70368760954880.0", "8388609.0", MPFR_RNDA, "8.388609e6"); }
/* the following examples come from the paper "Number-theoretic Test Generation for Directed Rounding" from Michael Parks, Table 3 */ static void check_float (void) { check24("70368760954880.0", MPFR_RNDN, "8.388609e6"); check24("281474943156224.0", MPFR_RNDN, "1.6777215e7"); check24("70368777732096.0", MPFR_RNDN, "8.388610e6"); check24("281474909601792.0", MPFR_RNDN, "1.6777214e7"); check24("100216216748032.0", MPFR_RNDN, "1.0010805e7"); check24("120137273311232.0", MPFR_RNDN, "1.0960715e7"); check24("229674600890368.0", MPFR_RNDN, "1.5155019e7"); check24("70368794509312.0", MPFR_RNDN, "8.388611e6"); check24("281474876047360.0", MPFR_RNDN, "1.6777213e7"); check24("91214552498176.0", MPFR_RNDN, "9.550631e6"); check24("70368760954880.0", MPFR_RNDZ, "8.388608e6"); check24("281474943156224.0", MPFR_RNDZ, "1.6777214e7"); check24("70368777732096.0", MPFR_RNDZ, "8.388609e6"); check24("281474909601792.0", MPFR_RNDZ, "1.6777213e7"); check24("100216216748032.0", MPFR_RNDZ, "1.0010805e7"); check24("120137273311232.0", MPFR_RNDZ, "1.0960715e7"); check24("229674600890368.0", MPFR_RNDZ, "1.5155019e7"); check24("70368794509312.0", MPFR_RNDZ, "8.38861e6"); check24("281474876047360.0", MPFR_RNDZ, "1.6777212e7"); check24("91214552498176.0", MPFR_RNDZ, "9.550631e6"); check24("70368760954880.0", MPFR_RNDU, "8.388609e6"); check24("281474943156224.0",MPFR_RNDU, "1.6777215e7"); check24("70368777732096.0", MPFR_RNDU, "8.388610e6"); check24("281474909601792.0", MPFR_RNDU, "1.6777214e7"); check24("100216216748032.0", MPFR_RNDU, "1.0010806e7"); check24("120137273311232.0", MPFR_RNDU, "1.0960716e7"); check24("229674600890368.0", MPFR_RNDU, "1.515502e7"); check24("70368794509312.0", MPFR_RNDU, "8.388611e6"); check24("281474876047360.0", MPFR_RNDU, "1.6777213e7"); check24("91214552498176.0", MPFR_RNDU, "9.550632e6"); check24("70368760954880.0", MPFR_RNDD, "8.388608e6"); check24("281474943156224.0", MPFR_RNDD, "1.6777214e7"); check24("70368777732096.0", MPFR_RNDD, "8.388609e6"); check24("281474909601792.0", MPFR_RNDD, "1.6777213e7"); check24("100216216748032.0", MPFR_RNDD, "1.0010805e7"); check24("120137273311232.0", MPFR_RNDD, "1.0960715e7"); check24("229674600890368.0", MPFR_RNDD, "1.5155019e7"); check24("70368794509312.0", MPFR_RNDD, "8.38861e6"); check24("281474876047360.0", MPFR_RNDD, "1.6777212e7"); check24("91214552498176.0", MPFR_RNDD, "9.550631e6"); /* check that rounding away is just rounding toward plus infinity */ check24("91214552498176.0", MPFR_RNDA, "9.550632e6"); }