Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to get rid of decimals (Single)

Status
Not open for further replies.

arneweise77

Programmer
Apr 25, 2002
46
SE
Hi everyone!

I believe this is a simple problem, but I need a simple solution as well, which I can´t figure out.

I have this single decimal variable let´s say 3,45555555 returned to me from a function, but all I need is 3,46 or something close to that.

Can someone help med solve this, the best and easiest way possible?

Thanx in advance!

Arne
 
Multiply by 100, then trim the decimals off by assigning it to an integer type. Then reassign it to a floating-point type by dividing by 100.

Chip H.
 

The function "Cint()" is to convert variable to integer.

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top