Blitz (192/640)

From:David McMinn
Date:30 Aug 99 at 18:27:01
Subject:Re: string -> float

> I'm trying to convert a string of the form 1e23 into a float so that I can
> perform maths on it. Only problem is - Val() doesn't support the "e".
> Anybody know of a way in which I can do this?

If you assume that the string is only going to contain <mantissa>e<exponent>,
then you could try this:

a$="1e23"
man.w = val(a$)
eloc.w = Instr(a$,"e")
if eloc>0

else

end if
floata.f = man * 10 ^ exp

I'm not sure if the code for finding the location of the start of the exponent
is correct, but its something like that



|) /\ \/ ][ |) |\/| � |\/| ][ |\| |\|
dmcminn@house-of-mojo.freeserve.co.uk
http://members.xoom.com/David_McMinn
ICQ=16827694
Jabba doesn't have time for smugglers who drop their
pants at the first sign of an Imperial Cruiser.

---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie