automatic rounding to n significant digits

automatic rounding to n significant digits - Request to add a general setting that rounds all the values shown to n significant digits - Messages

#1 Posted: 9/30/2014 1:45:58 AM
brotjob

brotjob

7 likes in 71 posts.

Group: User

Often in engineering our calculations are not that accurate. That is why I want to round my values usually to three significant digits when they are shown on the worksheet. I wish a setting that applies to the whole worksheet where I can set this. Let me make an example with n=3:
s:=1.23456 m
s=1.23 m
s=1230 mm
s=0.00123 km

This feature should not affect the internal accuracy of Smath Studio. The values should be rounded for displaying only. For internal calculations it should use all the digits available.

#2 Posted: 9/30/2014 4:13:57 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

You are not alone. See feature request SS-21. You might vote for this request in the BTS.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#3 Posted: 9/30/2014 4:59:27 AM
brotjob

brotjob

7 likes in 71 posts.

Group: User

Thank you, I voted. It's a good idea to have the option to specify 4 digits if the first is 1.
#4 Posted: 9/30/2014 8:51:19 AM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

Wrote

It's a good idea to have the option to specify 4 digits if the first is 1.


What's the purpose of this feature?

If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#5 Posted: 9/30/2014 4:53:11 PM
brotjob

brotjob

7 likes in 71 posts.

Group: User

Wrote


What's the purpose of this feature?



It gives finer control, similar to a multimeter with half digits. I.e. true value and three significant digits 100.49 ->100. Gives a maximum error of 0.5%. You may find that too coarse. On the other hand four significant digits would round 999.945 to 999.9 giving an error of 0.005% which in some cases would imply an accuracy that is not there. With the 3+1-rule you round 100.26 to 100.5 (error 0.24%) and 999.49 to 999 (0.05% error). This may seem a good compromise.
1 users liked this post
Davide Carpi 10/1/2014 9:01:00 AM
#6 Posted: 11/6/2014 4:35:07 PM
brotjob

brotjob

7 likes in 71 posts.

Group: User

I created a demo file consisting of a function roundc() that does what I suggest.
roundc-sample.png
#7 Posted: 11/9/2014 6:32:53 PM
Celestion

Celestion

0 likes in 4 posts.

Group: User

Hello,

Could you automatically change the unit to the most relevant by the way ?
#8 Posted: 11/10/2014 4:04:15 PM
brotjob

brotjob

7 likes in 71 posts.

Group: User

Wrote


Could you automatically change the unit to the most relevant by the way ?



This would be a new feature request to me. I would not want to use such a feature. Why? Non-US mechanical engineers are used to millimeters, construction engineers to centimeters. US citizens use inches, geodetists chains and links (Smath does not handle the latter), fraternities the Smoot (which Smath handles!). All those units have a similar length. Who decides what is most relevant?
#9 Posted: 12/10/2014 6:00:27 PM
brotjob

brotjob

7 likes in 71 posts.

Group: User

I improved the function with exceptions handling. improved counts rounding
  • New Posts New Posts
  • No New Posts No New Posts