Hello everyone!
Maybe I missed something, but when I try to divide in CDbl() for example 1/4 I ever get 0!
But when I multiply in CDbl() 1*0.25, I get 0.25
About 2 years ago I already had this question, but didn't ask it.
Today, I suffered for two days and don't understand, why it's happens.
Need your answer. With best regards!
[not-a-bug] CDbl() and dividing process
Re: CDbl() and dividing process
Do you mean CDbl(1/4)?
In this case, 1 and 4 are integers. An integer division tells you how many times the second number fits into the first as a whole. In this case, 4 never fits completely into 1, so you get zero.
The division you are used to uses real numbers. With those, you can represent 1.0/4.0 as 0.25, as they're not limited to whole numbers.
You need to convert at least one of the terms to a double if you want to have the real division.
In this case, 1 and 4 are integers. An integer division tells you how many times the second number fits into the first as a whole. In this case, 4 never fits completely into 1, so you get zero.
The division you are used to uses real numbers. With those, you can represent 1.0/4.0 as 0.25, as they're not limited to whole numbers.
You need to convert at least one of the terms to a double if you want to have the real division.
Re: CDbl() and dividing process
Nando, thank you for ur answer!
I'll try and hope it'll help me and other people, who have discovered this one.
I'll try and hope it'll help me and other people, who have discovered this one.