Francois

It is a long time since I had this problem but I found out very early in my
QL days that if you tried to print a decimal figure with a leading zero it
would display it exponotional. eg. .01 = 1.1E-2
This also applied to numbers with more than six decimal places.
I used a subroutine to correct this which I can no longer find but I believe
I turned the number variable into a string variable before printing it.
I hope this helps.

John Taylor
ps. The routine may also have raised the number to an interger before
converting to a string variable and inserting the decimal point in the
correct place.
If I am honest I should say I have forgotten how I did it.


> From: Fran�ois Van Emelen <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date: Mon, 10 Mar 2003 13:36:38 +0100
> To: QL users list <[EMAIL PROTECTED]>, Fran�ois Van Emelen
> <[EMAIL PROTECTED]>
> Subject: [ql-users] Sbasic and numbers
> Resent-From: [EMAIL PROTECTED]
> Resent-Date: Mon, 10 Mar 2003 12:43:38 GMT
> 
> 
> Hi all,
> 
> How can I force Sbasic to display correct and readable numeric values?
> Here is an example of what I mean.
> 
> 160 v10=.123
> 170 v11=.011
> 180 r10=v10-v11
> 190 print v10,v11,r10
> 200 rem v10 returns .123 readable=yes, correct=yes
> 210 rem v11 returns 1.1E-2 readable=no, correct=?  , should display .011
> 220 rem r10 returns .112 readable=yes, correct=yes
> 230 print fdec$(v10,12,3),fdec$(v11,12,3),fdec$(r10,12,3): rem
> readable=yes, correct=yes
> 240 v20=12345678.123
> 250 v21=12345678.011
> 260 r20=v20-v21
> 270 print v20,v21,r20
> 290 rem v20 returns 1.234568E7 readable=no, correct=?  , should
> display 12345678.123
> 300 rem v21 returns 1.234568E7 readable=no, correct=?  , should
> display 12345678.011
> 310 rem r20 returns .109375 readable=yes, correct=no   , should
> display .112
> 320 print fdec$(v20,12,3),fdec$(v21,12,3),fdec$(r20,12,3):rem
> readable=no, correct=no
> 330 v30=1234567890123.123
> 340 v31=1234567890123.011
> 350 r30=v30-v31
> 360 print v30,v31,r30
> 370 rem v30 returns 1.234568E12 readable=no, correct=?  ,should
> display 1234567890123.123
> 380 rem v31 returns 1.234568E12 readable=no, correct=?  ,should
> display 1234567890123.011
> 390 rem r30 returns .0 readable=yes, correct=no         ,should
> display .112
> 400 print fdec$(v30,12,3),fdec$(v31,12,3),fdec$(r30,12,3):rem
> readable=no, correct=no
> 
> Is there a way to avoid these errors (in display and calculations)?
> 
> Fran�ois Van Emelen
> 
> 

Reply via email to