TheSwamp

CAD Forums => CAD General => Topic started by: DanB on October 31, 2018, 10:45:26 AM

Title: Table value precision
Post by: DanB on October 31, 2018, 10:45:26 AM
I need to have a table cell value truncated to 2 decimal places. The current cell is "=(J29*0.3)" and returns the value of 23.83462 which I can properly display as 23.84 but causes issues later when further applied to another cell. What I would like to have is the cell value be "23.84", any suggestions?
Title: Re: Table value precision
Post by: DanB on October 31, 2018, 11:39:19 AM
Still hoping someone might have a better suggestion but for now this is working:

Code: [Select]
=(trunc(abs (trunc (J29*0.3) -(J29*0.3))*100))/100+trunc (J29*0.3)
Title: Re: Table value precision
Post by: mjfarrell on October 31, 2018, 12:48:53 PM
this?
Title: Re: Table value precision
Post by: DanB on October 31, 2018, 01:55:24 PM
That setting only applies to what is displayed in the table. My problem is I am using that cell's value for additional computations.
Title: Re: Table value precision
Post by: mjfarrell on October 31, 2018, 03:03:13 PM
so your data that is entered needs to accurate enough to not introduce errors later.....

as such it would appear the underlying issue is the accuracy of the data entered (or what it is being extracted from) not the format of the cell....

the solution is to get the input data correct....from my perspective
Title: Re: Table value precision
Post by: DanB on November 01, 2018, 12:12:52 PM
Nothing wrong with the level of accuracy of the data. It just so happens when taking several steps involving a percentage of certain cells then adding or subtracting various results, they will round one way or the other and appear not to total that which is displayed.
Title: Re: Table value precision
Post by: ChrisCarlson on November 01, 2018, 02:49:16 PM
AutoCAD has a pretty rudimentary table formula backend. What about pushing this this to excel and simply link to an excel file?
Title: Re: Table value precision
Post by: DanB on November 01, 2018, 04:13:44 PM
Linking to excel is a possibility. It's frustrating though that there is a "trunc" function available, however, it is defined as truncating to an integer. Simply allowing the user to truncate a value to any given decimal precision would be beneficial, at least to me at the moment.
Title: Re: Table value precision
Post by: ChrisCarlson on November 02, 2018, 08:50:43 AM
What exactly is the table doing? Another option could be taking all of the formulas out of the table and calculate the cell values through lisp.

Take a gander here (https://www.cadtutor.net/forum/topic/62165-searching-lisp-about-adding-texts-to-table/?do=findComment&comment=512950).
Title: Re: Table value precision
Post by: dgorsman on November 02, 2018, 10:02:02 AM
Or, just use Excel entirely instead of trying to use AutoCAD as a spreadsheet.  Kind of like using Excel as a drawing program...
Title: Re: Table value precision
Post by: ronjonp on November 02, 2018, 11:13:12 AM
Or, just use Excel entirely instead of trying to use AutoCAD as a spreadsheet.  Kind of like using Excel as a drawing program...
Agreed.