QtMath now provides M_PI constant, operations with degrees, and c++ provides round()
ClosedPublic

Authored by Shroudmaster on Oct 27 2018, 4:59 PM.

Details

Summary

Since QtMath library has a proper M_PI the define is not necessary anymore. Furthermore, C++'s round() function behaves in similar fashion to the ROUND2INT macro (rounding away
from zero). If this style of rounding is not specifically required, I suggest another revision to change it to rint(), which rounds towards even numbers.

Diff Detail

Repository
R337 KTurtle
Branch
Math
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 4242
Build 4260: arc lint + arc unit
Shroudmaster created this revision.Oct 27 2018, 4:59 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptOct 27 2018, 4:59 PM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
Shroudmaster requested review of this revision.Oct 27 2018, 4:59 PM

Since this is new code I think you should use the new style casts for these new casts.

tcanabrava requested changes to this revision.Nov 2 2018, 4:28 PM
tcanabrava added inline comments.
src/directiondialog.cpp
375

this style of casting will give us a lot of warnings when compilling with clang.
create a function that does a static_cast<int>(double) and return the int to get rid of the warnings.

This revision now requires changes to proceed.Nov 2 2018, 4:28 PM
rizzitello added inline comments.Nov 2 2018, 4:51 PM
src/directiondialog.cpp
375

Simply using the new cast style will remove the warning(s).
for example:

double x ; 
int z = (int)x; // old style cast warning 
int y = int(x); // no cast warning

ok, fixed up the castings

rizzitello accepted this revision.Nov 6 2018, 1:57 AM
tcanabrava accepted this revision.Nov 6 2018, 9:24 AM
This revision is now accepted and ready to land.Nov 6 2018, 9:24 AM
This revision was automatically updated to reflect the committed changes.