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 - Сообщения

#1 Опубликовано: 30.09.2014 01:45:58
brotjob

brotjob

7 сообщений из 71 понравились пользователям.

Группа: 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 Опубликовано: 30.09.2014 04:13:57
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: 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 Опубликовано: 30.09.2014 04:59:27
brotjob

brotjob

7 сообщений из 71 понравились пользователям.

Группа: User

Thank you, I voted. It's a good idea to have the option to specify 4 digits if the first is 1.
#4 Опубликовано: 30.09.2014 08:51:19
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: 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 Опубликовано: 30.09.2014 16:53:11
brotjob

brotjob

7 сообщений из 71 понравились пользователям.

Группа: 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 пользователям понравился этот пост
Davide Carpi 01.10.2014 09:01:00
#6 Опубликовано: 06.11.2014 16:35:07
brotjob

brotjob

7 сообщений из 71 понравились пользователям.

Группа: User

I created a demo file consisting of a function roundc() that does what I suggest.
roundc-sample.png
#7 Опубликовано: 09.11.2014 18:32:53
Celestion

Celestion

0 сообщений из 4 понравились пользователям.

Группа: User

Hello,

Could you automatically change the unit to the most relevant by the way ?
#8 Опубликовано: 10.11.2014 16:04:15
brotjob

brotjob

7 сообщений из 71 понравились пользователям.

Группа: 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 Опубликовано: 10.12.2014 18:00:27
brotjob

brotjob

7 сообщений из 71 понравились пользователям.

Группа: User

I improved the function with exceptions handling. improved counts rounding
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений