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
317a26be
Commit
317a26be
authored
Apr 06, 2010
by
Vincent Belaïche
Committed by
Jay Belanger
Apr 06, 2010
Browse files
(calcFunc-fdiv): Allow `fdiv' to divide fractions.
parent
cb1b04a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
lisp/calc/calc-frac.el
lisp/calc/calc-frac.el
+25
-9
No files found.
lisp/calc/calc-frac.el
View file @
317a26be
...
...
@@ -205,16 +205,32 @@
n
temp
))
(
math-div
n
d
)))
(
defun
calcFunc-fdiv
(
a
b
)
; [R I I] [Public]
(
if
(
Math-num-integerp
a
)
(
if
(
Math-num-integerp
b
)
(
if
(
Math-zerop
b
)
(
math-reject-arg
a
"*Division by zero"
)
(
math-make-frac
(
math-trunc
a
)
(
math-trunc
b
)))
(
math-reject-arg
b
'integerp
))
(
math-reject-arg
a
'integerp
)))
(
cond
((
Math-num-integerp
a
)
(
cond
((
Math-num-integerp
b
)
(
if
(
Math-zerop
b
)
(
math-reject-arg
a
"*Division by zero"
)
(
math-make-frac
(
math-trunc
a
)
(
math-trunc
b
))))
((
eq
(
car-safe
b
)
'frac
)
(
if
(
Math-zerop
(
cadr
b
))
(
math-reject-arg
a
"*Division by zero"
)
(
math-make-frac
(
math-mul
(
math-trunc
a
)
(
caddr
b
))
(
cadr
b
))))
(
t
(
math-reject-arg
b
'integerp
))))
((
eq
(
car-safe
a
)
'frac
)
(
cond
((
Math-num-integerp
b
)
(
if
(
Math-zerop
b
)
(
math-reject-arg
a
"*Division by zero"
)
(
math-make-frac
(
cadr
a
)
(
math-mul
(
caddr
a
)
(
math-trunc
b
)))))
((
eq
(
car-safe
b
)
'frac
)
(
if
(
Math-zerop
(
cadr
b
))
(
math-reject-arg
a
"*Division by zero"
)
(
math-make-frac
(
math-mul
(
cadr
a
)
(
caddr
b
))
(
math-mul
(
caddr
a
)
(
cadr
b
)))))
(
t
(
math-reject-arg
b
'integerp
))))
(
t
(
math-reject-arg
a
'integerp
))))
(
provide
'calc-frac
)
...
...
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