Results 1 to 7 of 7

Thread: convert Scientific Notation to regualar format

  1. #1
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default convert Scientific Notation to regualar format

    does anyone know if there is a way to convert scientific notation to regular formatting. I have a program that I think is having an issue with the scientific notation, so I want to provide it with an actual number:
    instead of containing 1.25933e+007 I would like 12593300 to be the number I see when the variable is inspected

  2. #2
    I could stop if I wanted to
    Join Date
    2003-12
    Location
    Pittsburgh, PA
    Posts
    355
    Login to Give a bone
    0

    Default Re: convert Scientific Notation to regualar format

    maybe this will work for you...
    Code:
    (atoi (rtos 1.25933e+007 2 0))

  3. #3
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: convert Scientific Notation to regualar format

    Quote Originally Posted by lpseifert View Post
    maybe this will work for you...
    Code:
    (atoi (rtos 1.25933e+007 2 0))
    that's the same as saying (fix 1.25933e+007) the problem is, it still doesnt appear to work, infact, it makes it so all the blocks are rejected. I think my final answer needs to be a real number, not an integer.

  4. #4
    I could stop if I wanted to
    Join Date
    2003-12
    Location
    Pittsburgh, PA
    Posts
    355
    Login to Give a bone
    0

    Default Re: convert Scientific Notation to regualar format

    when I entered it at the command line it returned 12593300; so I figured it might work.
    If you enter (atof (rtos 1.25933e+007 2 0)) it returns 1.25933e+007
    I dunno

  5. #5
    I could stop if I wanted to
    Join Date
    2006-07
    Posts
    233
    Login to Give a bone
    0

    Default Re: convert Scientific Notation to regualar format

    I believe the rtos function is what you are looking for. If you use the below code it will return the scientific notation back as a real number.

    Code:
    (setq num 1.25933e+007);; using this to set the number though this could be another variable
    (setq realnum(atoi (rtos num 2)));; retuns integer from scientific notation
    
    ;; returns from command prompt
    Command: (setq num 1.25933e+007)
    1.25933e+007
    
    Command: (setq realnum (atoi(rtos num 2)))
    12593300

  6. #6
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: convert Scientific Notation to regualar format

    atoi gives back an integer, if I use atof, it gives back a real number but in scientific notation. there as to be a setting somewhere that tells autocad to use scientific or regular format depending on how large or small the number is.

  7. #7
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: convert Scientific Notation to regualar format

    I decided to use an alternative method as opposed to fixing the rounding issues. Now, if the drawing is at larger coordinates, the program that I have asks the user to select an alternative base point, then using that base point, everything in the drawing gets moved closer to 0,0. then the program does it's thing (makes a block of some notes), and then undoes all the way back to the beginning of the program.

Similar Threads

  1. NEED TO CONVERT NWD TO ANY OTHER 3D format
    By dominik.zaras in forum NavisWorks - General
    Replies: 14
    Last Post: 2020-05-29, 08:47 AM
  2. Convert from Mastercam format to DWG
    By Commissar Rod in forum Software
    Replies: 1
    Last Post: 2007-06-21, 06:42 PM
  3. Replies: 6
    Last Post: 2007-05-24, 06:49 PM
  4. Convert JPG format into a Block
    By AcadDurango in forum Raster Design - General
    Replies: 3
    Last Post: 2005-08-23, 08:01 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
  •