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
92877e99
Commit
92877e99
authored
33 years ago
by
ram
Browse files
Options
Downloads
Patches
Plain Diff
Fixed FORMAT-PRINT-NUMBER to correctly insert commas for negative numbers
(don't print -,123).
parent
19819687
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/format.lisp
+15
-14
15 additions, 14 deletions
code/format.lisp
with
15 additions
and
14 deletions
code/format.lisp
+
15
−
14
View file @
92877e99
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
;;;
(
ext:file-comment
(
ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/format.lisp,v 1.
8
1991/0
2/25 23:52:27
ram Exp $"
)
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/format.lisp,v 1.
9
1991/0
7/08 13:09:36
ram Exp $"
)
;;;
;;;
;;; **********************************************************************
;;; **********************************************************************
;;;
;;;
...
@@ -984,7 +984,7 @@
...
@@ -984,7 +984,7 @@
:end2
pos
))
:end2
pos
))
(
pos
length
(
-
pos
3
))
(
pos
length
(
-
pos
3
))
(
new-pos
new-length
(
-
new-pos
4
)))
(
new-pos
new-length
(
-
new-pos
4
)))
((
not
(
pl
usp
pos
)
)
new-string
)
((
min
usp
pos
)
new-string
)
(
declare
(
fixnum
length
new-length
pos
new-pos
))))
(
declare
(
fixnum
length
new-length
pos
new-pos
))))
...
@@ -1019,19 +1019,20 @@
...
@@ -1019,19 +1019,20 @@
(
defun
format-print-number
(
number
radix
print-commas-p
print-sign-p
parms
)
(
defun
format-print-number
(
number
radix
print-commas-p
print-sign-p
parms
)
(
with-format-parameters
parms
(
with-format-parameters
parms
((
mincol
0
)
(
padchar
#\space
)
(
commachar
#\,
))
((
mincol
0
)
(
padchar
#\space
)
(
commachar
#\,
))
(
let*
((
*print-base*
radix
)
(
let
((
*print-base*
radix
))
(
text
(
princ-to-string
number
)))
(
if
(
integerp
number
)
(
if
(
integerp
number
)
(
format-write-field
(
let*
((
text
(
princ-to-string
(
abs
number
)))
(
if
(
and
(
plusp
number
)
print-sign-p
)
(
commaed
(
if
print-commas-p
(
if
print-commas-p
(
format-add-commas
text
commachar
)
(
concatenate
'string
"+"
(
format-add-commas
text
commachar
))
text
))
(
concatenate
'string
"+"
text
))
(
signed
(
cond
((
minusp
number
)
(
if
print-commas-p
(
concatenate
'string
"-"
commaed
))
(
format-add-commas
text
commachar
)
(
print-sign-p
text
))
(
concatenate
'string
"+"
commaed
))
mincol
1
0
padchar
t
)
;colinc = 1, minpad = 0, padleft = t
(
t
commaed
))))
(
write-string
text
)))))
;; colinc = 1, minpad = 0, padleft = t
(
format-write-field
signed
mincol
1
0
padchar
t
))
(
princ
number
)))))
;;;; Print a cardinal number in English
;;;; Print a cardinal number in English
...
...
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