Only integers formatted per the (int) specification are supported.
(let* ((deg.r (integer-divide (abs degrees) 3600))
(min.r (integer-divide (cdr deg.r) 60)))
(string-append (if (negative? degrees) "-" "+")
- (number->string (car deg.r))
- ":"(string-pad-left (number->string (car min.r)) 2 #\0)
- ":"(string-pad-left (number->string (cdr min.r)) 2 #\0))))
+ (number->string (car deg.r) '(int))
+ ":"(string-pad-left (number->string (car min.r) '(int))
+ 2 #\0)
+ ":"(string-pad-left (number->string (cdr min.r) '(int))
+ 2 #\0))))
(define (lesser-angle a b)
;; Angle B translated to (not more than 2pi) numerically less than A.
(string-append a b))
(define (r3rs-number->string number format)
- (error "Unimplemented: r3rs-number->string:" number format))
+ (if (not (and (equal? format '(int))
+ (integer? number)))
+ (warn "Unimplemented: r3rs-number->string:" number format))
+ (number->string number))
(define (r3rs-string->number string exactness radix)
(let ((n (string->number string (case radix
(string-append (cond ((flo:negative? lat) "S")
((flo:positive? lat) "N")
(else ""))
- (number->string lat-deg)
+ (number->string lat-deg '(int))
"°"
- (string-pad-left (number->string lat-min) 2 #\0)
+ (string-pad-left (number->string lat-min '(int))
+ 2 #\0)
"."
- (string-pad-left (number->string lat-frac) 3 #\0)
+ (string-pad-left (number->string lat-frac '(int))
+ 3 #\0)
"' "
(cond ((flo:negative? long) "W")
((flo:positive? long) "E")
(else ""))
- (number->string long-deg)
+ (number->string long-deg '(int))
"°"
- (string-pad-left (number->string long-min) 2 #\0)
+ (string-pad-left (number->string long-min '(int))
+ 2 #\0)
"."
- (string-pad-left (number->string long-frac) 3 #\0)
+ (string-pad-left (number->string long-frac '(int))
+ 3 #\0)
"'")))))))
\ No newline at end of file