Changeset 015558a3df8fae2686c7b6e2f049da3f4b1a2cd8
- Timestamp:
- 04/07/12 23:28:08 (14 months ago)
- Author:
- Raymond Toy <toy.raymond@…>
- Children:
- c86217a5f7191f1a29566d6ee24cb57344dd546d
- Parents:
- a5a4c7acd95d1946e7cf426f9a927a918c9e2afc
- git-committer:
- Raymond Toy <toy.raymond@…> (04/07/12 23:28:08)
- Message:
-
Fix a divide by zero error in s-exp-integral-e for v = 1. We need to
skip the first term in the series.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rfe8cff
|
r015558
|
|
| 258 | 258 | ;; result is greater than 1. |
| 259 | 259 | #+nil |
| 260 | | (defun erf (z) |
| | 260 | (defun cf-erf (z) |
| 261 | 261 | (let* ((z2 (* z z)) |
| 262 | 262 | (twoz2 (* 2 z2))) |
| … |
… |
|
| 505 | 505 | (loop for k from 0 |
| 506 | 506 | for term = 1 then (* term (/ -z k)) |
| 507 | | for sum = (/ (- 1 v)) then (+ sum (let ((denom (- k n-1))) |
| 508 | | (if (zerop denom) |
| 509 | | 0 |
| 510 | | (/ term denom)))) |
| | 507 | for sum = (if (zerop n-1) |
| | 508 | 0 |
| | 509 | (/ (- 1 v))) |
| | 510 | then (+ sum (let ((denom (- k n-1))) |
| | 511 | (if (zerop denom) |
| | 512 | 0 |
| | 513 | (/ term denom)))) |
| 511 | 514 | when (< (abs term) (* (abs sum) eps)) |
| 512 | 515 | return sum))) |