SMath Studio Forum
»
SMath Studio
»
Feature Requests
»
Result Formatting - Control over number of significant digits
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
Hi, The results formatting of engineering computations should reflect their valid precision. Typically, this is assumed to be tree significant digits, perhaps 4 if the leading digit is 1. This is based on the precision of most available input data and in former times that was the achievable precision of the slide rule. I find myself adjusting the number of digits in the right button menu on a case by case basis and have to correct the settings if Input data changes. Currently, the only way to enforce a given relative precision independent of the result's order of magnitude is to set the exponential threshold to 1 and to specify the number of digits accordingly. However, the exponential threshold is better used to provide readablity than to control precision. Very often I get results displayed as zero just because they are smaller than 0.01 and default precision set to 2 digits. One can use brute force to set the relative precision by defining a function like format(x_,n_):line(oom:round(log10(x_)-0.5,0),round(x_/{10^oom},n_-1)*10^oom,2,1)This yields format(1234563,2)=1200000format(0.00001234,2)=0.000012Proposal: - Provide a control over the number of significant digits including cases like 1234556 -> 1230000.
- Include an option to increase it by one if the first digit is 1. Setting "3" would then provide 1234000
- Include a setting of the global default for the option to retain trailing zeros.
- Provide control over corresponding default settings
My hope is that this might be useful for other users as well and that it is not too complex to implement. Best regards, Martin Kraska Edited by user 27 March 2014 16:07:41(UTC)
| Reason: Found out how to swith on display of trailing zeros in the context menu |
|
1 user thanked mkraska for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
This proposal is not directly related to the previous one but fits in the topic name. It is about creating formatted numbers for plot labels, i.e. formatted version of num2str. In the given code, there is just the option to specify decimal places after the delimiter and to specify the delimiter itself. One could easily explode the function into handling of significant digits, complex numbers with polar and rectangular shape, units and the conversion of matrices or lists (systems) in a single call. A nice place for such a function could be the custom funcions plugin, as there are already other string functions included. File Attachment(s): mkraska attached the following image(s): |
|
1 user thanked mkraska for this useful post.
|
|
|
SMath Studio Forum
»
SMath Studio
»
Feature Requests
»
Result Formatting - Control over number of significant digits
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.