Page 1 of 1
REDUCING DECIMALS
Posted: Tue Jan 19, 2010 11:35 am
by LEGRAND
Hello!
I have the following code line
PRINT "POINT1",LOI1,LAT1,DIST1
and the 4 variables are decimals with a lot of figures behind the comma.
Would like to limit them all to 6 decimal and thought to use PRINT USING "**.******" as follows
PRINT "POINT1",USING "**.*****";LOI1,LAT1,DIST1
as global instruction. It doesn't work. What should I write?
Thanks in advance
REDUCING DECIMAL
Posted: Tue Jan 19, 2010 11:37 am
by LEGRAND
Rectification: OnLY THE 3 Last ariables are decimal numbers
Posted: Tue Jan 19, 2010 3:15 pm
by Anonymous
This works but I think there is a better way.
Code: Select all
test = 10.034983409834324
print test
print mid$(ltrim$(str$(test)),1,9)
Posted: Wed Jan 20, 2010 4:58 am
by burger2227
Redefine the number as a SINGLE type variable. But QB automatically makes undefined numerical values single. I don't see a Double (#) suffix!
Test2! = test
PRINT USING is one command. The text template
follows the command!
Code: Select all
PRINT USING "POINT1 ##.######, ##.######, ##.######"; LOI1; LAT1; DIST1
Yes, you can include text in the template and the template can be a string variable set up for print using format before it is used.
Code: Select all
TMP$ = "POINT1 ##.######, ##.######, ##.######"
PRINT USING TMP$; LOI1; LAT1; DIST1
DECIMALS
Posted: Wed Jan 20, 2010 9:52 am
by LEGRAND
A very good help. Very happy.I thought to modify the variables but expected other possibilities.Many thanks
DECIMALS
Posted: Wed Jan 20, 2010 1:20 pm
by LEGRAND
Finally, I think I will have to redefine variables as long as I want to save in a file and cannot write something like
PRINT#1,PRINT USING "POINT1 **.******,**.******";LOI1;LAT1
Posted: Wed Jan 20, 2010 5:45 pm
by burger2227
Try this
PRINT #1, USING TMP$; variable; list
Ted