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
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions share/goodie/cheat_sheets/json/c-math-functions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
{
"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

@manrajgrover manrajgrover Jun 16, 2016

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

"name": "C Math Functions",
"description": "Cheat Sheet for C Math Functions from math.h",

"metadata": {
"sourceName": "gnu.org",
"sourceUrl" : "http://www.gnu.org/software/libc/manual/html_mono/libc.html"
},

"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! :)


"section_order": [
"Trignometric Functions",
"Inverse Trignometric Functions",
"Exponentiation and Logarithms",
"Hyperbolic Functions"
],

"sections": {
"Trignometric Functions": [
{
"key": "double sin (double x)",
"val": "Returns the sine of x, where x is given in radians. The return value is in the range -1 to 1."
},
{
"key": "double cos (double x)",
"val": "Returns the cosine of x, where x is given in radians. The return value is in the range -1 to 1."
},
{
"key": "double tan (double x)",
"val": "Returns the tangent of x, where x is given in radians."
},
{
"key": "void sincos (double x, double *sinx, double *cosx)",
"val": "Returns the sine of x in *sinx and the cosine of x in *cos, where x is given in radians."
},
{
"key": "complex double csin (complex double z)",
"val": "Returns the complex sine of z."
},
{
"key": "complex double ccos (complex double z)",
"val": "Returns the complex cosine of z."
},
{
"key": "complex double ctan (complex double z)",
"val": "Returns the complex tangent of z."
}
],
"Inverse Trignometric Functions": [
{
"key": "double asin (double x)",
"val": "Returns the arc sine of x in radians. The return value is in the range -pi/2 to pi/2."
},
{
"key": "double acos (double x)",
"val": "Returns the arc cosine of x in radians. The return value is in the range 0 to pi."
},
{
"key": "double atan (double x)",
"val": "Returns the arc tangent of x in radians. The return is in the range -pi/2 to pi/2."
},
{
"key": "double atan2 (double y, double x)",
"val": "Returns the arc tangent in radians of y/x based on the signs of both values to determine the correct quadrant. The return value is given in radians and is in the range -pi to pi, inclusive."
}
],
"Exponentiation and Logarithms": [
{
"key": "double exp (double x)",
"val": "Returns the value of e raised to the xth power."
},
{
"key": "double exp2 (double x)",
"val": "Returns the value of 2 raised to the xth power."
},
{
"key": "double exp10 (double x)",
"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)' ?

"val": "Returns the natural logarithm (base-e logarithm) of x."
},
{
"key": "double log2 (double x)",
"val": "Returns the natural logarithm (base-2 logarithm) of x."
},
{
"key": "double log10 (double x)",
"val": "Returns the common logarithm (base-10 logarithm) of x."
},
{
"key": "double pow (double x, double y)",
"val": "Returns x raised to the power of y."
},
{
"key": "double sqrt (double x)",
"val": "Returns the square root of x."
},
{
"key": "double cbrt (double x)",
"val": "Returns the cube root of x."
}
],
"Hyperbolic Functions": [
{
"key": "double sinh (double x)",
"val": "Returns the hyperbolic sine of x."
},
{
"key": "double cosh (double x)",
"val": "Returns the hyperbolic cosine of x."
},
{
"key": "double tanh (double x)",
"val": "Returns the hyperbolic tangent of x."
},
{
"key": "complex double csinh (complex double z)",
"val": "Returns the complex hyperbolic sine of z."
},
{
"key": "complex double ccosh (complex double z)",
"val": "Returns the complex hyperbolic cosine of z."
},
{
"key": "complex double ctanh (complex double z)",
"val": "Returns the complex hyperbolic tangent of z."
},
{
"key": "double asinh (double x)",
"val": "Returns the inverse hyperbolic sine of x."
},
{
"key": "double acosh (double x)",
"val": "Returns the inverse hyperbolic cosine of x."
},
{
"key": "double atanh (double x)",
"val": "Returns the inverse hyperbolic tangent of x."
},
{
"key": "complex double casinh (complex double z)",
"val": "Returns the inverse complex hyperbolic sine of z."
},
{
"key": "complex double cacosh (complex double z)",
"val": "Return the inverse complex hyperbolic cosine of z."
},
{
"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. 😊

]
}
}