
(/VERSIONCHECK 2) 

(DEFUN |NUMFMT;replaceD| (|c| $)
  (COND
   ((SPADCALL |c| (SPADCALL "D" (QREFELT $ 8)) (QREFELT $ 10))
    (SPADCALL "E" (QREFELT $ 8)))
   ('T |c|))) 

(DEFUN |NUMFMT;replaced| (|c| $)
  (COND
   ((SPADCALL |c| (SPADCALL "d" (QREFELT $ 8)) (QREFELT $ 10))
    (SPADCALL "E" (QREFELT $ 8)))
   ('T |c|))) 

(DEFUN |NUMFMT;contract| (|s| $)
  (PROG (|ls|)
    (RETURN
     (SEQ
      (LETT |s|
            (SPADCALL (CONS (|function| |NUMFMT;replaceD|) $) |s|
                      (QREFELT $ 12))
            . #1=(|NUMFMT;contract|))
      (LETT |s|
            (SPADCALL (CONS (|function| |NUMFMT;replaced|) $) |s|
                      (QREFELT $ 12))
            . #1#)
      (LETT |ls| (SPADCALL |s| (SPADCALL " " (QREFELT $ 8)) (QREFELT $ 14))
            . #1#)
      (EXIT (LETT |s| (SPADCALL |ls| (QREFELT $ 15)) . #1#)))))) 

(DEFUN |NUMFMT;check| (|s| $)
  (COND
   ((NUMBERP (READ-FROM-STRING |s|))
    (COND
     ((SPADCALL (CONS #'|NUMFMT;check!0| $) |s| (QREFELT $ 17))
      (COND ((SPADCALL (CONS #'|NUMFMT;check!1| $) |s| (QREFELT $ 17)) 'T)
            (#1='T 'NIL)))
     (#1# 'T)))
   (#1# 'NIL))) 

(DEFUN |NUMFMT;check!1| (|c1| $)
  (SPADCALL |c1| (SPADCALL "." (QREFELT $ 8)) (QREFELT $ 10))) 

(DEFUN |NUMFMT;check!0| (|c1| $)
  (SPADCALL |c1| (SPADCALL "E" (QREFELT $ 8)) (QREFELT $ 10))) 

(DEFUN |NUMFMT;ScanFloatIgnoreSpaces;SF;5| (|s| $)
  (PROG (|f| |sCheck| |sex|)
    (RETURN
     (SEQ
      (LETT |s| (|NUMFMT;contract| |s| $)
            . #1=(|NUMFMT;ScanFloatIgnoreSpaces;SF;5|))
      (COND
       ((NULL (|NUMFMT;check| |s| $)) (EXIT (|error| "Non-numeric value"))))
      (LETT |sex| (|interpret| (|packageTran| (|ncParseFromString| |s|)))
            . #1#)
      (LETT |sCheck| (SPADCALL (SPADCALL |sex| (QREFELT $ 23)) (QREFELT $ 23))
            . #1#)
      (EXIT
       (COND
        ((|BooleanEquality| (SPADCALL |sCheck| (QREFELT $ 22) (QREFELT $ 24))
                            'T)
         (LETT |f| (SPADCALL (SPADCALL |sex| (QREFELT $ 25)) (QREFELT $ 25))
               . #1#))
        ((|BooleanEquality|
          (SPADCALL (SPADCALL |sex| (QREFELT $ 25)) (QREFELT $ 26)) 'T)
         (SEQ (LETT |f| (SPADCALL |sex| (QREFELT $ 25)) . #1#)
              (EXIT (SPADCALL |f| (QREFELT $ 29)))))
        ('T (|error| "Non-numeric value")))))))) 

(DEFUN |NUMFMT;ScanFloatIgnoreSpacesIfCan;SU;6| (|s| $)
  (PROG (|f| |sCheck| |sex|)
    (RETURN
     (SEQ
      (LETT |s| (|NUMFMT;contract| |s| $)
            . #1=(|NUMFMT;ScanFloatIgnoreSpacesIfCan;SU;6|))
      (COND ((NULL (|NUMFMT;check| |s| $)) (EXIT (CONS 1 "failed"))))
      (LETT |sex| (|interpret| (|packageTran| (|ncParseFromString| |s|)))
            . #1#)
      (LETT |sCheck| (SPADCALL (SPADCALL |sex| (QREFELT $ 23)) (QREFELT $ 23))
            . #1#)
      (EXIT
       (COND
        ((|BooleanEquality| (SPADCALL |sCheck| (QREFELT $ 22) (QREFELT $ 24))
                            'T)
         (LETT |f|
               (CONS 0
                     (SPADCALL (SPADCALL |sex| (QREFELT $ 25)) (QREFELT $ 25)))
               . #1#))
        ((|BooleanEquality|
          (SPADCALL (SPADCALL |sex| (QREFELT $ 25)) (QREFELT $ 26)) 'T)
         (SEQ (LETT |f| (SPADCALL |sex| (QREFELT $ 25)) . #1#)
              (EXIT (CONS 0 (SPADCALL |f| (QREFELT $ 29))))))
        ('T (CONS 1 "failed")))))))) 

(PUT '|NUMFMT;FormatArabic;PiS;7| '|SPADreplace| 'STRINGIMAGE) 

(DEFUN |NUMFMT;FormatArabic;PiS;7| (|n| $) (STRINGIMAGE |n|)) 

(PUT '|NUMFMT;ScanArabic;SPi;8| '|SPADreplace| 'PARSE-INTEGER) 

(DEFUN |NUMFMT;ScanArabic;SPi;8| (|s| $) (PARSE-INTEGER |s|)) 

(DEFUN |NUMFMT;FormatRoman;PiS;9| (|pn| $)
  (PROG (|s| |mm| |j| #1=#:G1873 |m0| |n| |d| |i| #2=#:G1860)
    (RETURN
     (SEQ (LETT |n| |pn| . #3=(|NUMFMT;FormatRoman;PiS;9|))
          (LETT |d| (+ (REMAINDER2 |n| 10) (QREFELT $ 39)) . #3#)
          (LETT |n| (QUOTIENT2 |n| 10) . #3#)
          (LETT |s| (QAREF1 (QREFELT $ 36) |d|) . #3#)
          (EXIT
           (COND ((ZEROP |n|) |s|)
                 (#4='T
                  (SEQ (LETT |d| (+ (REMAINDER2 |n| 10) (QREFELT $ 40)) . #3#)
                       (LETT |n| (QUOTIENT2 |n| 10) . #3#)
                       (LETT |s| (STRCONC (QAREF1 (QREFELT $ 37) |d|) |s|)
                             . #3#)
                       (EXIT
                        (COND ((ZEROP |n|) |s|)
                              (#4#
                               (SEQ
                                (LETT |d|
                                      (+ (REMAINDER2 |n| 10) (QREFELT $ 41))
                                      . #3#)
                                (LETT |n| (QUOTIENT2 |n| 10) . #3#)
                                (LETT |s|
                                      (STRCONC (QAREF1 (QREFELT $ 38) |d|) |s|)
                                      . #3#)
                                (EXIT
                                 (COND ((ZEROP |n|) |s|)
                                       (#4#
                                        (SEQ
                                         (LETT |d| (REMAINDER2 |n| 10) . #3#)
                                         (LETT |n| (QUOTIENT2 |n| 10) . #3#)
                                         (LETT |s|
                                               (STRCONC
                                                (MAKE-FULL-CVEC
                                                 (PROG1 (LETT #2# |d| . #3#)
                                                   (|check-subtype| (>= #2# 0)
                                                                    '(|NonNegativeInteger|)
                                                                    #2#))
                                                 (QREFELT $ 44))
                                                |s|)
                                               . #3#)
                                         (EXIT
                                          (COND ((ZEROP |n|) |s|)
                                                (#4#
                                                 (SEQ
                                                  (SEQ (LETT |i| 2 . #3#) G190
                                                       (COND
                                                        ((NULL
                                                          (COND
                                                           ((ZEROP |n|) 'NIL)
                                                           ('T 'T)))
                                                         #5=(GO G191)))
                                                       (SEQ
                                                        (LETT |d|
                                                              (REMAINDER2 |n|
                                                                          10)
                                                              . #3#)
                                                        (LETT |n|
                                                              (QUOTIENT2 |n|
                                                                         10)
                                                              . #3#)
                                                        (EXIT
                                                         (COND
                                                          ((ZEROP |d|)
                                                           "iterate")
                                                          ('T
                                                           (SEQ
                                                            (LETT |m0|
                                                                  (STRCONC
                                                                   (MAKE-FULL-CVEC
                                                                    |i|
                                                                    (QREFELT $
                                                                             45))
                                                                   (STRCONC "I"
                                                                            (MAKE-FULL-CVEC
                                                                             |i|
                                                                             (QREFELT
                                                                              $
                                                                              46))))
                                                                  . #3#)
                                                            (LETT |mm|
                                                                  (SPADCALL
                                                                   (PROGN
                                                                    (LETT #1#
                                                                          NIL
                                                                          . #3#)
                                                                    (SEQ
                                                                     (LETT |j|
                                                                           1
                                                                           . #3#)
                                                                     G190
                                                                     (COND
                                                                      ((QSGREATERP
                                                                        |j|
                                                                        |d|)
                                                                       #5#))
                                                                     (SEQ
                                                                      (EXIT
                                                                       (LETT
                                                                        #1#
                                                                        (CONS
                                                                         |m0|
                                                                         #1#)
                                                                        . #3#)))
                                                                     (LETT |j|
                                                                           (QSADD1
                                                                            |j|)
                                                                           . #3#)
                                                                     #6=(GO
                                                                         G190)
                                                                     G191
                                                                     (EXIT
                                                                      (NREVERSE0
                                                                       #1#))))
                                                                   (QREFELT $
                                                                            15))
                                                                  . #3#)
                                                            (COND
                                                             ((< 0
                                                                 (QCSIZE |s|))
                                                              (LETT |s|
                                                                    (STRCONC
                                                                     " " |s|)
                                                                    . #3#)))
                                                            (EXIT
                                                             (LETT |s|
                                                                   (STRCONC
                                                                    |mm| |s|)
                                                                   . #3#)))))))
                                                       (LETT |i| (QSADD1 |i|)
                                                             . #3#)
                                                       #6# G191 (EXIT NIL))
                                                  (EXIT |s|))))))))))))))))))))) 

(DEFUN |NUMFMT;ScanRoman;SPi;10| (|s| $)
  (PROG (#1=#:G1886 |Max| |tot| |n| |i| |c| |k| |nprens|)
    (RETURN
     (SEQ
      (LETT |s| (SPADCALL |s| (QREFELT $ 52)) . #2=(|NUMFMT;ScanRoman;SPi;10|))
      (LETT |tot| 0 . #2#) (LETT |Max| 0 . #2#)
      (LETT |i| (SPADCALL |s| (QREFELT $ 53)) . #2#)
      (SEQ G190
           (COND
            ((NULL (COND ((< |i| (SPADCALL |s| (QREFELT $ 54))) 'NIL) ('T 'T)))
             #3=(GO G191)))
           (SEQ (LETT |c| (SPADCALL |s| |i| (QREFELT $ 55)) . #2#)
                (LETT |i| (- |i| 1) . #2#)
                (LETT |n| (QAREF1 (QREFELT $ 42) (SPADCALL |c| (QREFELT $ 43)))
                      . #2#)
                (COND
                 ((< |n| 0)
                  (COND
                   ((SPADCALL |c| (QREFELT $ 46) (QREFELT $ 10))
                    (SEQ (LETT |nprens| 1 . #2#)
                         (SEQ G190
                              (COND
                               ((NULL
                                 (COND
                                  ((SPADCALL |c| (QREFELT $ 46) (QREFELT $ 10))
                                   (COND
                                    ((< |i| (SPADCALL |s| (QREFELT $ 54)))
                                     'NIL)
                                    ('T 'T)))
                                  ('T 'NIL)))
                                #3#))
                              (SEQ
                               (LETT |c| (SPADCALL |s| |i| (QREFELT $ 55))
                                     . #2#)
                               (LETT |i| (- |i| 1) . #2#)
                               (EXIT
                                (COND
                                 ((SPADCALL |c| (QREFELT $ 46) (QREFELT $ 10))
                                  (LETT |nprens| (+ |nprens| 1) . #2#)))))
                              NIL #4=(GO G190) G191 (EXIT NIL))
                         (EXIT
                          (COND
                           ((SPADCALL |c| (QREFELT $ 47) (QREFELT $ 10))
                            (SEQ
                             (SEQ (LETT |k| 1 . #2#) G190
                                  (COND
                                   ((OR (QSGREATERP |k| |nprens|)
                                        (NULL
                                         (COND
                                          ((< |i|
                                              (SPADCALL |s| (QREFELT $ 54)))
                                           'NIL)
                                          ('T 'T))))
                                    #3#))
                                  (SEQ
                                   (LETT |c| (SPADCALL |s| |i| (QREFELT $ 55))
                                         . #2#)
                                   (LETT |i| (- |i| 1) . #2#)
                                   (EXIT
                                    (COND
                                     ((NULL
                                       (SPADCALL |c| (QREFELT $ 45)
                                                 (QREFELT $ 10)))
                                      (|error|
                                       "Improper Roman numeral: unbalanced ')'")))))
                                  (LETT |k| (QSADD1 |k|) . #2#) #4# G191
                                  (EXIT NIL))
                             (EXIT
                              (LETT |n|
                                    (SPADCALL 10 (+ |nprens| 2) (QREFELT $ 56))
                                    . #2#))))
                           ('T (|error| "Improper Roman numeral: (x)"))))))
                   ('T
                    (|error|
                     (LIST "Improper character in Roman numeral: "
                           (SPADCALL |c| (QREFELT $ 58))))))))
                (EXIT
                 (COND ((< |n| |Max|) (LETT |tot| (- |tot| |n|) . #2#))
                       ('T
                        (SEQ (LETT |tot| (+ |tot| |n|) . #2#)
                             (EXIT (LETT |Max| |n| . #2#)))))))
           NIL #4# G191 (EXIT NIL))
      (EXIT
       (COND
        ((< |tot| 0)
         (|error|
          (LIST "Improper Roman numeral: " (SPADCALL |tot| (QREFELT $ 59)))))
        ('T
         (PROG1 (LETT #1# |tot| . #2#)
           (|check-subtype| (> #1# 0) '(|PositiveInteger|) #1#))))))))) 

(DEFUN |NumberFormats| #1=()
  (PROG #1#
    (RETURN
     (PROG (#2=#:G1890)
       (RETURN
        (COND
         ((LETT #2# (HGET |$ConstructorCache| '|NumberFormats|)
                . #3=(|NumberFormats|))
          (|CDRwithIncrement| (CDAR #2#)))
         ('T
          (UNWIND-PROTECT
              (PROG1
                  (CDDAR
                   (HPUT |$ConstructorCache| '|NumberFormats|
                         (LIST (CONS NIL (CONS 1 (|NumberFormats;|))))))
                (LETT #2# T . #3#))
            (COND
             ((NOT #2#) (HREM |$ConstructorCache| '|NumberFormats|))))))))))) 

(DEFUN |NumberFormats;| ()
  (PROG (|dv$| $ |pv$|)
    (RETURN
     (PROGN
      (LETT |dv$| '(|NumberFormats|) . #1=(|NumberFormats|))
      (LETT $ (GETREFV 61) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|NumberFormats| NIL (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 22
                (SPADCALL (SPADCALL "Float" (QREFELT $ 19)) (QREFELT $ 21)))
      (QSETREFV $ 36
                (SPADCALL
                 (LIST #2="" #3="I" "II" "III" "IV" #4="V" "VI" "VII" "VIII"
                       "IX")
                 (QREFELT $ 35)))
      (QSETREFV $ 37
                (SPADCALL
                 (LIST #2# #5="X" "XX" "XXX" "XL" #6="L" "LX" "LXX" "LXXX"
                       "XC")
                 (QREFELT $ 35)))
      (QSETREFV $ 38
                (SPADCALL
                 (LIST #2# #7="C" "CC" "CCC" "CD" #8="D" "DC" "DCC" "DCCC"
                       "CM")
                 (QREFELT $ 35)))
      (QSETREFV $ 39 0)
      (QSETREFV $ 40 0)
      (QSETREFV $ 41 0)
      (QSETREFV $ 42 (MAKEARR1 256 -1))
      (QSETAREF1 (QREFELT $ 42)
                 (SPADCALL (SPADCALL " " (QREFELT $ 8)) (QREFELT $ 43)) 0)
      (QSETAREF1 (QREFELT $ 42)
                 (SPADCALL (SPADCALL #3# (QREFELT $ 8)) (QREFELT $ 43)) 1)
      (QSETAREF1 (QREFELT $ 42)
                 (SPADCALL (SPADCALL #4# (QREFELT $ 8)) (QREFELT $ 43)) 5)
      (QSETAREF1 (QREFELT $ 42)
                 (SPADCALL (SPADCALL #5# (QREFELT $ 8)) (QREFELT $ 43)) 10)
      (QSETAREF1 (QREFELT $ 42)
                 (SPADCALL (SPADCALL #6# (QREFELT $ 8)) (QREFELT $ 43)) 50)
      (QSETAREF1 (QREFELT $ 42)
                 (SPADCALL (SPADCALL #7# (QREFELT $ 8)) (QREFELT $ 43)) 100)
      (QSETAREF1 (QREFELT $ 42)
                 (SPADCALL (SPADCALL #8# (QREFELT $ 8)) (QREFELT $ 43)) 500)
      (QSETAREF1 (QREFELT $ 42)
                 (SPADCALL (SPADCALL #9="M" (QREFELT $ 8)) (QREFELT $ 43))
                 1000)
      (QSETREFV $ 44 (SPADCALL #9# (QREFELT $ 8)))
      (QSETREFV $ 45 (SPADCALL "(" (QREFELT $ 8)))
      (QSETREFV $ 46 (SPADCALL ")" (QREFELT $ 8)))
      (QSETREFV $ 47 (SPADCALL #3# (QREFELT $ 8)))
      $)))) 

(MAKEPROP '|NumberFormats| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|String|) (|Character|) (0 . |char|)
              (|Boolean|) (5 . =) (|Mapping| 7 7) (11 . |map|) (|List| $)
              (17 . |split|) (23 . |concat|) (|Mapping| 9 7) (28 . |any?|)
              (|Symbol|) (34 . |coerce|) (|SExpression|) (39 . |convert|)
              '|sexfloat| (44 . |car|) (49 . =) (55 . |cdr|) (60 . |integer?|)
              (|Integer|) (|Float|) (65 . |coerce|)
              |NUMFMT;ScanFloatIgnoreSpaces;SF;5| (|Union| 28 '"failed")
              |NUMFMT;ScanFloatIgnoreSpacesIfCan;SU;6| (|List| 6)
              (|PrimitiveArray| 6) (70 . |construct|) '|units| '|tens| '|hunds|
              '|umin| '|tmin| '|hmin| '|romval| (75 . |ord|) '|thou| '|plen|
              '|pren| '|ichar| (|PositiveInteger|) |NUMFMT;FormatArabic;PiS;7|
              |NUMFMT;ScanArabic;SPi;8| |NUMFMT;FormatRoman;PiS;9|
              (80 . |upperCase|) (85 . |maxIndex|) (90 . |minIndex|)
              (95 . |elt|) (101 . ^) (|OutputForm|) (107 . |coerce|)
              (112 . |coerce|) |NUMFMT;ScanRoman;SPi;10|)
           '#(|ScanRoman| 117 |ScanFloatIgnoreSpacesIfCan| 122
              |ScanFloatIgnoreSpaces| 127 |ScanArabic| 132 |FormatRoman| 137
              |FormatArabic| 142)
           'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 60
                                                 '(1 7 0 6 8 2 7 9 0 0 10 2 6 0
                                                   11 0 12 2 6 13 0 7 14 1 6 0
                                                   13 15 2 6 9 16 0 17 1 18 0 6
                                                   19 1 20 0 18 21 1 20 0 0 23
                                                   2 20 9 0 0 24 1 20 0 0 25 1
                                                   20 9 0 26 1 28 0 27 29 1 34
                                                   0 33 35 1 7 27 0 43 1 6 0 0
                                                   52 1 6 27 0 53 1 6 27 0 54 2
                                                   6 7 0 27 55 2 48 0 0 48 56 1
                                                   7 57 0 58 1 27 57 0 59 1 0
                                                   48 6 60 1 0 31 6 32 1 0 28 6
                                                   30 1 0 48 6 50 1 0 6 48 51 1
                                                   0 6 48 49)))))
           '|lookupComplete|)) 

(MAKEPROP '|NumberFormats| 'NILADIC T) 
