void test1() { auto F = initLazySecondOrderRecurrenceRelation(); qDebug() << " sqrt( 5) - 1 / 4" << x_mpf( 5, 1, 4) << A_mpf(x_mpf( 5, 1, 4), &F, 0.00000000001); qDebug() << "(sqrt( 4) - 0) / 5" << x_mpf( 4, 0, 5) << A_mpf(x_mpf( 4, 0, 5), &F, 0.00000000001); qDebug() << "(sqrt( 22) - 2) / 6" << x_mpf( 22, 2, 6) << A_mpf(x_mpf( 22, 2, 6), &F, 0.00000000001); qDebug() << "(sqrt( 137) - 5) / 14" << x_mpf( 137, 5, 14) << A_mpf(x_mpf( 137, 5, 14), &F, 0.00000000001); qDebug() << "(sqrt( 1) - 0) / 2" << x_mpf( 1, 0, 2) << A_mpf(x_mpf( 1, 0, 2), &F, 0.00000000001); QMultiMap<mpf_class, QList<int>> xs; for (int a = 1; a < 4000; a += 1) { //if (isSquare(a) == false) { continue; } // show only nuggets for (int b = 1; b < 1000; b += 1) { int c = 6 + (b-1)*2; xs.insert(x_mpf(a, b, c), {a, b, c}); } } QMapIterator<mpf_class, QList<int>> i(xs); while (i.hasNext()) { i.next(); if (i.key() >= 0.309 && i.key() < 0.6) { mpf_class result = A_mpf(i.key(), &F, 0.000000001); mpf_class resultCeil; mpf_ceil(resultCeil.get_mpf_t(), result.get_mpf_t()); if (resultCeil - result <= 0.0001 && resultCeil+1 == i.value()[1]) { // reduce results to specific c values //if (resultCeil - result <= 0.0001) { qDebug() << i.key() << i.value() << result << isSquare(i.value()[0]); } } } }
int sg_big_float_ceil(sg_big_float_t* dst, const sg_big_float_t* src) { if (!dst || !src) return -1; mpf_ceil(dst->mpf, src->mpf); return 0; }
/** * rasqal_xsd_decimal_ceil: * @result: result variable * @a: argment decimal * * Return the number with no fractional part closes to argument for an XSD Decimal * * Return value: non-0 on failure **/ int rasqal_xsd_decimal_ceil(rasqal_xsd_decimal* result, rasqal_xsd_decimal* a) { int rc = 0; rasqal_xsd_decimal_clear_string(result); #if defined(RASQAL_DECIMAL_C99) || defined(RASQAL_DECIMAL_NONE) result->raw = ceil(a->raw); #endif #ifdef RASQAL_DECIMAL_MPFR mpfr_ceil(result->raw, a->raw); #endif #ifdef RASQAL_DECIMAL_GMP mpf_ceil(result->raw, a->raw); #endif return rc; }