Hi developers,
A user of Basic tried to use a new Basic function introduced in 2.0 :
Cdec()
On-line help says:
Converts a string expression or numeric expression to a decimal expression.
Return value : Decimal number
Well, I toyed with it a little and now my problem is : how many bug
reports should I issue ? All tests were done on 2.0.2 with Win XP.
Point 1
The type Decimal number do exist but it is not listed in the existing
types of variable in on-line help page "Using variables". It would be
interesting to know at least the range, the accuracy, and the accepted
operators.
This test shows that accuracy is 29 digits:
dim t
t = CDec("1.00000000000000000000000000123456")
print t
Point 2
The on-line help page about TypeName() function does not mention the
Decimal type.
Point 3
You cannot declare a variable as decimal number (or I could not find its
keyword).
dim t as decimal ' compilation error
You must use a Variant and use CDec to initiate it.
Point 4
Another user found out that this code crashes:
dim t
t = CDec("")
I confirm this crash.
Point 5
You can have very big numbers with a decimal number:
t = CDec("79228162514264300000000000001") ' accepted number
print t
t = t+1
print t ' correct result
But some values have a strange conversion:
t = CDec("79228162514264400000000000000")
print t ' gives 62406456049664
Other values give the same result
In general, for very high values there is a silent overflow:
t = CDec("79228162514264340000000000000")
print t ' gives zero
Point 6
Is it correct that CDec() accept this as a negative number ?
t = CDec(" 12345 - ")
print t
t = CDec("12345-")
print t
This is not the case for CLng() nor CInt()
Thanks for your attention
Bernard
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]