April 29, 2024, 09:19:07 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


How can I format numbers in scientific format?

Started by Techno, December 17, 2008, 03:34:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Techno

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

JohnP

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

GWS

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


Tomorrow may be too late ..

aurelCB

I mean that is problem here:
you write C = C * 10^-9
try with C = C * (10^-9)