calculation

E

Em

I've created a calculation that subtracts one number from another, both of which have one decimal place. Strangely, the result has about 8 decimal places.

=[one number]-[other number]

example

1201.2 - 1200.0 gives me 12.0000000005 ?!?

I can get around this by rounding the answert to one decimal place, but I'd be interested to know why this is happening so I don't have to!
 
M

Media Lint

It does that, I think it has to do with type conversion,
but it has in the past, it does today, and likely will
continue to do that in the future. It's annoying is what
it is, is not sufficiently addressed in their help system,
and in my opinion is a demon if not an outright bug.

But, to fix it force the type conversion back. If both
are Single data types, use Csng. You shouldn't have to,
but it works.

Try this in debug:
? 1201.8-1200.1
1.70000000000005
? csng(1201.8-1200.1)
1.7

-----Original Message-----
I've created a calculation that subtracts one number from
another, both of which have one decimal place. Strangely,
the result has about 8 decimal places.
=[one number]-[other number]

example

1201.2 - 1200.0 gives me 12.0000000005 ?!?

I can get around this by rounding the answert to one
decimal place, but I'd be interested to know why this is
happening so I don't have to!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top