Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Decimal point.

  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    358
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Decimal point.

    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
    Thanks.
    =====================================================
    From NinjaTurtle
    ++http://ohmygoh.blogspot.com|http://technology.ohmygoh.com++

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    Raleigh, NC
    Posts
    484
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    -WebMark Art
    Programming is 80% thinking and 20% spelling

  • #3
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 :
    does ASP have a Ceil function?


    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
    Last edited by raf; 08-20-2002 at 09:04 AM.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Use the FormatNumber() function. The split() function is for strings.

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There's a data type just for currency.

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

    TheResult should end up in currency format.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <% = Round(23.1234567,4) %> will give you:

    32.1235

    Is that what you need?
    Last edited by whammy; 08-23-2002 at 11:39 PM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •