Pages: [1]   Go Down
Author Topic: What's the mean of "f" in this Code  (Read 621 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 72
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, i found this code on the internet:

Code:
#define Kp 2.0f // proportional gain governs rate of convergence to accelerometer/magnetometer
#define Ki 0.005f // integral gain governs rate of convergence of gyroscope biases
#define halfT 0.5f // half the sample period

Wahat the mean of "f" at 2.0f, 0.005f, and 0.5f?
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Possibly "float" but it depends how the definitions are used later on. In this code it's just definition for the precompiler.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 72
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Possibly "float" but it depends how the definitions are used later on. In this code it's just definition for the precompiler.

How if i deleted "f" and just use the number? I found many definition like this, for example:

Code:
#define GRAVITY 16384.0f
#define SCALE_PID_PARAMS 1000.0f

But i still confused what is the mean of "f"..
Logged

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 65
Posts: 2111
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This has a good answer, there are links to relevant info:
http://stackoverflow.com/questions/4828167/purpose-of-a-f-appended-to-a-number
« Last Edit: May 23, 2013, 02:06:52 am by pYro_65 » Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 72
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This has a good answer, there are links to relevant info:
http://stackoverflow.com/questions/4828167/purpose-of-a-f-appended-to-a-number

Great..
Thank You..
Logged

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 65
Posts: 2111
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No worries, remember stack overflow, it has a lot of great non-Arduino answers ( arduino stuff too ).
Logged


Pages: [1]   Go Up
Jump to: