planetarium: Use r3rs-number->string, just with (int) format.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Sun, 28 Apr 2013 01:02:22 +0000 (18:02 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Sun, 28 Apr 2013 01:02:22 +0000 (18:02 -0700)
Only integers formatted per the (int) specification are supported.

src/planetarium/geometry.scm
src/planetarium/mit-r3rs.scm
src/planetarium/tellurion.scm

index fabdf65d24b9371b8380801f5a4bf4729b8d7945..45a9f90dcbbd6ad36d9b59c284bd971e5d04187e 100644 (file)
@@ -71,9 +71,11 @@ USA.
   (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.
index 481c9b8f36e9aa1d518ad7faa9e6dd645a2b405a..6d70a0152ad17a903611f6678f12163612e3adc9 100644 (file)
@@ -62,7 +62,10 @@ USA.
   (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
index f8343e5672ee57caf256eccd125a0c42d3385f99..155435f5bb5497826747e9ddc85ee03d1847074a 100644 (file)
@@ -148,18 +148,22 @@ USA.
            (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