Engineering format for displaying results - Сообщения
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
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"
WroteIt 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.
Wrote1.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.
WroteWroteIt 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
'|' 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
' ' :
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'
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
* 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^
-
Новые сообщения
-
Нет новых сообщений