Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Delta Between Two Patch Sets: src/pkg/fmt/format.go

Issue 91840044: code review 91840044: all: spelling tweaks, A-G (Closed)
Left Patch Set: diff -r e141dda580af https://code.google.com/p/go Created 10 years, 11 months ago
Right Patch Set: diff -r 46ac9e6796a3 https://code.google.com/p/go Created 10 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/fmt/doc.go ('k') | src/pkg/go/ast/commentmap.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package fmt 5 package fmt
6 6
7 import ( 7 import (
8 "strconv" 8 "strconv"
9 "unicode/utf8" 9 "unicode/utf8"
10 ) 10 )
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 func (f *fmt) formatFloat(v float64, verb byte, prec, n int) { 362 func (f *fmt) formatFloat(v float64, verb byte, prec, n int) {
363 // We leave one byte at the beginning of f.intbuf for a sign if needed, 363 // We leave one byte at the beginning of f.intbuf for a sign if needed,
364 // and make it a space, which we might be able to use. 364 // and make it a space, which we might be able to use.
365 f.intbuf[0] = ' ' 365 f.intbuf[0] = ' '
366 slice := strconv.AppendFloat(f.intbuf[0:1], v, verb, prec, n) 366 slice := strconv.AppendFloat(f.intbuf[0:1], v, verb, prec, n)
367 // Add a plus sign or space to the floating-point string representation if missing and required. 367 // Add a plus sign or space to the floating-point string representation if missing and required.
368 // The formatted number starts at slice[1]. 368 // The formatted number starts at slice[1].
369 switch slice[1] { 369 switch slice[1] {
370 case '-', '+': 370 case '-', '+':
371 // If we're zero padding, want the sign before the leading zeros . 371 // If we're zero padding, want the sign before the leading zeros .
372 » » // Achieve this by writing the sign out and padding the postive number. 372 » » // Achieve this by writing the sign out and padding the positive number.
373 if f.zero && f.widPresent && f.wid > len(slice) { 373 if f.zero && f.widPresent && f.wid > len(slice) {
374 f.buf.WriteByte(slice[1]) 374 f.buf.WriteByte(slice[1])
375 f.wid-- 375 f.wid--
376 f.pad(slice[2:]) 376 f.pad(slice[2:])
377 return 377 return
378 } 378 }
379 // We're set; drop the leading space. 379 // We're set; drop the leading space.
380 slice = slice[1:] 380 slice = slice[1:]
381 default: 381 default:
382 // There's no sign, but we might need one. 382 // There's no sign, but we might need one.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 } 486 }
487 if i != 0 { 487 if i != 0 {
488 break 488 break
489 } 489 }
490 f.plus = true 490 f.plus = true
491 r = imag(v) 491 r = imag(v)
492 } 492 }
493 f.plus = oldPlus 493 f.plus = oldPlus
494 f.buf.Write(irparenBytes) 494 f.buf.Write(irparenBytes)
495 } 495 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b