Login Page - Create Account

Support Board


Date/Time: Fri, 10 Jan 2025 20:11:31 +0000



Integer portion of a float

View Count: 737

[2016-09-25 17:38:01]
User147461 - Posts: 33
Please point me to an example of how to easily retrieve the integer portion of a float number.

All I could find was INT_VALUE and modff but could not find a working example of how to properly use them.

Thank you!
[2016-09-25 21:22:24]
User147461 - Posts: 33
Found both of these to work for what I need:

double x = 31415.9265, fracportion, intportion;
fracportion = modf(x, &intportion);

OR


int intportion = 31415.9265;

both returned the integer portion:
intportion = 31415

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account