Charles, here's the output of the following test program with the cast to ulong in place
dim as ushort ip(NI-1)
dim as string s
dim as integer i
? "Pi = ";etoasc(@epi(0), 20)
ediv(@eten(0),@epi(0),@ip(0))
? "Pi/10 = ";etoasc(@ip(0), 20)
? "1.0 = ";etoasc(@eone(0), 20)
emul(@epi(0), @epi(0), @ip(0))
? "Pi^2 = ";etoasc(@ip(0), 20)
for i=4 to 20
? etoasc(@epi(0), i)
next
Print "Press RETURN to end ";
sleep
Pi = 3.14159265358979323846e0
Pi/10 = 3.14159265358979323846e-1
1.0 = 1.00000000000000000000e0
Pi^2 = 9.86960440108935861883e0
3.1416e0
3.14159e0
3.141593e0
3.1415927e0
3.14159265e0
3.141592654e0
3.1415926536e0
3.14159265359e0
3.141592653590e0
3.1415926535898e0
3.14159265358979e0
3.141592653589793e0
3.1415926535897932e0
3.14159265358979324e0
3.141592653589793238e0
3.1415926535897932385e0
3.14159265358979323846e0
Press RETURN to end
if I take out the cast statement afore mentioned you get this (using a long variable instead of &hffffL makes no difference)
Pi = 2.68427263874999999985e15
Pi/10 = 2.19895614566399999988e19
1.0 = 1.00000000000000000000e0
Pi^2 = 1.16411769059045078135e6
2.6843e15
2.68427e15
2.684273e15
2.6842726e15
2.68427264e15
2.684272639e15
2.6842726387e15
2.68427263875e15
2.684272638750e15
2.6842726387500e15
2.68427263875000e15
2.684272638750000e15
2.6842726387500000e15
2.68427263875000000e15
2.684272638750000000e15
2.6842726387499999999e15
2.68427263874999999985e15
Press RETURN to end
the L suffix does not appear to be important but the cast is.
it took me quite some time to find the cause of the problem.
[edit]
if I change the order of the operands to larger first then it works without casting
that is, instead of
if (cast(ulong, tdenm) * &hffffL) < tnum then
to
if tnum >=(tdenm * &hffffL) then
it works
[/edit]
Bookmarks