See the top rated post in this thread. Click here

Results 1 to 5 of 5

Thread: Change Decimal points

  1. #1
    Active Member
    Join Date
    2005-02
    Posts
    95
    Login to Give a bone
    0

    Default Change Decimal points

    I have some values which is

    12.394845758
    12304.92876294
    1290.2883772

    I want to convert it to

    12.39
    12304.92
    1290.28
    with the two decimal point, Can is it possible.

    Someone send the Code.

  2. #2
    Super Moderator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,715
    Login to Give a bone
    0

    Default Re: Change Decimal points

    Open HELP, look at the FORMAT function, specifically the User-Defined Numeric Formats
    R.K. McSwain | CAD Panacea |

  3. #3
    Member
    Join Date
    2004-12
    Posts
    18
    Login to Give a bone
    0

    Default Re: Change Decimal points

    VBA.Round(val, decimalplaces)

  4. #4
    AUGI Addict MikeJarosz's Avatar
    Join Date
    2015-10
    Location
    New York NY
    Posts
    1,497
    Login to Give a bone
    1

    Default Re: Change Decimal points

    You definitely need to check out my post on your other question (fos < 1.09 and > 4#) Once you start writing programs, numbers are no longer what think they are. How computers represent numbers internally is a whole topic by itself.

    Yes, you can round numbers and make them appear to be what you want, but if you start doing arithmetic with these numbers, you are going to get some totally mysterious results.

    Don't forget...... all of your arithmetic is being done in binary. That alone should blow your mind! Programs like acad and excel shield you from the weirdness of number theory, but when you open that VBAIDE window, the shield drops and the fun starts.

    http://www.lahey.com/float.htm.
    "everything you know is wrong...." -FST

  5. #5
    Super Moderator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,715
    Login to Give a bone
    0

    Default Re: Change Decimal points

    Quote Originally Posted by MikeJarosz
    You definitely need to check out my post on your other question (fos < 1.09 and > 4#) Once you start writing programs, numbers are no longer what think they are. How computers represent numbers internally is a whole topic by itself.
    Good point.

    I once found a program that took the internal number, placed it in a dialog for the user to edit, then read those values from the dialog and placed them back in the program.

    The problem was that the edit box in the dialog truncated the long numbers to something like 7 or 8 decimal places. So even if the user didn't edit those numbers, precision was lost just be opening and closing the dialog.
    R.K. McSwain | CAD Panacea |

Similar Threads

  1. change Decimal places in display manager
    By cwalker in forum AutoCAD Map 3D - Data Connect (FDO)
    Replies: 1
    Last Post: 2009-08-20, 12:08 PM
  2. Change decimal separator for alternate units
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2007-11-19, 08:01 PM
  3. Replies: 9
    Last Post: 2007-01-17, 10:30 PM
  4. Change UCS based on 3 points
    By wommack in forum AutoLISP
    Replies: 1
    Last Post: 2006-02-09, 07:44 PM

Posting Permissions

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