login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

The maximum of FriCASIssues is not really maximal.

spad
)abbrev package MYSINT FriCASIssues
FriCASIssues : Public == Private
  where
    Public == IntegerNumberSystem with
      max : () -> %
      mymax : () -> %
      mymax2 : () -> %
    Private  == SingleInteger add
      mymax() == max() + 1
      mymax2() == mymax() + 1
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1558850444918824065-25px001.spad
      using old system compiler.
   MYSINT abbreviates package FriCASIssues 
------------------------------------------------------------------------
   initializing NRLIB MYSINT for FriCASIssues 
   compiling into NRLIB MYSINT 
   compiling exported mymax : () -> $
Time: 0.02 SEC.
compiling exported mymax2 : () -> $ Time: 0 SEC.
(time taken in buildFunctor: 10)
;;; *** |FriCASIssues| REDEFINED
;;; *** |FriCASIssues| REDEFINED Time: 0.01 SEC.
Cumulative Statistics for Constructor FriCASIssues Time: 0.03 seconds
(|RealConstant|) extends (|ConvertibleTo| (|DoubleFloat|)) but not (|ConvertibleTo| (|String|)) --------------non extending category---------------------- .. FriCASIssues of cat (|Join| (|IntegerNumberSystem|) (CATEGORY |domain| (SIGNATURE |max| ($)) (SIGNATURE |mymax| ($)) (SIGNATURE |mymax2| ($)))) has no (|ConvertibleTo| (|String|)) finalizing NRLIB MYSINT Processing FriCASIssues for Browser database: --->-->FriCASIssues(constructor): Not documented!!!! --->-->FriCASIssues((max (%))): Not documented!!!! --->-->FriCASIssues((mymax (%))): Not documented!!!! --->-->FriCASIssues((mymax2 (%))): Not documented!!!! --->-->FriCASIssues(): Missing Description ; compiling file "/var/aw/var/LatexWiki/MYSINT.NRLIB/MYSINT.lsp" (written 16 JUN 2015 04:40:12 PM):
; /var/aw/var/LatexWiki/MYSINT.NRLIB/MYSINT.fasl written ; compilation finished in 0:00:00.020 ------------------------------------------------------------------------ FriCASIssues is now explicitly exposed in frame initial FriCASIssues will be automatically loaded when needed from /var/aw/var/LatexWiki/MYSINT.NRLIB/MYSINT

fricas
a: FriCASIssues := max()$FriCASIssues

\label{eq1}4611686018427387903(1)
fricas
m: FriCASIssues := mymax()
>> System error: The value 4611686018427387904 is not of type FIXNUM.

On my 32 bit system I get


(1) -> )co aaa.spad</p>
<h2>(1) -> m: <a href=FriCASIssues := mymax()

(1) - 2147483648 Type: FriCASIssues (2) -> m2: FriCASIssues := mymax2()

(2) - 2147483647 Type: FriCASIssues (3) -> (2^31, 2^32, 2^63, 2^64)

(3) [2147483648,4294967296,9223372036854775808,18446744073709551616]? Type: Tuple PositiveInteger (4) -> b: FriCASIssues := 2^63-1

(4) - 1 Type: FriCASIssues (5) -> c: FriCASIssues := b+1

(5) 0 Type: FriCASIssues " title=" (1) -> )co aaa.spad

(1) -> m: FriCASIssues := mymax()

(1) - 2147483648 Type: FriCASIssues (2) -> m2: FriCASIssues := mymax2()

(2) - 2147483647 Type: FriCASIssues (3) -> (2^31, 2^32, 2^63, 2^64)

(3) [2147483648,4294967296,9223372036854775808,18446744073709551616]? Type: Tuple PositiveInteger (4) -> b: FriCASIssues := 2^63-1

(4) - 1 Type: FriCASIssues (5) -> c: FriCASIssues := b+1

(5) 0 Type: FriCASIssues " class="equation" src="images/5463052088287443490-16.0px.png" align="bottom" Style="vertical-align:text-bottom" width="560" height="420"/>

SingleInteger is a low level type. Attempting to use values above max is a user error. Such an error may be detected or may produce "correct" result or may lead to some weird problem seemingly unrelated to the error. Basically, using SingleInteger is a promise by the user that values will stay within bounds. So do not lie to the compiler.

Concerning the results: I guess they are due to different Lisp implementations. SBCL used here by default is rather strict in error checking. AFAIK Clisp does not care, it produces "correct" results. With other (unsafe) settings in SBCL or with some other Lisp one can get silent corruption possibly leading to crash.




  Subject:   Be Bold !!
  ( 13 subscribers )  
Please rate this page: