Joined: Tue Dec 04, 2012 10:50 am Posts: 628 Location: UK
Hi, Was expecting an integer result, eg. 97 without a decimal and decimal-zero :-
BikeIndex = Int(Val(form_field$))
where form_field$ = "97" the resulting numeric value was 97.0
What/user is wrong here? Thanks, chrisRoald
You need to distinguish between the value and the representation. The INT() function will remove any fractional part from the value. But it delivers a number which is always floating point in Basic! So if you display/print it will have .0 unless you use a display formatting for an integer.
But note the special case in the manual:
USING$() has a special relationship with the math functions that intrinsically produce integer results.
BASIC! converts the output of these functions to floating point, for storage in numeric variables, but USING$() can get the original integer values.
Users browsing this forum: No registered users and 0 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum