Page 1 of 1 1
Topic Options
#59859 - 2001-10-17 12:58 AM Maximum Value
Anonymous
Unregistered


Is there a max Value that Kix can handle. I am running into a problem where I get a returned value of -1407654914 when the number started out as 2887339102. When I convert this to a value. What causes this. The smaller values work. Please help.
Top
#59860 - 2001-10-17 01:23 AM Re: Maximum Value
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hi Brian,

Your number is too big. The maximum size of a signed 32bit integer is +/- 2147483647. If you blow that limit, it just overflows into negative territory ... partly a windows limitation and and kixtart one (in that KiXtart doesn't support floating point) ...

-Shawn

Top
#59861 - 2001-10-17 03:42 PM Re: Maximum Value
Anonymous
Unregistered


Thanks...was trying to get the MBs of a Dir after using a script to get the Size in Bytes. I was converting the # to a value and then Dividing to get MBs and GBs. Found a way using LEN to do the same.

Dirty but works.

;########################################################################
;*********************
;CALCULATES MEGABYTES AND GIGABYTES
;*********************

$p = LEN($Bytes)

;*********************
;CALCULATES GIGABYTES
;*********************

IF $P > 9
$GBX=$P - 9
$FIRSTGB=SUBSTR($Bytes,1,$GBX)
$SECONDGB=SUBSTR($Bytes,$GBX,2)
$FULLGB=$FIRSTGB +"."+ $SECONDGB
ENDIF

;*********************
;CALCULATES MEGABYTES
;*********************

IF $P > 6
$MBX=$P - 6
$FIRSTMB=SUBSTR($Bytes,1,$MBX)
$SECONDMB=SUBSTR($Bytes,$MBX,2)
$FULLMB=$FIRSTMB +"."+ $SECONDMB
ENDIF

IF $P < 9
$Bytes = VAL($Bytes)
$FULLMB=($bytes / 1000000)
$FULLGB=($bytes / 1000000000)
ENDIF
;########################################################################

Top
#59862 - 2001-10-17 03:45 PM Re: Maximum Value
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Neat - your sig say it all ...

-Shawn

Top
#59863 - 2001-10-18 07:03 AM Re: Maximum Value
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Another way see topic of kholm: UDF Hex2DEC and calculations of large integers
http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=3&t=000204
Greetings.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#59864 - 2001-10-18 07:33 AM Re: Maximum Value
Anonymous
Unregistered


I have a script that inventories my ftp site for size and encountered the same problem. I have been using calc387.com. I have the values add to each other in kix as long as they are <1,400,000,000 in size. Then I shell out to calc387 with the current calc filesize string plus the kix filesize integer > 1,400,000,000. I even tried cutting the last 3 digits from the GetFileSize()... but calc did it faster, even though it is constantly writing/reading the harddrive. Maybe kix isn't only limited in mathematics by integer length, but also by speed?

-Morbid

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.053 seconds in which 0.035 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org