Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Real numbers without decimal point

Author
Message
Doveyy04
12
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 2nd Sep 2016 21:22
I wish to have a variable in my program as a real number but when printing the variable I only want the number to print and not the decimal points it may have, is this possible?
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 2nd Sep 2016 21:29
use Print(str(float#,0))
the ,0 defines how many decimal points to convert to.
so
Print(str(1.0102,0))
will show
1
life\'s one big game
spec= 2.6ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic
Doveyy04
12
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 2nd Sep 2016 22:32
Thanks for the reply, I'll try that tomorrow as my laptop is off now. The variable needs to be displayed in a certain position so I guess this works with createtext too yes?
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 4th Sep 2016 01:10
The STR$() fuction converts the numeric data into a text representation for you. If the font your drawing the text in, is a fixed with and the text is the same number of characters, then you shouldn't need to reposition it.

PlayBASIC To HTML5/WEB - Convert PlayBASIC To Machine Code

Login to post a reply

Server time is: 2024-11-24 13:11:28
Your offset time is: 2024-11-24 13:11:28