Ah ok, Thanks for the information. For non negative integers I suspected that.

Le dim. 16 juin 2024 à 20:05, Waldek Hebisch <[email protected]> a écrit :
>
> On Sun, Jun 16, 2024 at 07:42:54PM +0200, Grégory Vanuxem wrote:
> > Hello,
> >
> > Have you ever tried the function in object?
> > For negative integers it returns strange integers:
> >
> > (1) -> parse_integer("-4")$ScanningUtilities
> >
> >    (1)  - 26
> >                                                                 Type: 
> > Integer
> > (2) -> parse_integer("4")$ScanningUtilities
> >
> >    (2)  4
> >                                                                 Type: 
> > Integer
>
> 'parse_integer' is intended for nonnegative integers.  Adding
> handling for sign would be relatively easy.  OTOH 'parse_integer'
> assumes that it is given valid number (string of digits) and
> will produce nonsense on invalid imput.  To reiterate: idea
> of 'parse_integer' is that lexical analyser verified correctness
> of input and now task is to convert _valid_ input to a number.
> For other uses we would need to add extra checks to
> 'parse_integer'.
>
> > Apparently it is only used with 'ScanArabic' in outform.spad so it
> > does not have a lot of consequences.
>
> Note that 'ScanArabic' can only produce positive integers, so
> valid input to 'ScanArabic' is also valid input to 'parse_integer'
>
> > Grepping src/algebra:
> >
> > src/algebra/outform.spad:        ScanArabic   s ==
> > qcoerce(parse_integer(s)$ScanningUtilities)
> >
> > By the way, there exists the Lisp function parse-integer, although not
> > very satisfactory in the FriCAS sense.
> >
> > It may not be what I have thought also.
>
> 'parse_integer' is intended to be part of new FriCAS compiler and
> interpreter.  For large integers 'parse_integer' may be significantly
> faster than Lisp 'PARSE-INTEGER', in fact slowness of 'PARSE-INTEGER'
> was main motivation to develop 'parse_integer'.
>
> --
>                               Waldek Hebisch
>
> --
> You received this message because you are subscribed to the Google Groups 
> "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/fricas-devel/Zm8pYbppoFIeJH4P%40fricas.org.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/CAHnU2dbFzQ0hvON%3D1ri4RNZWZ2PztFY%2BLJa_aC%2BqOiTxt-12rg%40mail.gmail.com.

Reply via email to