Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
226590f8
Commit
226590f8
authored
Feb 07, 2011
by
Jay Belanger
Browse files
calc/calc-units.el (math-logunits-quant): Add support for
non-logarithmic units.
parent
4ec28e14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
18 deletions
+25
-18
lisp/ChangeLog
lisp/ChangeLog
+5
-0
lisp/calc/calc-units.el
lisp/calc/calc-units.el
+20
-18
No files found.
lisp/ChangeLog
View file @
226590f8
2011-02-07 Jay Belanger <jay.p.belanger@gmail.com>
* calc/calc-units.el (math-logunits-quant): Add support for
non-logarithmic units.
2011-02-07 Ken Manheimer <ken.manheimer@gmail.com>
* allout.el (allout-after-copy-or-kill-hook): New hook for
...
...
lisp/calc/calc-units.el
View file @
226590f8
...
...
@@ -1737,26 +1737,28 @@ If EXPR is nil, return nil."
(
calc-binary-op
"lu/"
'calcFunc-lupowerdiv
arg
)))))
(
defun
math-logunits-quant
(
val
ref
power
)
(
let
((
lunit
(
math-simplify
(
math-extract-logunits
val
))))
(
let*
((
units
(
math-simplify
(
math-extract-units
val
)))
(
lunit
(
math-simplify
(
math-extract-logunits
units
))))
(
if
(
not
(
eq
(
car-safe
lunit
)
'var
))
(
calc-record-why
"*Improper logarithmic unit"
lunit
)
(
if
(
not
(
eq
1
(
math-simplify
(
math-extract-units
(
math-div
val
lunit
)))))
(
calc-record-why
"*Inappropriate units"
nil
)
(
let
((
coeff
(
math-simplify
(
math-div
val
lunit
))))
(
if
(
equal
lunit
'
(
var
dB
var-dB
))
(
math-mul
ref
(
math-pow
10
(
math-div
coeff
(
if
power
10
20
))))
(
math-mul
ref
(
calcFunc-exp
(
if
power
(
math-mul
2
coeff
)
coeff
)))))))))
(
let
((
runits
(
math-simplify
(
math-div
units
lunit
)))
(
coeff
(
math-simplify
(
math-div
val
units
))))
(
math-mul
(
if
(
equal
lunit
'
(
var
dB
var-dB
))
(
math-mul
ref
(
math-pow
10
(
math-div
coeff
(
if
power
10
20
))))
(
math-mul
ref
(
calcFunc-exp
(
if
power
(
math-mul
2
coeff
)
coeff
))))
runits
)))))
(
defvar
calc-logunits-field-reference
)
(
defvar
calc-logunits-power-reference
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment