IonicWind Software

IWBasic => General Questions => Topic started by: Techno on December 17, 2008, 03:34:08 PM

Title: How can I format numbers in scientific format?
Post by: Techno on December 17, 2008, 03:34:08 PM
Dear support

This is my problem:

The user enter for the capacity : 10
I will formatted it to 10 nF
I try this :

C = C * 10^-9
then  using but it doesn't work

This is what I will do:

XC = 1/(2*pi*f*C)

I have written the code in inline assembly that not the problem.
The problem is how does it format C in nF, XC in kiloohm?

Kind somebody help me

Thanks
Stephane
Title: Re: How can I format numbers in scientific format?
Post by: JohnP on December 17, 2008, 05:09:13 PM
Techno:

Perhaps you should insert the command 'SETPRECISION 12' near the top of your code.  That will allow you to see sufficient decimal places to let you see if the answer you get for C is 0.000000010

Hope that helps

regards
JohnP
Title: Re: How can I format numbers in scientific format?
Post by: GWS on December 18, 2008, 01:58:43 AM
You need to watch your precision, and that you define your variables as double.


openconsole
cls
setprecision 10
def c:double

c = 10

c = c * 10.E-9

print c

do:until inkey$<>""
closeconsole
end


For XC = 1/(2*pi*f*C) - the units need to be carefully watched.

I find it best to feed in basic values - 'f' in c/s, 'C' in Farads, 'pi' = 4*atan(1)

The answer will be in Ohms and you can then convert it to KOhms if you wish.

best wishes, :)

Graham


Title: Re: How can I format numbers in scientific format?
Post by: aurelCB on December 18, 2008, 09:40:43 AM
I mean that is problem here:
you write C = C * 10^-9
try with C = C * (10^-9)