• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ qIsNaN函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中qIsNaN函数的典型用法代码示例。如果您正苦于以下问题:C++ qIsNaN函数的具体用法?C++ qIsNaN怎么用?C++ qIsNaN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了qIsNaN函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: qIsNaN

int OsmAnd::Utilities::javaDoubleCompare(double l, double r)
{
    const auto lNaN = qIsNaN(l);
    const auto rNaN = qIsNaN(r);
    const auto& li64 = *reinterpret_cast<uint64_t*>(&l);
    const auto& ri64 = *reinterpret_cast<uint64_t*>(&r);
    const auto lPos = (li64 >> 63) == 0;
    const auto rPos = (ri64 >> 63) == 0;
    const auto lZero = (li64 << 1) == 0;
    const auto rZero = (ri64 << 1) == 0;

    // NaN is considered by this method to be equal to itself and greater than all other double values (including +inf).
    if (lNaN && rNaN)
        return 0;
    if (lNaN)
        return +1;
    if (rNaN)
        return -1;

    // 0.0 is considered by this method to be greater than -0.0
    if (lZero && rZero)
    {
        if (lPos && !rPos)
            return -1;
        if (!lPos && rPos)
            return +1;
    }

    // All other cases
    return qCeil(l) - qCeil(r);
}
开发者ID:kendzi,项目名称:OsmAnd-core,代码行数:31,代码来源:Utilities.cpp


示例2: foreach

PointSegment *GcodeParser::processCommand(const QStringList &args)
{
    QList<float> gCodes;
    PointSegment *ps = NULL;

    // Handle F code
    double speed = GcodePreprocessorUtils::parseCoord(args, 'F');
    if (!qIsNaN(speed)) this->m_lastSpeed = this->m_isMetric ? speed : speed * 25.4;

    // Handle S code
    double spindleSpeed = GcodePreprocessorUtils::parseCoord(args, 'S');
    if (!qIsNaN(spindleSpeed)) this->m_lastSpindleSpeed = spindleSpeed;

    // Handle P code
    double dwell = GcodePreprocessorUtils::parseCoord(args, 'P');
    if (!qIsNaN(dwell)) this->m_points.last()->setDwell(dwell);

    // handle G codes.
    gCodes = GcodePreprocessorUtils::parseCodes(args, 'G');

    // If there was no command, add the implicit one to the party.
    if (gCodes.isEmpty() && m_lastGcodeCommand != -1) {
        gCodes.append(m_lastGcodeCommand);
    }

    foreach (float code, gCodes) {
        ps = handleGCode(code, args);
    }
开发者ID:Denvi,项目名称:grblControl,代码行数:28,代码来源:gcodeparser.cpp


示例3: box

void SearchReply::start()
{
    if (request().searchArea().type() == QGeoShape::RectangleType) {
        QGeoRectangle box(request().searchArea());
        if (!box.isValid()) {
            triggerDone(QPlaceReply::BadArgumentError,
                        QString::fromLatin1("Bounding box search area is invalid"));
            return;
        }
    } else if (request().searchArea().type() == QGeoShape::CircleType) {
        QGeoCircle circle(request().searchArea());
        if (!circle.center().isValid() || qIsNaN(circle.center().latitude()) || qIsNaN(circle.center().longitude())) {
            triggerDone(QPlaceReply::BadArgumentError,
                        QString::fromLatin1("The center of the search area is an invalid coordinate"));
            return;
        }
        if (circle.contains(QGeoCoordinate(90,0)) || circle.contains(QGeoCoordinate(-90,0))) {
            triggerDone(QPlaceReply::BadArgumentError,
                        QString::fromLatin1("The search area contains the north or south pole"));
            return;
        }
    }

    if (!request().categories().isEmpty()) {
        foreach (const QPlaceCategory &category, request().categories()) {
            m_catSearchIds.append(categorySearchIds(category.categoryId()));
            db()->searchForPlaces(request(), this, SLOT(searchFinished()), m_catSearchIds);
        }
    } else {
开发者ID:amccarthy,项目名称:qtlocation,代码行数:29,代码来源:searchreply.cpp


示例4: QSKIP

void tst_QNumeric::qNan()
{
#if defined __FAST_MATH__ && (__GNUC__ * 100 + __GNUC_MINOR__ < 404)
    QSKIP("Non-conformant fast math mode is enabled, cannot run test");
#endif
    double nan = qQNaN();
    QVERIFY(!(0 > nan));
    QVERIFY(!(0 < nan));
    QVERIFY(qIsNaN(nan));
    QVERIFY(qIsNaN(nan + 1));
    QVERIFY(qIsNaN(-nan));
    double inf = qInf();
    QVERIFY(inf > 0);
    QVERIFY(-inf < 0);
    QVERIFY(qIsInf(inf));
    QVERIFY(qIsInf(-inf));
    QVERIFY(qIsInf(2*inf));
    QCOMPARE(1/inf, 0.0);
#ifdef Q_CC_INTEL
    QEXPECT_FAIL("", "ICC optimizes zero * anything to zero", Continue);
#endif
    QVERIFY(qIsNaN(0*nan));
#ifdef Q_CC_INTEL
    QEXPECT_FAIL("", "ICC optimizes zero * anything to zero", Continue);
#endif
    QVERIFY(qIsNaN(0*inf));
    QVERIFY(qFuzzyCompare(1/inf, 0.0));
}
开发者ID:oneywang,项目名称:qtbase,代码行数:28,代码来源:tst_qnumeric.cpp


示例5: Q_UNUSED

void QgsSingleBandGrayRendererWidget::loadMinMax( int theBandNo, double theMin, double theMax )
{
  Q_UNUSED( theBandNo );

  QgsDebugMsg( QString( "theBandNo = %1 theMin = %2 theMax = %3" ).arg( theBandNo ).arg( theMin ).arg( theMax ) );

  mDisableMinMaxWidgetRefresh = true;
  if ( qIsNaN( theMin ) )
  {
    mMinLineEdit->clear();
  }
  else
  {
    mMinLineEdit->setText( QString::number( theMin ) );
  }

  if ( qIsNaN( theMax ) )
  {
    mMaxLineEdit->clear();
  }
  else
  {
    mMaxLineEdit->setText( QString::number( theMax ) );
  }
  mDisableMinMaxWidgetRefresh = false;
}
开发者ID:Gustry,项目名称:QGIS,代码行数:26,代码来源:qgssinglebandgrayrendererwidget.cpp


示例6: find_part

/*!
    \qmlmethod point QtLocation::Map::from_coordinate(coordinate coordinate, bool clipToViewPort)

    Returns the position relative to the map item which corresponds to the \a coordinate.

    If \a cliptoViewPort is \c true, or not supplied then returns an invalid QPointF if
    \a coordinate is not within the current viewport.
*/
QcVectorDouble
QcViewport::coordinate_to_screen(const QcVectorDouble & projected_coordinate, bool clip_to_viewport) const
{
  // qInfo() << coordinate << clip_to_viewport
  //         << (int)projected_coordinate.x() << (int)projected_coordinate.y();

  const QcViewportPart * part = find_part(projected_coordinate);
  if (!part) {
    qWarning() << "out of domain";
    return QcVectorDouble(qQNaN(), qQNaN());
  }

  QcVectorDouble screen_position = to_px(part->map_vector(projected_coordinate));

  // Fixme: purpose
  if (clip_to_viewport) {
    int w = width();
    int h = height();
    double x = screen_position.x();
    double y = screen_position.y();
    if ((x < 0.0) || (x > w) || (y < 0) || (y > h) || qIsNaN(x) || qIsNaN(y))
      return QcVectorDouble(qQNaN(), qQNaN());
  }

  // qInfo() << screen_position;

  return screen_position;
}
开发者ID:FabriceSalvaire,项目名称:qtcarto,代码行数:36,代码来源:viewport.cpp


示例7: qQNaN

void tst_QNumeric::qNan()
{
    double nan = qQNaN();
#if defined( __INTEL_COMPILER)
    QCOMPARE((0 > nan), false);
    QCOMPARE((0 < nan), false);
    QSKIP("This fails due to a bug in the Intel Compiler", SkipAll);
#else
    if (0 > nan)
        QFAIL("compiler thinks 0 > nan");

#  if defined(Q_CC_DIAB)
    QWARN("!(0 < nan) would fail due to a bug in dcc");
#  else
    if (0 < nan)
        QFAIL("compiler thinks 0 < nan");
#  endif
#endif
    QVERIFY(qIsNaN(nan));
    QVERIFY(qIsNaN(nan + 1));
    QVERIFY(qIsNaN(-nan));
    double inf = qInf();
    QVERIFY(inf > 0);
    QVERIFY(-inf < 0);
    QVERIFY(qIsInf(inf));
    QVERIFY(qIsInf(-inf));
    QVERIFY(qIsInf(2*inf));
    QCOMPARE(1/inf, 0.0);
    QVERIFY(qIsNaN(0*nan));
    QVERIFY(qIsNaN(0*inf));
    QVERIFY(qFuzzyCompare(1/inf, 0.0));
}
开发者ID:tsuibin,项目名称:emscripten-qt,代码行数:32,代码来源:tst_qnumeric.cpp


示例8: alphaValue

/**
  Searches through the transparency list, if a match is found, the global transparency value is scaled
  by the stored transparency value.
  @param theRedValue the red portion of the needle to search for in the transparency hay stack
  @param theGreenValue  the green portion of the needle to search for in the transparency hay stack
  @param theBlueValue the green portion of the needle to search for in the transparency hay stack
  @param theGlobalTransparency  the overal transparency level for the layer
*/
int QgsRasterTransparency::alphaValue( double theRedValue, double theGreenValue, double theBlueValue, int theGlobalTransparency ) const
{
  //if NaN return 0, transparent
  if ( qIsNaN( theRedValue ) || qIsNaN( theGreenValue ) || qIsNaN( theBlueValue ) )
  {
    return 0;
  }

  //Search through the transparency list looking for a match
  bool myTransparentPixelFound = false;
  TransparentThreeValuePixel myTransparentPixel = {0, 0, 0, 100};
  for ( int myListRunner = 0; myListRunner < mTransparentThreeValuePixelList.count(); myListRunner++ )
  {
    myTransparentPixel = mTransparentThreeValuePixelList[myListRunner];
    if ( myTransparentPixel.red == theRedValue )
    {
      if ( myTransparentPixel.green == theGreenValue )
      {
        if ( myTransparentPixel.blue == theBlueValue )
        {
          myTransparentPixelFound = true;
          break;
        }
      }
    }
  }

  //if a match was found use the stored transparency percentage
  if ( myTransparentPixelFound )
  {
    return ( int )(( float )theGlobalTransparency *( 1.0 - ( myTransparentPixel.percentTransparent / 100.0 ) ) );
  }

  return theGlobalTransparency;
}
开发者ID:dakcarto,项目名称:QGIS,代码行数:43,代码来源:qgsrastertransparency.cpp


示例9: qIsNaN

bool QPlaceResultPrivate::compare(const QPlaceSearchResultPrivate *other) const
{
    const QPlaceResultPrivate *od = static_cast<const QPlaceResultPrivate *>(other);
    return QPlaceSearchResultPrivate::compare(other)
           && ((qIsNaN(distance) && qIsNaN(od->distance))
                || qFuzzyCompare(distance, od->distance))
           && place == od->place
           && sponsored == od->sponsored;
}
开发者ID:agunnarsson,项目名称:qtlocation,代码行数:9,代码来源:qplaceresult.cpp


示例10: reload

void GeoReverseGeocode::reload()
{
    if (qIsNaN(latitude())) return;
    if (qIsNaN(longitude())) return;
    if (qFuzzyCompare(latitude(), 0.0)) return;
    if (qFuzzyCompare(longitude(), 0.0)) return;

    AbstractTwitterModel::reload();
}
开发者ID:yuntan,项目名称:twitter4qml,代码行数:9,代码来源:georeversegeocode.cpp


示例11: eraseLineTo

void UBWidgetUniboardAPI::eraseLineTo(const qreal x, const qreal y, const qreal pWidth)
{
    if (qIsNaN(x) || qIsNaN(y) || qIsNaN(pWidth)
       || qIsInf(x) || qIsInf(y) || qIsInf(pWidth))
       return;

    if (mScene)
    mScene->eraseLineTo(QPointF(x, y), pWidth);
}
开发者ID:hethi,项目名称:Sankore-3.1,代码行数:9,代码来源:UBWidgetUniboardAPI.cpp


示例12: moveTo

void UBWidgetUniboardAPI::moveTo(const qreal x, const qreal y)
{
    if (qIsNaN(x) || qIsNaN(y)
        || qIsInf(x) || qIsInf(y))
        return;

    if (mScene)
    mScene->moveTo(QPointF(x, y));
}
开发者ID:hethi,项目名称:Sankore-3.1,代码行数:9,代码来源:UBWidgetUniboardAPI.cpp


示例13: fix

void Test_ATCAbstractFix::test_constructObject_incorrectLat()
{
    Mock_ATCAbstractFix fix(-91, 50);
    QVERIFY(qIsNaN(fix.latitude()));
    QVERIFY(qIsNaN(fix.longitude()));

    fix = Mock_ATCAbstractFix(91, 50);
    QVERIFY(qIsNaN(fix.latitude()));
    QVERIFY(qIsNaN(fix.longitude()));
}
开发者ID:ignmiz,项目名称:ATC_Console,代码行数:10,代码来源:test_atcabstractfix.cpp


示例14: drawLineTo

void UBWidgetUniboardAPI::drawLineTo(const qreal x, const qreal y, const qreal pWidth)
{
    if (qIsNaN(x) || qIsNaN(y) || qIsNaN(pWidth)
        || qIsInf(x) || qIsInf(y) || qIsInf(pWidth))
        return;

    if (mScene)
    mScene->drawLineTo(QPointF(x, y), pWidth,
        UBDrawingController::drawingController()->stylusTool() == UBStylusTool::Line);
}
开发者ID:hethi,项目名称:Sankore-3.1,代码行数:10,代码来源:UBWidgetUniboardAPI.cpp


示例15: resize

void UBWidgetUniboardAPI::resize(qreal width, qreal height)
{
    if (qIsNaN(width) || qIsNaN(height)
        || qIsInf(width) || qIsInf(height))
        return;

    if (mGraphicsWidget)
    {
        mGraphicsWidget->resize(width, height);
    }
}
开发者ID:hethi,项目名称:Sankore-3.1,代码行数:11,代码来源:UBWidgetUniboardAPI.cpp


示例16: move

void UBWidgetUniboardAPI::move(const qreal x, const qreal y)
{
    if (qIsNaN(x) || qIsNaN(y)
        || qIsInf(x) || qIsInf(y))
        return;

    if (UBApplication::boardController->activeScene() != mScene)
        return;

    UBApplication::boardController->handScroll(x, y);
}
开发者ID:hethi,项目名称:Sankore-3.1,代码行数:11,代码来源:UBWidgetUniboardAPI.cpp


示例17: centerOn

void UBWidgetUniboardAPI::centerOn(const qreal x, const qreal y)
{
   if (qIsNaN(x) || qIsNaN(y)
       || qIsInf(x) || qIsInf(y))
       return;

    if (UBApplication::boardController->activeScene() != mScene)
        return;

    UBApplication::boardController->centerOn(QPointF(x, y));
}
开发者ID:hethi,项目名称:Sankore-3.1,代码行数:11,代码来源:UBWidgetUniboardAPI.cpp


示例18: zoom

void UBWidgetUniboardAPI::zoom(const qreal factor, const qreal x, const qreal y)
{
   if (qIsNaN(factor) || qIsNaN(x) || qIsNaN(y)
       || qIsInf(factor) || qIsInf(x) || qIsInf(y))
       return;


    if (UBApplication::boardController->activeScene() != mScene)
        return;

    UBApplication::boardController->zoom(factor, QPointF(x, y));
}
开发者ID:hethi,项目名称:Sankore-3.1,代码行数:12,代码来源:UBWidgetUniboardAPI.cpp


示例19: isFinite

bool QgsRectangle::isFinite() const
{
  if ( qIsInf( xmin ) || qIsInf( ymin ) || qIsInf( xmax ) || qIsInf( ymax ) )
  {
    return false;
  }
  if ( qIsNaN( xmin ) || qIsNaN( ymin ) || qIsNaN( xmax ) || qIsNaN( ymax ) )
  {
    return false;
  }
  return true;
}
开发者ID:carsonfarmer,项目名称:Quantum-GIS,代码行数:12,代码来源:qgsrectangle.cpp


示例20: addText

void UBWidgetUniboardAPI::addText(const QString& text, const qreal x, const qreal y, const int size, const QString& font
        , bool bold, bool italic)
{
    if (qIsNaN(x) || qIsNaN(y)
        || qIsInf(x) || qIsInf(y))
        return;

    if (UBApplication::boardController->activeScene() != mScene)
        return;

    if (mScene)
        mScene->addTextWithFont(text, QPointF(x, y), size, font, bold, italic);

}
开发者ID:hethi,项目名称:Sankore-3.1,代码行数:14,代码来源:UBWidgetUniboardAPI.cpp



注:本文中的qIsNaN函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ qLog函数代码示例发布时间:2022-05-30
下一篇:
C++ qInstallMsgHandler函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap