Skip to content
  1. Sep 29, 2013
    • Raymond Toy's avatar
      Print integers with lowercase when *print-case* is :downcase. · a7ace141
      Raymond Toy authored
      Could optimize SUB-OUTPUT-INTEGER and DIGIT-TO-CHAR if needed, but I'm
      assuming printing of fixnums and bignums is not limited by the
      conversion of each digit to a character.
      
       * src/code/print.lisp:
         * Print integers in lowercase if *print-case* is :downcase
         * Update a docstring.
      
       * src/i18n/locale/cmucl.pot:
         * Update
      
       * src/general-info/release-20f.txt:
         * New file with updated info.
      a7ace141
  2. Apr 07, 2013
    • Raymond Toy's avatar
      Fix ticket:80 · b82f05d5
      Raymond Toy authored
       * Increase the size of *powers-of-ten* a bit.
       * In expt-ten, handle the case where the exponent exceeds the size of
         the *powers-of-ten* array.
      b82f05d5
  3. Feb 24, 2013
    • Raymond Toy's avatar
      Fix ticket:73 · 00844093
      Raymond Toy authored
      error.lisp::
      * Create two new conditions, one for modifying the readtable and one
        for the pprint dispatch table.
      
      exports.lisp::
      * Export the two new conditions.
      
      pprint.lisp::
      * Add check to SET-PPRINT-DISPATCH to disallow modifying the standard
        pprint dispatch table.
      * Allow PPRINT-INIT to modify the standard pprint dispatch table.
      
      print.lisp::
      * In WITH-STANDARD-IO-SYNTAX, don't copy a new dispatch table; bind
        *print-pprint-dispatch* to the standard table.
      
      reader.lisp::
      * Add check to disallow modifying the standard readtable.
      * Allow INIT-STD-LISP-READTABLE to modify the standard readtable.
      00844093
  4. Nov 04, 2011
  5. Sep 25, 2011
  6. Jun 10, 2011
    • rtoy's avatar
      Add function to load all unicode data into memory. · 55d7f671
      rtoy authored
      This makes it easy to make an executable image that doesn't need
      unidata.bin around.  (Should we do this for normal cores?  It seems to
      add about 1 MB to the core size.)
      
      code/unidata.lisp:
      o Add LOAD-ALL-UNICODE-DATA to load all unicode data.
      o Add UNICODE-DATA-LOADED-P to check that unicode data has been
        loaded.
      
      code/print.lisp:
      o If unicode data is loaded, don't check for existence of
        *unidata-path*, because we don't need it.
      
      code/exports.lisp:
      o Export LOAD-ALL-UNICODE-DATA.
      
      general-info/release-20c.txt:
      o Update info
      55d7f671
  7. May 31, 2011
    • rtoy's avatar
      Add -unidata option to specify unidata.bin file. · d9b73849
      rtoy authored
      This change requires a cross-compile.  Use boot-2011-04-01-cross.lisp
      as the cross-compile script.
      
      bootfiles/20b/boot-2011-04-01-cross.lisp:
      o New cross-compile bootstrap file
      
      lisp/lisp.c:
      o Recognize -unidata option and setup *UNIDATA-PATH* appropriately.
      
      code/commandline.lisp:
      o Add defswitch for unidata so we don't get complaints about unknown
        switch.
      
      code/unidata.lisp:
      o Rename +UNIDATA-PATH+ to *UNIDATA-PATH*, since it's not a constant
        anymore.
      o Update code to use new name.
      
      code/print.lisp:
      o Update code to use *UNIDATA-PATH*
      
      compiler/sparc/parms.lisp:
      o Add *UNIDATA-PATH* to list of static symbols.
      o Add back in spare-9 and spare-8 static symbols since we need to do a
        cross-compile for this change anyway.
      
      compiler/x86/parms.lisp:
      o Add *UNIDATA-PATH* to list of static symbols.
      o Reorder the static symbols in a more logical arrangment so that the
        spare symbols are at the end.
      
      i18n/local/cmucl.pot:
      o Update
      d9b73849
  8. Apr 20, 2010
  9. Apr 19, 2010
  10. Apr 16, 2010
    • rtoy's avatar
      PRINC-TO-STRING should bind *PRINT-READABLY* to NIL. · 6213498a
      rtoy authored
      code/print.lisp:
      o Add optional *PRINT-READABLY* argument to STRINGIFY-OBJECT.
      o Update PRINC-TO-STRING with new docstring and call STRINGIFY-OBJECT
        with *PRINT-READABLY* bound to NIL.
      
      general-info/release-20b.txt:
      o Update
      6213498a
    • rtoy's avatar
      code/print.lisp: · 6cca28af
      rtoy authored
      o WITH-STANDARD-IO-SYNTAX needs to use the standard pprint dispatch
        table.
      
      general-info/release-20b.txt:
      o Update
      6cca28af
  11. Mar 19, 2010
  12. Oct 02, 2009
  13. Jul 06, 2009
  14. Jun 11, 2009
  15. Dec 21, 2008
  16. Mar 13, 2008
    • rtoy's avatar
      (format nil "~5f" 1d-10) was printing out way too many zeroes, · a660c8de
      rtoy authored
      exceeding the specified width.  I think the correct answer is
      ".0000".
      
      So, add a parameter, allow-overflow-p, to FLONUM-TO-STRING to allow
      the width constraint to be exceeded.  This defaults to T.
      FLONUM-TO-STRING looks at this and decides whether or not to print out
      all the leading zeroes or not.  In FIXED-FORMAT-AUX, set
      allow-overflow-p to NIL so we don't exceed the width.
      
      I wish there were another way to do this, but I can't think of one
      right now.
      
      All print tests pass, and add the following test:
      
      (format nil "~5F" 1d-10) -> ".0000"
      
      print.lisp:
      o Change FLONUM-TO-STRING to use keyword parameters instead of
        optional parameters.
      o Add :ALLOW-OVERFLOW-P, defaulting to T.
      o Use :ALLOW-OVERFLOW-P to determine if all the leading zeroes should
        be printed or not.
      
      format.lisp:
      o Update calls to FLONUM-TO-STRING to use keywords parameters.
      o In FIXED-FORMAT-AUX, set :ALLOW-OVERFLOW-P to NIL
      a660c8de
  17. Feb 27, 2008
    • rtoy's avatar
      Trac ticket #13. · 74f5a075
      rtoy authored
      Basically caused by a change of exponent due rounding of the number
      for printing.  0.999999 might get printed as 1.000.  The original
      number had an exponent of -1, but the printed number has an exponent
      of 0, and we need to account for this.
      
      code/print.lisp:
      o Modify FLONUM-TO-STRING to take into account of the actual and
        printed exponent of the number.  Return an extra value to indicate
        if rounding has the exponent to change.
      
      code/format.lisp:
      o Use the new return value from FLONUM-TO-STRING to tell us if we need
        to adjust the printed exponent to account for the rounding change.
      
      All print tests still pass, and we add the following tests:
      
      (assert (string= (format nil "~11,3,2,0,'*,,'EE" .99) "  0.990E+00"))
      (assert (string= (format nil "~11,3,2,0,'*,,'EE" .999) "  0.999E+00"))
      (assert (string= (format nil "~11,3,2,0,'*,,'EE" .9999) "  0.100E+01"))
      (assert (string= (format nil "~11,3,2,0,'*,,'EE" .0000999) "  0.999E-04"))
      (assert (string= (format nil "~11,3,2,0,'*,,'EE" .00009999) "  0.100E-03"))
      (assert (string= (format nil "~11,3,2,,'*,,'EE" .00009999) "  9.999E-05"))
      (assert (string= (format nil "~11,3,2,,'*,,'EE" .000099999) "  1.000E-04"))
      74f5a075
  18. Feb 01, 2008
  19. Jan 26, 2008
    • rtoy's avatar
      Was failing to print enough digits for things like (format nil · 75de5422
      rtoy authored
      "~9,,,-2E" 1.2345689d-3).   This change also allows us to get rid of
      one other call to flonum-to-string, so printing should be faster now.
      
      Some additional tests:
      
      (assert (string= (format nil "~9,,,-2E" 1.2345689d3) ".00123d+6"))
      (assert (string= (format nil "~9,,,-2E" -1.2345689d3) "-.0012d+6"))
      (assert (string= (format nil "~9,,,-2E" 1.2345689d-3) ".00123d+0"))
      (assert (string= (format nil "~9,,,-2E" -1.2345689d-3) "-.0012d+0"))
      75de5422
  20. Jan 25, 2008
    • rtoy's avatar
      o Incorrect number of digits were printed for ~wF. · 9e71e519
      rtoy authored
      o If FMIN is given, print out the digits, even if we're out of room.
        (This is so ~E will print at least 1 digit due to a bad choice in
        scale factor.)
      
      The following tests all pass.
      
      (assert (string= (format nil "~9,3,2,0,'%G" 0.0314159) "0.314e-01"))
      (assert (string= (format nil "~9,3,2,-2,'%@e" 3.14159) "+.003e+03"))
      (assert (string= (format nil "~6,2,1,'*F" 3.14159) " 31.42"))
      (assert (string= (format nil "~9,0,6f" 3.14159) " 3141590."))
      
      (assert (string= (format nil "~9,4,,-7E" pi) ".00000003d+8"))
      (assert (string= (format nil "~9,4,,-5E" pi) ".000003d+6"))
      (assert (string= (format nil "~5,4,,7E" pi) "3141600.d-6"))
      (assert (string= (format nil "~11,4,,3E" pi) "  314.16d-2"))
      (assert (string= (format nil "~11,4,,5E" pi) "  31416.d-4"))
      (assert (string= (format nil "~11,4,,0E" pi) "  0.3142d+1"))
      (assert (string= (format nil "~9,,,-1E" pi) ".03142d+2"))
      (assert (string= (format nil "~,,,-2E" pi) "0.003141592653589793d+3"))
      (assert (string= (format nil "~,,,2E" pi) "31.41592653589793d-1"))
      (assert (string= (format nil "~E" pi) "3.141592653589793d+0"))
      (assert (string= (format nil "~9,5,,-1E" pi) ".03142d+2"))
      (assert (string= (format nil "~11,5,,-1E" pi) " 0.03142d+2"))
      (assert (string= (format nil "~G" pi) "3.141592653589793    "))
      (assert (string= (format nil "~9,5G" pi) "3.1416    "))
      (assert (string= (format nil "|~13,6,2,7E|" pi) "| 3141593.d-06|"))
      (assert (string= (format nil "~9,3,2,0,'%E" pi) "0.314d+01"))
      (assert (string= (format nil "~9,0,6f" pi) " 3141593."))
      (assert (string= (format nil "~6,2,1,'*F" pi) " 31.42"))
      (assert (string= (format nil "~6,2,1,'*F" (* 100 pi)) "******"))
      (assert (string= (format nil "~9,3,2,-2,'%@E" pi) "+.003d+03"))
      (assert (string= (format nil "~10,3,2,-2,'%@E" pi) "+0.003d+03"))
      (assert (string= (format nil "~15,3,2,-2,'%,'=@E" pi) "=====+0.003d+03"))
      (assert (string= (format nil "~9,3,2,-2,'%E" pi) "0.003d+03"))
      (assert (string= (format nil "~8,3,2,-2,'%@E" pi) "%%%%%%%%"))
      
      (assert (string= (format nil "~g" 1e0) "1.    "))
      ;(assert (string= (format nil "~g" 1.2d40) "12000000000000000000000000000000000000000.    "))
      
      (assert (string= (format nil "~e" 0) "0.0e+0"))
      (assert (string= (format nil "~e" 0d0) "0.0d+0"))
      (assert (string= (format nil "~9,,4e" 0d0) "0.0d+0000"))
      (assert (string= (format nil "~E" 1.234567890123456789d4) "1.2345678901234567d+4"))
      
      (assert (string= (format nil "~20E" (expt 2d0 120)) "1.32922799578492d+36"))
      (assert (string= (format nil "~21,8E" (expt 2d0 120)) "       1.32922800d+36"))
      
      (assert (string= (format nil "~11f" 1.23456789123456789d-3) ".0012345679"))
      
      ;; From CLH 22.3.11
      (defun test-f (x)
         (format nil "~6,2F|~6,2,1,'*F|~6,2,,'?F|~6F|~,2F|~F"
                 x x x x x x))
      
      (assert (string= (test-f 3.14159) "  3.14| 31.42|  3.14|3.1416|3.14|3.14159"))
      (assert (string= (test-f -3.14159) " -3.14|-31.42| -3.14|-3.142|-3.14|-3.14159" ))
      (assert (string= (test-f 100.0)  "100.00|******|100.00| 100.0|100.00|100.0"))
      (assert (string= (test-f 1234.0) "1234.00|******|??????|1234.0|1234.00|1234.0"))
      (assert (string= (test-f 0.006) "  0.01|  0.06|  0.01| 0.006|0.01|0.006"))
      
      
      
      (defun test-e (x)
          (format nil
                 "~9,2,1,,'*E|~10,3,2,2,'?,,'$E|~
                  ~9,3,2,-2,'%@E|~9,2E"
                 x x x x))
      
      
      (assert (string= (test-e 3.14159)  "  3.14e+0| 31.42$-01|+.003e+03|  3.14e+0"))
      (assert (string= (test-e -3.14159)  " -3.14e+0|-31.42$-01|-.003e+03| -3.14e+0"))
      (assert (string= (test-e 1100.0)  "  1.10e+3| 11.00$+02|+.001e+06|  1.10e+3"))
      (assert (string= (test-e 1100.0d0)  "  1.10d+3| 11.00$+02|+.001d+06|  1.10d+3"))
      (assert (string= (test-e 1.1e13)  "*********| 11.00$+12|+.001e+16| 1.10e+13"))
      (assert (string= (test-e 1.1d120)  "*********|??????????|%%%%%%%%%|1.10d+120"))
      
      (defun test-scale (k)
        (format nil "~&Scale factor ~2D: |~13,6,2,VE|"
      	  (- k 5) (- k 5) 3.14159))
      
      (assert (string= (test-scale 0) "Scale factor -5: | 0.000003e+06|"))
      (assert (string= (test-scale 1) "Scale factor -4: | 0.000031e+05|"))
      (assert (string= (test-scale 2) "Scale factor -3: | 0.000314e+04|"))
      (assert (string= (test-scale 3) "Scale factor -2: | 0.003142e+03|"))
      (assert (string= (test-scale 4) "Scale factor -1: | 0.031416e+02|"))
      (assert (string= (test-scale 5) "Scale factor  0: | 0.314159e+01|"))
      (assert (string= (test-scale 6) "Scale factor  1: | 3.141590e+00|"))
      (assert (string= (test-scale 7) "Scale factor  2: | 31.41590e-01|"))
      (assert (string= (test-scale 8) "Scale factor  3: | 314.1590e-02|"))
      (assert (string= (test-scale 9) "Scale factor  4: | 3141.590e-03|"))
      (assert (string= (test-scale 10) "Scale factor  5: | 31415.90e-04|"))
      (assert (string= (test-scale 11) "Scale factor  6: | 314159.0e-05|"))
      (assert (string= (test-scale 12) "Scale factor  7: | 3141590.e-06|"))
      9e71e519
  21. Jan 24, 2008
    • rtoy's avatar
      Fix a format regression. (format nil "~21E" (expt 2d0 120)) was · 9877b8f6
      rtoy authored
      printing 1.0d+36.  It should have printed far more digits.
      
      The previous fixes weren't quite right.  We can't just adjust the
      scale factor with the size of the number.  The wrong number of digits
      gets printed.  So FLONUM-TO-STRING takes an extra parameter to
      indicate the exponent (base 10) of the number.  This is used to
      compensate for the output of FLONUM-TO-DIGITS so that we have the
      right number of digits.  (FLONUM-TO-STRING was assuming
      FLONUM-TO-DIGITS was called with a scaled number, but we weren't.)
      
      print.lisp:
      o FLONUM-TO-STRING takes extra parameter for the exponent (base 10) of
        the number---basically what ACCURATE-SCALE-EXPONENT would return.
      o Add FIXUP-FLONUM-TO-DIGITS to compensate the exponent returned by
        FLONUM-TO-DIGITS by the exponent of the number.
      o Some rearrange of the code to get the right number of digits printed
        under this new scheme.
      
      format.lisp:
      o Keep the exponent of the number and the scaled exponent separate so
        FLONUM-TO-STRING knows the real exponent.
      o FORMAT-GENERAL-AUX uses ACCURATE-SCALE-EXPONENT now instead of
        LISP:SCALE-EXPONENT.
      
      With these changes, the following tests all pass:
      
      (assert (string= (format nil "~9,3,2,0,'%G" 0.0314159) "0.314e-01"))
      (assert (string= (format nil "~9,3,2,-2,'%@e" 3.14159) "+.003e+03"))
      (assert (string= (format nil "~6,2,1,'*F" 3.14159) " 31.42"))
      (assert (string= (format nil "~9,0,6f" 3.14159) " 3141590."))
      
      (assert (string= (format nil "~9,4,,-7E" pi) ".00000003d+8"))
      (assert (string= (format nil "~9,4,,-5E" pi) ".000003d+6"))
      (assert (string= (format nil "~5,4,,7E" pi) "3141600.d-6"))
      (assert (string= (format nil "~11,4,,3E" pi) "  314.16d-2"))
      (assert (string= (format nil "~11,4,,5E" pi) "  31416.d-4"))
      (assert (string= (format nil "~11,4,,0E" pi) "  0.3142d+1"))
      (assert (string= (format nil "~9,,,-1E" pi) ".03142d+2"))
      (assert (string= (format nil "~,,,-2E" pi) "0.003141592653589793d+3"))
      (assert (string= (format nil "~,,,2E" pi) "31.41592653589793d-1"))
      (assert (string= (format nil "~E" pi) "3.141592653589793d+0"))
      (assert (string= (format nil "~9,5,,-1E" pi) ".03142d+2"))
      (assert (string= (format nil "~11,5,,-1E" pi) " 0.03142d+2"))
      (assert (string= (format nil "~G" pi) "3.141592653589793    "))
      (assert (string= (format nil "~9,5G" pi) "3.1416    "))
      (assert (string= (format nil "|~13,6,2,7E|" pi) "| 3141593.d-06|"))
      (assert (string= (format nil "~9,3,2,0,'%E" pi) "0.314d+01"))
      (assert (string= (format nil "~9,0,6f" pi) " 3141593."))
      (assert (string= (format nil "~6,2,1,'*F" pi) " 31.42"))
      (assert (string= (format nil "~6,2,1,'*F" (* 100 pi)) "******"))
      (assert (string= (format nil "~9,3,2,-2,'%@E" pi) "+.003d+03"))
      (assert (string= (format nil "~10,3,2,-2,'%@E" pi) "+0.003d+03"))
      (assert (string= (format nil "~15,3,2,-2,'%,'=@E" pi) "=====+0.003d+03"))
      (assert (string= (format nil "~9,3,2,-2,'%E" pi) "0.003d+03"))
      (assert (string= (format nil "~8,3,2,-2,'%@E" pi) "%%%%%%%%"))
      
      (assert (string= (format nil "~g" 1e0) "1.    "))
      (assert (string= (format nil "~g" 1.2d40) "12000000000000000000000000000000000000000.    "))
      
      (assert (string= (format nil "~e" 0) "0.0e+0"))
      (assert (string= (format nil "~e" 0d0) "0.0d+0"))
      (assert (string= (format nil "~9,,4e" 0d0) "0.0d+0000"))
      (assert (string= (format nil "~E" 1.234567890123456789d4) "1.2345678901234567d+4"))
      
      (assert (string= (format nil "~20E" (expt 2d0 120)) "1.32922799578492d+36"))
      (assert (string= (format nil "~21,8E" (expt 2d0 120)) "       1.32922800d+36"))
      
      
      (let (x)
       (dotimes (k 13 x)
        (setq x (cons (format nil "~%Scale factor ~2D: |~13,6,2,VE|"
                (- k 5) (- k 5) 3.14159) x))))
      9877b8f6
  22. Oct 09, 2007
    • rtoy's avatar
      Fix typo. · 04c99012
      rtoy authored
      04c99012
    • rtoy's avatar
      Remove incorrect comment. · 5ebe47b3
      rtoy authored
      5ebe47b3
    • rtoy's avatar
      o Make the implementation of the log approximation the same in · 3c06338d
      rtoy authored
        accurate-scale-exponent and flonum-to-digits.
      o Minor clean up of scale in both places.
      3c06338d
    • rtoy's avatar
      print.lisp: · 6ee52767
      rtoy authored
      o Add *POWERS-OF-TEN* for use in scaling.
      o Implement the fast log scaling from Burger and Dybvig's paper.
        Scaling is very noticeably faster for large and small numbers; it is
        somewhat slower for intermediate numbers near 1.  (Should we test
        for this case?)
      
      format.lisp:
      o Implement an accurate scaling routine, based on the scale routine in
        FLONUM-TO-DIGITS.
      o Use the new scaling routine in FORMAT-EXP-AUX.  This should fix Trac
        Ticket #12.
      6ee52767
  23. Jul 13, 2006
  24. Jun 30, 2006
  25. May 01, 2006
    • rtoy's avatar
      code/format.lisp: · ef77f543
      rtoy authored
      o Add an additional case where we want to print out a trailing zero:
        There's no width constraint and the previous character was a decimal
        point, so the fraction to be printed is zero.
      
      code/print.lisp:
      o Honor the d option if we run out of room so (format nil "~,2f"
        0.001) produces "0.00", not "0.001".
      ef77f543
  26. Apr 28, 2006
  27. Feb 17, 2006
  28. Aug 02, 2005
  29. Aug 01, 2005
    • rtoy's avatar
      o CLHS 22.3.3.2 (~E) says prin1 omits the plus sign of the exponent if · b70016bc
      rtoy authored
        it is non-negative.  Adjust PRINT-FLOAT-EXPONENT accordingly.
      o OUTPUT-FLOAT-AUX prints out 1d23 as "1.0d23".  This differs from how
        FORMAT ~E prints out that number.  Adjust OUTPUT-FLOAT-AUX to match
        what ~E does.  (Are there other cases that we're missing?)
      b70016bc
  30. Jun 15, 2005
  31. Jun 14, 2005
    • rtoy's avatar
      Some fixes for floating-point printing bugs reported by Bruno Haible, · 1031c478
      rtoy authored
      cmucl-imp, on or around 2005/06/13.
      
      Some useful tests:
      
      (format nil "~9,3,2,0,'%G" 0.0314159)
      Expected: "0.314e-01"
      
      
      (format nil "~9,3,2,-2,'%@e" 3.14159)
      Expected: "+.003E+03"
      
      
      (format nil "~6,2,1,'*F" 3.14159)
      Expected: " 31.42"
      
      (format nil "~9,0,6f" 3.14159)
      Expected: " 3141590."
      
      (let (x)
       (dotimes (k 13 x)
        (setq x (cons (format nil "~%Scale factor ~2D: |~13,6,2,VE|"
                (- k 5) (- k 5) 3.14159) x))))
      
      ("
      Scale factor  7: | 3141590.e-06|"
       "
      Scale factor  6: | 314159.0e-05|"
       "
      Scale factor  5: | 31415.90e-04|"
       "
      Scale factor  4: | 3141.590e-03|"
       "
      Scale factor  3: | 314.1590e-02|"
       "
      Scale factor  2: | 31.41590e-01|"
       "
      Scale factor  1: | 3.141590e+00|"
       "
      Scale factor  0: | 0.314159e+01|"
       "
      Scale factor -1: | 0.031416e+02|"
       "
      Scale factor -2: | 0.003142e+03|"
       "
      Scale factor -3: | 0.000314e+04|"
       "
      Scale factor -4: | 0.000031e+05|"
       "
      Scale factor -5: | 0.000003e+06|")
      
      
      code/format.lisp:
      o If the scale factor (k) is negative, the min number of digits to
        print is 1, not (- 1 k) because that prints too many if the field is
        too short.  Setting fmin to fdig is ok if k >= 0.  (See scale factor
        test above.)
      o If flonum-to-string returns with a trailing decimal point, we don't
        need to decrement spaceleft because that deletes a white-space
        character.  (See first scale factor 7 test above.)
      
      code/print.lisp:
      o We need to adjust the number of digits to be printed to include the
        scale factor.  See tests above.
      1031c478
  32. Mar 22, 2005
  33. Feb 08, 2005
  34. Feb 02, 2005
  35. Dec 06, 2004
  36. Oct 14, 2004