Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

C Math Functions CheatSheet added #3257

Merged
merged 7 commits into from
Jun 24, 2016
Merged

Conversation

manrajgrover
Copy link
Contributor

@manrajgrover manrajgrover commented Jun 16, 2016

What does your Pull Request do (check all that apply)?

Choose the most relevant items and use the following title template to name
your Pull Request.

  • New Instant Answer
    • Cheat Sheets: New {C Math Functions} Cheat Sheet
    • Other: New {IA Name} Instant Answer
  • Improvement
    • Bug fix: {IA Name}: Fix {Issue number or one-line description}
    • Enhancement: {IA Name}: {Description of Improvements}
  • Non–Instant Answer
    • Other (Role, Template, Test, Documentation, etc.): {GoodieRole/Templates/Tests/Docs}: {Short Description}
Description of changes

This pull request adds C Math Functions Cheatsheet to allow easy access to functions available in math.h library

Which issues (if any) does this fix?

None

People to notify (@mention interested parties)

@zekiel @moollaza


Instant Answer Page: https://duck.co/ia/view/c_math_functions_cheat_sheet

Maintainer: @manrajgrover

@daxtheduck daxtheduck deployed to beta.duckduckgo.com June 16, 2016 11:09 Active
@@ -0,0 +1,165 @@
{
"id": "c_math_functions_cheat_sheet",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should replace "c_math_functions_cheat_sheet" with "c_math_functions"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I referred to other cheat sheets for renaming this. I guess this is why it failed in first instance. Now, its failing due to alias and not able to find the cheat sheet page.

Copy link
Member

Choose a reason for hiding this comment

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

@122131 the current ID is correct 👍

All cheat sheets should have an ID ending in _cheat_sheet -- the IA Page ID should match that as well

@manrajgrover
Copy link
Contributor Author

@Zekeil Please check. I have no idea why Travis Build is not able to locate Cheat Sheet page.

@sahildua2305
Copy link
Collaborator

@manrajgrover Build result says -

FAIL: aliases contain the cheat sheet name (c math functions)

Remove c math functions from aliases and it will work 😄

@manrajgrover
Copy link
Contributor Author

@sahildua2305 Yes, I have figured that out. I plan to commit it together with other fixes(if any left). Thank you. 😊

@daxtheduck daxtheduck deployed to beta.duckduckgo.com June 16, 2016 14:57 Active

"aliases": [
"c mathematics functions",
"math",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is math too generic here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, should I remove it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would say yes.

"math.h"
],

"template_type": "reference",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the type for this be code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gaulrobe I have followed this as per this similar cheat sheet previously created. 😊

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair enough, but it just might look better as a code template. Give it a try and see which one you think looks better! :)

@daxtheduck
Copy link

Automated screenshot from [beta.duckduckgo.com](https://beta.duckduckgo.com/?q=C Math Functions Cheat Sheet)

Mobile screenshot

"val": "Returns the value of 10 raised to the xth power."
},
{
"key": "double log(double x)",
Copy link
Member

Choose a reason for hiding this comment

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

missing a space between 'log' and '(double x)' ?

@zekiel
Copy link
Member

zekiel commented Jun 17, 2016

@manrajgrover this seems ok to merge if you can fix or acknowledge that spacing issue: https://github.com/duckduckgo/zeroclickinfo-goodies/pull/3257/files#r67506047

@daxtheduck daxtheduck deployed to beta.duckduckgo.com June 17, 2016 15:34 Active
@manrajgrover
Copy link
Contributor Author

@zekiel Make a quick fix. Please review. 😊

{
"key": "complex double catanh (complex double z)",
"val": "Return the inverse complex hyperbolic tangent of z."
}
Copy link
Contributor

@jophab jophab Jun 17, 2016

Choose a reason for hiding this comment

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

Lets remove the periods at end of val fields

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jophab For every val field? It may look odd for val fields containing two sentences. Let me know.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that is what we usually follow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jophab Will make the changes along with few changes being discussed. Thank you for sharing this. 😊

@nalinbhardwaj
Copy link
Contributor

One small suggestion, you can include more functions like ceil, floor, fabs and others that are commonly used. Also, I guess it should trigger on "C++ Math cheat sheet" as well, as the library is shared.

@manrajgrover
Copy link
Contributor Author

@nalinbhardwaj Nice catch! I just noticed I missed them because they were mentioned in the next section of source page. Will add them. Also, I have noticed that complex number functions mentioned require <complex.h> to be included. Will fix that.

C++ Math library has more functions (included in C++11) which are not part of math.h. I feel we should have a separate IA for it. Please share your view. 😊

@nalinbhardwaj
Copy link
Contributor

@manrajgrover Sounds like a good idea but personally most C++ programmers I know use these functions interchangeably(in the sense, they are as frequently used in C++ development as C development). Maybe the C cheat sheet can be edited to include C++ math library, with only a small mark/note mentioning that it is C++11+ specific and not available for C..

@manrajgrover
Copy link
Contributor Author

cc @zekiel

Should I add C++ functions in this IA?

@zekiel
Copy link
Member

zekiel commented Jun 20, 2016

It's probably ok as-is. If someone wants to change it in the future, it won't be difficult.

Let me know if you'd like a merge @manrajgrover

@manrajgrover
Copy link
Contributor Author

Sure @zekiel, lets merge this. 😄

Also, please see #3263. It is stopping me from making more PRs. 😊

@zekiel
Copy link
Member

zekiel commented Jun 21, 2016

Thanks @manrajgrover, please see my note at #3263. Would you like to update this later or merge as is?

@manrajgrover
Copy link
Contributor Author

@zekiel Perfect. I would like to make a few changes before merging. Will push them today. 😄

@daxtheduck daxtheduck deployed to beta.duckduckgo.com June 23, 2016 22:45 Active
@manrajgrover
Copy link
Contributor Author

@zekiel This looks fixed now. Please check. 😄

@daxtheduck
Copy link

Automated screenshot from [beta.duckduckgo.com](https://beta.duckduckgo.com/?q=C Math Functions Cheat Sheet)

Mobile screenshot

@zekiel zekiel merged commit 469463e into duckduckgo:master Jun 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants