My head is still spinning with all the responses. Very interesting. Gave me some insight to some things I had not thought too much about.
So many solutions!
I think I will settle for one of the choices below:
1) Colin's:
wholenumber = bitor(afloat,0) fraction = afloat-wholenumber
or,
2) Some variation on Tab's
maybe:
if myFloat <> 0 then
if myFloat > 0 then intPart = integer(myFloat - 0.5)
else -- if myFloat < 0 intpart = integer(myFloat + 0.5)
end if
floatPart = myFloat - intPart
else -- to take car of zero value
intPart = 0 floatPart = 0.0
end if
3) or a mixture of Tab's and Pedja's
if myFloat <> 0 then
intPart = integer( abs(myFloat) - 0.5 ) * ( myFloat/abs(myFloat) )
floatPart = myFloat - intPart
else -- if myFloat = 0
intPart = 0 foatPart = 0.0
end if
Tab: I didn't quite follow your last post
intPart =integer(abs(myFloat) - 0.5) * (-1 + (((myFloat + abs(myFloat)) / (myFloat * 2))*2))
I understand the getting the sign back idea, but why put zero (myFloat + abs(myFloat)), divided by myFloat * 2 , and all multiplied by 2 again to overcome the double division. At first glance I thought it was a way of getting around the divide-by-zero problem but on second glance it does not do this; double zero is still zero.
floatPart =abs(myFloat) - abs(intPart) -- I don't think the abs are necessary in my case as I want a negative value to be negative
Don't worry too much. I understand if you don't want to spend the time to explain. And all those brackets do my head in.
Cheers, John
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]