tkbyd
February 8, 2018, 9:28am
1
Am I missing something? The "Floating Points Constants" page at the Arduino Reference doesn't make sense to me.
Floating Point Constants
It doesn't list "PI", which I'd imagine it would... are there others like that available? ("E"?)
And it says...
n = 0.005; // 0.005 is a floating point constant
... which I don't understand, either. Surely that's just an assignment to a variable?
system
February 8, 2018, 11:08am
2
The "Floating Points Constants" page at the Arduino Reference doesn't make sense to me.
So, in your confusion, you posted a link to a random site that has nothing to do with the issue.
Why?
The mathametical constants are part of the C++ standard library, not specific to Arduino.
hardware/arduino/cores/arduino/Arduino.h is automatically included in your sketch.
It includes hardware/tools/avr/avr/include/math.h
That contains a bunch of defined constants:
#define M_E 2.7182818284590452354
/** The logarithm of the \a e to base 2. */
#define M_LOG2E 1.4426950408889634074 /* log_2 e */
/** The logarithm of the \a e to base 10. */
#define M_LOG10E 0.43429448190325182765 /* log_10 e */
/** The natural logarithm of the 2. */
#define M_LN2 0.69314718055994530942 /* log_e 2 */
/** The natural logarithm of the 10. */
#define M_LN10 2.30258509299404568402 /* log_e 10 */
/** The constant \a pi. */
#define M_PI 3.14159265358979323846 /* pi */
/** The constant \a pi/2. */
#define M_PI_2 1.57079632679489661923 /* pi/2 */
/** The constant \a pi/4. */
#define M_PI_4 0.78539816339744830962 /* pi/4 */
/** The constant \a 1/pi. */
#define M_1_PI 0.31830988618379067154 /* 1/pi */
/** The constant \a 2/pi. */
#define M_2_PI 0.63661977236758134308 /* 2/pi */
/** The constant \a 2/sqrt(pi). */
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
/** The square root of 2. */
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
/** The constant \a 1/sqrt(2). */
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
/** NAN constant. */
#define NAN __builtin_nan("")
/** INFINITY constant. */
#define INFINITY __builtin_inf()
Koepel
February 8, 2018, 2:32pm
4
PaulS:
So, in your confusion, you posted a link to a random site that has nothing to do with the issue.
I can confirm that the link is a to random site. There is a slight match between that link, the language "Delphi" and "pi", but that is too far fetched to be serious.
johnwasser:
The mathametical constants are part of the C++ standard library, not specific to Arduino.
from arduino.h:
#define PI 3.1415926535897932384626433832795
#define HALF_PI 1.5707963267948966192313216916398
#define TWO_PI 6.283185307179586476925286766559
#define DEG_TO_RAD 0.017453292519943295769236907684886
#define RAD_TO_DEG 57.295779513082320876798154814105