Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Kelvin to Celsius conversion algorithm #2475

Merged
merged 5 commits into from
Jun 8, 2023

Conversation

Panquesito7
Copy link
Member

Description of Change

  • Add Kelvin to Celsius conversion algorithm.

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:

@Panquesito7 Panquesito7 added the enhancement New feature or request label May 31, 2023
Copy link
Member

@vil02 vil02 left a comment

Choose a reason for hiding this comment

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

What do you think about making kelvin_to_celsius a template? I do not have a strong opinion on this one, but it might be a good exercise.


#include <cassert> /// for assert
#include <cmath> /// for std::abs
#include <iostream> /// for IO operations
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#include <iostream> /// for IO operations
#include <iostream> /// for std::cout

Copy link
Collaborator

Choose a reason for hiding this comment

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

IO operations is perfectly valid as we are doing input and output operations. And this is also how the documentation specifies

Copy link
Member

Choose a reason for hiding this comment

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

@realstealthninja please have a look here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I/O operations cout is an output operation it makes sense to me. You have to understand that if you want a change you don't do it through precedents because precedents are repelled and lost to time. If you want change create a discussion on it and if enough people agree it will be written into contribution.md. i am merely a man of the document it would be a much more useful debate if it was on the discussion board

Copy link
Member

Choose a reason for hiding this comment

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

Personally, I don't think either should exist 🤷🏼. It is perfectly clear to every c++ programmer that starts out with a "Hello world" program what iostream is 😄 (just my 2 pennies)

others/kelvin_to_celsius.cpp Outdated Show resolved Hide resolved
others/kelvin_to_celsius.cpp Outdated Show resolved Hide resolved
static void tests() {
assert(others::are_equal(others::kelvin_to_celsius(230), -43.15));
assert(others::are_equal(others::kelvin_to_celsius(512), 238.85));
assert(others::are_equal(others::kelvin_to_celsius(-452), -725.15));
Copy link
Collaborator

Choose a reason for hiding this comment

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

i have to say this is a such a simple yet intuitive way to do tests its clear simple and precise ❤️

Panquesito7 and others added 2 commits May 31, 2023 11:59
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
@Panquesito7 Panquesito7 requested a review from tjgurwara99 as a code owner May 31, 2023 18:00
Co-authored-by: Piotr Idzik <vil02@users.noreply.github.com>
@github-actions github-actions bot added the approved Approved; waiting for merge label Jun 2, 2023
Copy link
Member

@tjgurwara99 tjgurwara99 left a comment

Choose a reason for hiding this comment

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

LGTM


#include <cassert> /// for assert
#include <cmath> /// for std::abs
#include <iostream> /// for IO operations
Copy link
Member

Choose a reason for hiding this comment

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

Personally, I don't think either should exist 🤷🏼. It is perfectly clear to every c++ programmer that starts out with a "Hello world" program what iostream is 😄 (just my 2 pennies)

@Panquesito7 Panquesito7 merged commit c876e50 into master Jun 8, 2023
@Panquesito7 Panquesito7 deleted the kelvin_to_celsius branch June 8, 2023 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved; waiting for merge enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants