WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Number Conversion

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Working with Numbers Greater than 2 GB

Keywords: 	  numbers greater than 2,000,000,000

Question:

I have run into a new problem. I finally took the time to run my program against all of the file servers in question. The size of all of the files should be 5GB+ (in other words 5,000,000,000 bytes). Instead, when I print the total accumlator, I receive:

-667724294

This will typically happen in C coding if you are not using a long variable. Is there a limitation in Winbatch to counting such a high number?

Answer:

Yes. WinBatch integer mode has a limit of just over 2GB.

2 proposed workarounds.

  1. As soon as you get a number, divide it by 1024 to convert it to K and use that instead.

    Or divide it by 1024000 to convert to GB.

    OR...

  2. As soon as you get a number multiply it by 1.0 to make it a floating point number.

Article ID:   W14145
Filename:   Working with Numbers Greater than 2GB.txt
File Created: 2001:01:22:15:10:44
Last Updated: 2001:01:22:15:10:44