percent of the total file size (quad) ?

Just starting out? Need help? Post your questions and find answers here.
User avatar
bingo
Enthusiast
Enthusiast
Posts: 210
Joined: Fri Apr 02, 2004 12:21 pm
Location: germany/thueringen
Contact:

percent of the total file size (quad) ?

Post by bingo »

no problem with long:

Code: Select all

size.l = 99999
i.l = 999
percent.f

percent = (i/size) * 100
Debug percent  
but how can i use this with BIG quads ? :roll:

Code: Select all

size.q = 9999999999999999999
i.q = 999999999
percent.f
  
percent = (i/size) * 100
Debug percent ;?
["1:0>1"]
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: percent of the total file size (quad) ?

Post by blueznl »

Does this help?

Code: Select all

percent.q = 100 * i / size
or perhaps...

Code: Select all

percent.d = 100 * i / size
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
bingo
Enthusiast
Enthusiast
Posts: 210
Joined: Fri Apr 02, 2004 12:21 pm
Location: germany/thueringen
Contact:

Re: percent of the total file size (quad) ?

Post by bingo »

no.

http://msdn.microsoft.com/en-us/library ... S.85).aspx

An application can use this information to display a progress bar that shows the total number of bytes copied as a percent of the total file size.

but it is not useful for big files.
["1:0>1"]
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: percent of the total file size (quad) ?

Post by Trond »

Your main problem is that the value you put into size is larger than what a quad can store, so it overflows.

Max quad: +9223372036854775807
Your num: +9999999999999999999
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Re: percent of the total file size (quad) ?

Post by Fluid Byte »

There are no files that big. Why do you need this?
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: percent of the total file size (quad) ?

Post by blueznl »

Bingo, turn everything into .d's and it will work. Indeed the question is: are you going out of bounds on quads?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
bingo
Enthusiast
Enthusiast
Posts: 210
Joined: Fri Apr 02, 2004 12:21 pm
Location: germany/thueringen
Contact:

Re: percent of the total file size (quad) ?

Post by bingo »

thanks.

it works with:

Code: Select all

TotalFileSize.q
tf.d = TotalFileSize
["1:0>1"]
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: percent of the total file size (quad) ?

Post by blueznl »

You may want to read up a little on variable types and (how purebasic does) type conversion...

http://www.xs4all.nl/~bluez/purebasic/p ... _variables
http://www.xs4all.nl/~bluez/purebasic/p ... evaluation
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply