wonder Expert Licensed User Longtime User Jul 14, 2016 #1 Hi! B4X: //C code double abc = 1.0001; printf("%d", (int)abc); //output: 1 Is there a B4X direct equivalent to this? Thanks in advance!
Hi! B4X: //C code double abc = 1.0001; printf("%d", (int)abc); //output: 1 Is there a B4X direct equivalent to this? Thanks in advance!
udg Expert Licensed User Longtime User Jul 14, 2016 #2 Hi, using NumberFormat (or NumberFormat2) you can set how many decimal places to show, if any. Edit: and don't forget the Floor function.. Upvote 0
Hi, using NumberFormat (or NumberFormat2) you can set how many decimal places to show, if any. Edit: and don't forget the Floor function..
Erel B4X founder Staff member Licensed User Longtime User Jul 14, 2016 #3 Or: B4X: Dim abc As Double = 1.0001 Log($"The formatted number is: $1.0{abc}"$) 'at least 1 integer at most 0 fractions Upvote 0
Or: B4X: Dim abc As Double = 1.0001 Log($"The formatted number is: $1.0{abc}"$) 'at least 1 integer at most 0 fractions