Mercurial > emacs
comparison lisp/calc/calc-frac.el @ 107792:84df551e8c64
(calcFunc-fdiv): Use `nth' to choose elements from list.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Tue, 06 Apr 2010 20:43:23 -0500 |
parents | 439c9c198a6b |
children | 417b1e4d63cd |
comparison
equal
deleted
inserted
replaced
107791:439c9c198a6b | 107792:84df551e8c64 |
---|---|
212 ((Math-num-integerp b) | 212 ((Math-num-integerp b) |
213 (if (Math-zerop b) | 213 (if (Math-zerop b) |
214 (math-reject-arg a "*Division by zero") | 214 (math-reject-arg a "*Division by zero") |
215 (math-make-frac (math-trunc a) (math-trunc b)))) | 215 (math-make-frac (math-trunc a) (math-trunc b)))) |
216 ((eq (car-safe b) 'frac) | 216 ((eq (car-safe b) 'frac) |
217 (if (Math-zerop (cadr b)) | 217 (if (Math-zerop (nth 1 b)) |
218 (math-reject-arg a "*Division by zero") | 218 (math-reject-arg a "*Division by zero") |
219 (math-make-frac (math-mul (math-trunc a) (caddr b)) (cadr b)))) | 219 (math-make-frac (math-mul (math-trunc a) (nth 2 b)) (nth 1 b)))) |
220 (t (math-reject-arg b 'integerp)))) | 220 (t (math-reject-arg b 'integerp)))) |
221 ((eq (car-safe a) 'frac) | 221 ((eq (car-safe a) 'frac) |
222 (cond | 222 (cond |
223 ((Math-num-integerp b) | 223 ((Math-num-integerp b) |
224 (if (Math-zerop b) | 224 (if (Math-zerop b) |
225 (math-reject-arg a "*Division by zero") | 225 (math-reject-arg a "*Division by zero") |
226 (math-make-frac (cadr a) (math-mul (caddr a) (math-trunc b))))) | 226 (math-make-frac (cadr a) (math-mul (nth 2 a) (math-trunc b))))) |
227 ((eq (car-safe b) 'frac) | 227 ((eq (car-safe b) 'frac) |
228 (if (Math-zerop (cadr b)) | 228 (if (Math-zerop (nth 1 b)) |
229 (math-reject-arg a "*Division by zero") | 229 (math-reject-arg a "*Division by zero") |
230 (math-make-frac (math-mul (cadr a) (caddr b)) (math-mul (caddr a) (cadr b))))) | 230 (math-make-frac (math-mul (nth 1 a) (nth 2 b)) (math-mul (nth 2 a) (nth 1 b))))) |
231 (t (math-reject-arg b 'integerp)))) | 231 (t (math-reject-arg b 'integerp)))) |
232 (t | 232 (t |
233 (math-reject-arg a 'integerp)))) | 233 (math-reject-arg a 'integerp)))) |
234 | 234 |
235 (provide 'calc-frac) | 235 (provide 'calc-frac) |