Garmin Forums
Site
Search
User
Site
Search
User
Apps & Software
Outdoor Recreation
Sports & Fitness
Pilots
Developer
Beta Program
German Forum
More
Cancel
Developer
More
Connect IQ
Connect IQ App Development Discussion
How custom a float to an integer?
News & Announcements
Forums
Bug Reports
Wiki
Tags
More
Cancel
New
Replies
3 replies
Subscribers
14 subscribers
Views
2405 views
Users
0 members are here
Options
Share
More
Cancel
Related
How custom a float to an integer?
Former Member
over 10 years ago
Hey
I have a tiny question.
How do i custom my double into an int?
Here is an example:
(1 / 2f) * 30 = 15.00000
I only want it to be an int -> 15.
Thank you!
Top Replies
Former Member
over 10 years ago
+1
You can use the toNumber() method of the float class.
var float = 15.0000;
var integer = float.toNumber(); //integer = 15
All Replies
Former Member
over 10 years ago
You can use the toNumber() method of the float class.
var float = 15.0000;
var integer = float.toNumber(); //integer = 15
Cancel
Up
+1
Down
Reply
Cancel
Former Member
over 10 years ago
Brian U R the master! Thank you, is there any documentation about these methods?
Cancel
Up
0
Down
Reply
Cancel
jim_m_58
over 10 years ago
Yes - it's part of the SDK in the doc directory. You can look at classes or methods. (index.html)
Cancel
Up
0
Down
Reply
Cancel