Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
5b6d1bf2
Commit
5b6d1bf2
authored
21 years ago
by
gerd
Browse files
Options
Downloads
Patches
Plain Diff
* src/code/numbers.lisp (round): Handle the case truncate
returning a zero remainder specially.
parent
177c4804
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/numbers.lisp
+16
-14
16 additions, 14 deletions
code/numbers.lisp
with
16 additions
and
14 deletions
code/numbers.lisp
+
16
−
14
View file @
5b6d1bf2
...
...
@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
(
ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/numbers.lisp,v 1.4
8
2003/08/
19 12:23:36
gerd Exp $"
)
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/numbers.lisp,v 1.4
9
2003/08/
22 09:20:02
gerd Exp $"
)
;;;
;;; **********************************************************************
;;;
...
...
@@ -733,19 +733,21 @@
(
if
(
eql
divisor
1
)
(
round
number
)
(
multiple-value-bind
(
tru
rem
)
(
truncate
number
divisor
)
(
let
((
thresh
(
/
(
abs
divisor
)
2
)))
(
cond
((
or
(
>
rem
thresh
)
(
and
(
=
rem
thresh
)
(
oddp
tru
)))
(
if
(
minusp
divisor
)
(
values
(
-
tru
1
)
(
+
rem
divisor
))
(
values
(
+
tru
1
)
(
-
rem
divisor
))))
((
let
((
-thresh
(
-
thresh
)))
(
or
(
<
rem
-thresh
)
(
and
(
=
rem
-thresh
)
(
oddp
tru
))))
(
if
(
minusp
divisor
)
(
values
(
+
tru
1
)
(
-
rem
divisor
))
(
values
(
-
tru
1
)
(
+
rem
divisor
))))
(
t
(
values
tru
rem
)))))))
(
if
(
zerop
rem
)
(
values
(
if
(
minusp
tru
)
-1
1
)
rem
)
(
let
((
thresh
(
/
(
abs
divisor
)
2
)))
(
cond
((
or
(
>
rem
thresh
)
(
and
(
=
rem
thresh
)
(
oddp
tru
)))
(
if
(
minusp
divisor
)
(
values
(
-
tru
1
)
(
+
rem
divisor
))
(
values
(
+
tru
1
)
(
-
rem
divisor
))))
((
let
((
-thresh
(
-
thresh
)))
(
or
(
<
rem
-thresh
)
(
and
(
=
rem
-thresh
)
(
oddp
tru
))))
(
if
(
minusp
divisor
)
(
values
(
+
tru
1
)
(
-
rem
divisor
))
(
values
(
-
tru
1
)
(
+
rem
divisor
))))
(
t
(
values
tru
rem
))))))))
(
defun
rem
(
number
divisor
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment