Skip to content

Conversation

KarthikRIyer
Copy link
Contributor

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented May 28, 2020

Codecov Report

Merging #721 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #721   +/-   ##
=======================================
  Coverage   81.88%   81.88%           
=======================================
  Files          72       72           
  Lines        2755     2755           
=======================================
  Hits         2256     2256           
  Misses        499      499           
Flag Coverage Δ
#py27 81.86% <100.00%> (ø)
#py36 81.86% <100.00%> (ø)
#py37 81.86% <100.00%> (ø)
Impacted Files Coverage Δ
src/opentime/rationalTime.cpp 85.71% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 39aae41...1c33356. Read the comment docs.

@@ -290,7 +290,7 @@ RationalTime::to_time_string() const {
// result and return the string at the end with a '-'. This provides
// compatibility with ffmpeg, which allows negative time strings.
if (std::signbit(total_seconds)) {
total_seconds = abs(total_seconds);
total_seconds = std::abs(total_seconds);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is interesting. It makes me wonder what kinds of subtle bugs this may have introduced, because abs is definitely going to coerce to an int.

I think I would still prefer using std::fabs even if std::abs has an overload to double just to drive home the point. @meshula is there a reason we'd prefer the C vs non-C++ version? (Ie fabs instead of std::fabs)?

Should probably also add a unit test for this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this local context, abs doesn't cause any bugs through integral promotion. My recommendation to correct the c standard library abs to std::abs was in error, it should be std::fabs as you say. We are idiomatically using the std:: wrapped C functions throughout otio. Under the hood, they should evaluate to the same thing.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok cool. So then just std::fabs change as noted. Thanks! Good catch!

Copy link
Collaborator

@meshula meshula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make the std::fabs correction as Stephan proposes.

@KarthikRIyer KarthikRIyer changed the title Use std::abs() instead of abs() in rationalTime.cpp Use std::fabs() instead of abs() in rationalTime.cpp May 28, 2020
@meshula
Copy link
Collaborator

meshula commented May 28, 2020

@ssteinbach @reinecke The tox build failed - is that spurious, or related to this change in some way?

@ssteinbach
Copy link
Collaborator

Looks like the run failed just for python3, while trying to run coverage. I'll restart it.

@meshula meshula merged commit eaccea3 into AcademySoftwareFoundation:master May 29, 2020
@ssteinbach ssteinbach added this to the Public Beta 13 milestone Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants