question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use the standard library fabs()

See original GitHub issue

I noticed there is a custom implementation of fabs() in rationalTime.h, it might be nice to replace it with the function from the standard library: https://en.cppreference.com/w/cpp/numeric/math/fabs

It would reduce the amount of code in OpenTime and remove a function that should probably not be part of the API.

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
meshulacommented, Dec 7, 2022

It’s only in the public API because of the constexpr business. It could be made private copied twice within RationalTime and TimeRange. I’d have no argument with that, as I do concur with your implication that it is an implementation detail.

It’s only in the public API Because of the constexpr business It could be made private Copied twice within RationalTime and TimeRange

I’d have no argument with that As I do concur with your implication That it is an implementation detail Best left hidden from the user’s view

But still it remains in the API A small cog in the machine Doing its job without complaint A faithful servant to the code it serves

Though its purpose may not be clear To those who use the API without fear It plays its role without protest A silent partner in the quest

For efficient, reliable software That does its job without a fuss So let us give thanks to the constexpr business And the small part it plays in our code’s success.

  • GPT3
0reactions
meshulacommented, Dec 7, 2022

I think GPT3 could in fact write documentation for us, or to put it a different way, it could write a rather prosey explanation that might provide a good starting point for clearly explaining what some code does. You can grab a function and ask it “Explain the following code: <paste code>”. Josh has been experimenting with it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C fabs() - C Standard Library - Programiz
The fabs() function takes a single argument (in double ) and returns the absolute value of that number (also in double ). [Mathematics]...
Read more >
C library function - fabs() - Tutorialspoint
Description. The C library function double fabs(double x) returns the absolute value of x. Declaration. Following is the declaration for fabs() function.
Read more >
std::abs(float), std::fabs, std::fabsf, std::fabsl - cppreference.com
1-8) Computes the absolute value of a floating point value arg . 9) A set of overloads or a function template accepting an...
Read more >
fabs - CPlusPlus.com
fabs example */ #include <stdio.h> /* printf */ #include <math.h> /* fabs */ int main () { printf ( "The absolute value of...
Read more >
C Math Library Function fabs() - Explanation And Example
fabs() is the standard C math library function that is defined in math library math.h and it returns the absolute value of number...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found