PDA

View Full Version : Decimal point.



NinjaTurtle
08-20-2002, 04:29 AM
dear,

i do the calculation of divide, and i get 7 decimal point values(23.1234567) but i want it to be 4 decimal digits : 23.1234

how? i tried Cdbl(Total) , but it still get the 23.1234567 and not 23.1234

webmarkart
08-20-2002, 04:47 AM
someone will correct me if I'm wrong, but maybe you could use the split function at the decimal point and the left function at 4 digits.

raf
08-20-2002, 09:42 AM
if you always have 7 values after the decimal point, then you can use this :

dim lenght
lenght = Len(string) - 3 'gives you the length - 3
Left(string,lenght) 'gives you the string without the last three caracters

you might also want to check on this :
http://www.codingforums.com/showthread.php?s=&threadid=4126


using a split function on the decimal point is not the way to go. i'm from belgium an we are that crazy that we use the . and the , in the oppisite way. like this 20.000,32566 so if you would like to use a split unction, you should check the LCDI of the user

allida77
08-20-2002, 02:10 PM
Use the FormatNumber() (http://www.devguru.com/Technologies/vbscript/quickref/formatnumber.html) function. The split() function is for strings.

Roy Sinclair
08-20-2002, 03:42 PM
There's a data type just for currency.

Try: TheResult = CCur(operand) / CCur(Divisor)

TheResult should end up in currency format.

whammy
08-21-2002, 07:29 PM
<% = Round(23.1234567,4) %> will give you:

32.1235

Is that what you need? :D