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

add qRoundReal

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes