Engineering format for displaying results

Engineering format for displaying results - Сообщения

#1 Опубликовано: 24.02.2010 09:17:48
henry crun

henry crun

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

Группа: User

I would like an option for displaying results in engineering notation/format
ie where the exponents are all multiples of 3. This is a lamented feature of the old HP calculator.
eg scientific format = 3.7*10^4 ; engineering format = 37*10^3
#2 Опубликовано: 03.03.2014 04:01:42
crun2

crun2

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

Группа: User

Further, where units are used, it would be able to display results with the correct exponent prefix
eg where now it shows "1.4*10^-8 m" it would show "14 nm".

Under Tools>Options>Calculation tab, below "Exponential Threshold" entry field add checkboxes for
- Engineering Format Exponents (tooltip says "makes all exponents multiples of 3")
and Use Exponent Prefix for Units (tooltip says "eg Display mm instead of 10^-3 m"
#3 Опубликовано: 03.03.2014 09:15:15
Martin Kraska

Martin Kraska

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

Группа: Moderator

You can do that right now.

The attached help page is found in the interactive handbook under

Toolbar [?]> Units of Measurement> Units in Results Display
unit.PNG
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 пользователям понравился этот пост
Radovan Omorjan 03.03.2014 10:13:00
#4 Опубликовано: 13.11.2014 13:23:54
zapzapouch

zapzapouch

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

Группа: User

That's just setting the units manually, though. It should be possible to specify the unit as "m", and it automatically displays "10 nm" or "10 km" when the number changes, without manually typing in "km".
#5 Опубликовано: 15.11.2014 07:15:28
brotjob

brotjob

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

Группа: User

Wrote

It should be possible to specify the unit as "m", and it automatically displays "10 nm" or "10 km" when the number changes, without manually typing in "km".



Can you specify such an algorithm? When would you change? 1.005 km or 1005 m? Would you also use the prefixes hecto deca deci and centi? No? But i.e. centimetre is widely used in construction engineering and hectolitres in the brewing industry. In mechanical engineering we use millimetres even for long measurements up to 50000 mm and short measurements down to one thousandth millimetre.

Would you rather write 1 day instead of 86400 s? Keep in mind day is not a SI unit just as degrees, litres and tonnes. So which prefix should Smath automatically use?

Because I do not see the algorithm I prefer setting my units manually. The only thing I could imagine is a set of tables for specific industries and units. I.e. use tonne for weights above 1000 kg (instead of Megagramms), in mechanical industry always use millimeters for lengths, use hours for time >1000 s and so on.
#6 Опубликовано: 15.11.2014 10:08:36
zapzapouch

zapzapouch

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

Группа: User

Wrote

1.005 km or 1005 m?



1.005 km

Цитата

Would you also use the prefixes hecto deca deci and centi?



No, only multiples of 1000.

Цитата

In mechanical engineering we use millimetres even for long measurements up to 50000 mm and short measurements down to one thousandth millimetre.



So enter mm in the units box.

Цитата

Would you rather write 1 day instead of 86400 s?



86.4 ks

Цитата

Because I do not see the algorithm I prefer setting my units manually.



You will still be able to set units manually.

Added an issue here, where it sounds like there could be a special unit that means "automatic prefixes": http://smath.info/bts/Issues/IssueDetail.aspx?id=1245

Цитата

The only thing I could imagine is a set of tables for specific industries and units. I.e. use tonne for weights above 1000 kg (instead of Megagramms), in mechanical industry always use millimeters for lengths, use hours for time >1000 s and so on.



That could be good, too.
#7 Опубликовано: 06.12.2014 04:46:13
crun2

crun2

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

Группа: User

Wrote

Wrote

It should be possible to specify the unit as "m", and it automatically displays "10 nm" or "10 km" when the number changes, without manually typing in "km".



Can you specify such an algorithm?



Yes, here are two examples, if Andrei would like a template:

In Javascript
http://www.i2cchip.com/miscstuff/functionLib.js
(function is Real2Eng)

In Pascal:
http://www.i2cchip.com/miscstuff/engfmt.zip
It is inside spstring.pas. The helpfile explains in detail what the function Float2EngStr does:

function Float2EngStr(R:extended;MantissaDigits:word;FormatStr:string; Suffix:string):string

turns a real no. into a Engineering formatted string of PRECISION digits accuracy,
Engineering Format shifts exponent to powers of 3 (familiar to HP calculator users)
Will also suffix appropriate letter multipliers instead of E+XX eg k,M etc

To use defaults try Float2EngStr(1.0123456E4,0,'','' ) -> ' 10.12E+03'

MantissaDigits: number of digits (not including decimal) min is 3; 4 recomended

(default=4)

FormatStr: This set of chars sets how sign and exponents appear.
(default=' E-2' )
Format Str[1] sets how the leading char or sign appears
' ' leading for +ve , - for -ve
'|' no leading char for +ve, - for -ve
'+' always has leading + or -;
'-' no leading char for +ve,reduces precision by 1 for -ve to accomodate -
only if precision>=4; recommended for >=5. Keeps length constant for +ve & -ve #'s
FormatStr[2] sets exponent style and case. if lower case will use lower case 'e'
'E','e' : force exponential form
'F','f' : use prefix chars where possible (ie for E-15 to E+14 )
FormatStr[3] sets how exponent sign appears
'+' : always have + or - (string will be constant length)
'|' : no + for +ve, - for -ve (string will change length)
'-' : use + for +ve unless exponent>digits, then drop + to keep length constant
' ' : is NOT A VALID OPTION. Pascal read routines require EXXX not E XXX
FormatStr[4] number of digits in ExponentDigits (range '1' to '4' )
If exponent has more digits than ExponentDigits (very large or very close to zero)
then length will be greater. See ClipFloat()

If either FormatStr or MantissaDigits are invalid, sets to default.
eg
Float2EngStr(1.978269E+07,5,' F-2','Hz' ) = '19.783 MHz'
Float2EngStr(1.978269E+07,5,' E-2','' ) = '19.783E+06'
Float2EngStr(1.978269E-02,5,'-f-2','' ) = '-19.78e-03'
Float2EngStr(1.978269E+103,5,'-f-2','' ) = '19.783e102'
Float2EngStr(-1.978269E+103,5,'-F-2','' ) = '-19.78E102'
#8 Опубликовано: 06.12.2014 05:10:00
crun2

crun2

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

Группа: User

BTW, it would also really help to have a fast way of entering powers of ten.
In electronics, every number has a large exponent and entering 15 * 10 ^ 7 is harder than 15E7
(8 keystrokes vs 4)

I think that there should be an option to treat the special case of E , as the exponent operator.
* is automatically inserted when going from numbers to letters, but this is no problem.
ie new behaviour: 15E6 -> 15*10^6
old: 15E6 -> 15*E6

Problem: variable names like E or E6FilmMass, would need to have an operator explicitly used, and could not use the current automatic * operator insertion

Alternatives: use ctrl+E or alt+E as simple keystroke macro to insert: *10^
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений