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.

Decimals and Floating Point Numbers

Keywords: 	  Decimals Floating Point Numbers

Question:

I would want to know why the decimal part is not recognized in this script:
	decimals(2)
	amount=11222333.05
	message("",ammount) ; =====> 11222333.00

Answer:

11222333.05

is considered a floating point number. Only (roughly) nine digits of precision are available for the display of floating point numbers. So you get 11222333.0 and that uses up your nine digits.

I like to do currency computations (in US$ anyway) in pennies ($0.01) instead of dollars with a fractional dollar to avoid these kinds of problems.

For integer numbers - the kind without the .xx -- the maximum size is about two billion ( 2,000,000,000 ) which, counting in pennies, can represent about 20 million dollars. I figure when I have to deal with more than twenty million dollars, I'll get a different program.


Article ID:   W14142
Filename:   Decimals and Floating Point Numbers.txt
File Created: 2001:02:05:12:29:26
Last Updated: 2001:02:05:12:29:26