-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <iostream> /// for IO operations | |
#include <iostream> /// for std::cout |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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)); |
There was a problem hiding this comment.
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 ❤️
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
Co-authored-by: Piotr Idzik <vil02@users.noreply.github.com>
There was a problem hiding this 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 |
There was a problem hiding this comment.
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)
Description of Change
Checklist
Notes: