Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-50260

add qRoundReal

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Won't Do
    • Icon: P4: Low P4: Low
    • None
    • None
    • Core: Other
    • None
    • 98aed8c76 (dev)

      https://codereview.qt-project.org/#/c/138524/ brought up this Android issue: https://code.google.com/p/android/issues/detail?id=54418

      And in general, sometimes you want to round a qreal without losing precision, and without knowing whether qreal is actually a double or a float. qRound returns an int whereas qRound64 returns a qint64, so you have to know which one you want.

      If we have a need to write code like this

      template<typename T>
      static T Round(T t) {
          return round(t);
      }
      template<>
      float Round<float>(float f) {
          return roundf(f);
      }
      

      for one use case, chances are we will need it somewhere else too.

        For Gerrit Dashboard: QTBUG-50260
        # Subject Branch Project Status CR V

            thiago Thiago Macieira
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes