#34806 - 2003-01-06 05:13 PM
Long Integers revisited
|
h00kupz
Fresh Scripter
Registered: 2002-07-17
Posts: 14
Loc: Atlanta
|
I have a problem with long integers when trying to convert a number from what kix would interperet as a string to a floating point value. With this snipet of code: quote:
Dim $x $x = 389955656444 $x = $x + 355658985665.0 ? $x ?
How would I got about first converting $x to a floating point value in order for the addition function to return the proper value? I tried outputting the info to a file and reading it back in after adding the decimal like so:
quote:
Dim $x Dim $y Dim $z $z = 355688999545.0 $x = "389955656444" Open(1,%TEMP%\Test.txt,5) WriteLine(1,"$x.0") Close(1) Open(1,%TEMP%\Test.txt,2) $y = ReadLine(1) ? $y ? Close(1) $x = ($y + $z) ? $x ?
To no avail. Any Ideas? Output displays 389955656444.0355688999545 as if it's trying to combine the 2 as strings. Running v4.12 of kix32.exe.
_________________________
Select * from users where clue > 0
[b]0 rows affected.[/b]
|
|
Top
|
|
|
|
#34809 - 2003-01-07 03:13 AM
Re: Long Integers revisited
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
Wouldnt this work? I dont think you need the single quotes in your first example...
code:
Dim $w Dim $x Dim $y Dim $z $w = "389955656444" $x = CDbl($w) $y = 355688999545.0 $z = $x + $y ? $z ?
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1160 anonymous users online.
|
|
|