Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004323OCamlOCaml generalpublic2007-06-22 11:422014-01-18 08:39
Reporterzack 
Assigned Togasche 
PrioritynormalSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version3.09.2 
Target VersionFixed in Version4.02.0+dev 
Summary0004323: Big_int and Num "of_string" functions do not work with hexadecimal literals
DescriptionIt is possible to build integers from hexadecimal literals (with the convention that they start with "0x") for integers in Pervasives, Int32, and Int64. However it is not possible to do the same for integers in Big_int or Num. Please add this possibility.
Tagsjunior_job
Attached Filespatch file icon num_of_string.patch [^] (1,921 bytes) 2013-07-30 15:22 [Show Content]
patch file icon num_of_string_new.patch [^] (5,149 bytes) 2013-08-01 21:20 [Show Content]

- Relationships
has duplicate 0003599acknowledged Feature wish: big_int_of_string en base n 
related to 0006296acknowledged inconsistent behavior of float_of_string (compare to "ints"_of_string) 

-  Notes
(0010039)
lpw25 (developer)
2013-07-31 14:48
edited on: 2013-07-31 14:53

Just a note to point out that zoep has attached a patch for this request

(0010045)
gasche (developer)
2013-07-31 21:44

The code looks good, but I'm a bit wary of having to review sys_nat_of_string to make sure it didn't somehow make base-10 assumptions. I assume this would be catched rather quickly by testing; would it be possible to add relevant tests in testsuite/tests/lib-num to exercise the new code paths?
(0010050)
gasche (developer)
2013-08-01 06:03

After having a closer look, sys_nat_of_string is in fact fine but should be updated, along with base_digit_of_char (still in nat.ml), to accept the lexical conventions of OCaml integer literals ( http://caml.inria.fr/pub/docs/manual-ocaml/lex.html#integer-literal [^] ):
- both lowercase and uppercase letters should be accepted in hexa (currently only uppercase)
- underscores in the number should be ignored (at any base)
(0010070)
zoep (reporter)
2013-08-01 21:20

I made a new patch based on gasche's notes and the lexical conventions described in the link.
- Underscore characters are ignored anywhere in the number, except before the first digit
- Lowercase letters are accepted in hexa
- Both uppercase and lowercase characters are accepted in base prefixes, instead of just lowercase in the previous patch
- Some simple tests were added
(0010072)
gasche (developer)
2013-08-01 21:56

This new patch looks fine, thank you!
(0010096)
gasche (developer)
2013-08-04 22:01

The patch is now committed in trunk, thanks! If you wish to appear in the changelog under a different name than "zoep", this can still be changed.

(To keep in mind for future patch submitters: at some point we pick a name to give credit to.)
(0010099)
zoep (reporter)
2013-08-04 22:35

Happy to see that! Also I would prefer if you could use my real name, Zoe Paraskevopoulou, instead of zoep. Thanks!

- Issue History
Date Modified Username Field Change
2007-06-22 11:42 zack New Issue
2007-11-10 15:13 xleroy Status new => acknowledged
2009-08-20 10:25 xclerc Relationship added has duplicate 0003599
2013-07-28 21:15 gasche Tag Attached: junior_job
2013-07-30 15:22 zoep File Added: num_of_string.patch
2013-07-31 14:48 lpw25 Note Added: 0010039
2013-07-31 14:53 lpw25 Note Edited: 0010039 View Revisions
2013-07-31 21:44 gasche Note Added: 0010045
2013-08-01 06:03 gasche Note Added: 0010050
2013-08-01 21:20 zoep File Added: num_of_string_new.patch
2013-08-01 21:20 zoep Note Added: 0010070
2013-08-01 21:56 gasche Note Added: 0010072
2013-08-04 22:01 gasche Note Added: 0010096
2013-08-04 22:01 gasche Status acknowledged => resolved
2013-08-04 22:01 gasche Fixed in Version => 4.02.0+dev
2013-08-04 22:01 gasche Resolution open => fixed
2013-08-04 22:01 gasche Assigned To => gasche
2013-08-04 22:35 zoep Note Added: 0010099
2014-01-18 08:39 gasche Relationship added related to 0006296


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker