New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Big_int and Num "of_string" functions do not work with hexadecimal literals #4323
Comments
Comment author: @lpw25 Just a note to point out that zoep has attached a patch for this request |
Comment author: @gasche 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? |
Comment author: @gasche 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 ):
|
Comment author: zoep I made a new patch based on gasche's notes and the lexical conventions described in the link.
|
Comment author: @gasche This new patch looks fine, thank you! |
Comment author: @gasche 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.) |
Comment author: zoep Happy to see that! Also I would prefer if you could use my real name, Zoe Paraskevopoulou, instead of zoep. Thanks! |
Original bug ID: 4323
Reporter: zack
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2015-12-11T18:25:35Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.09.2
Fixed in version: 4.02.0+dev
Category: ~DO NOT USE (was: OCaml general)
Tags: junior_job
Has duplicate: #3599
Related to: #6296
Bug description
It 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.
File attachments
The text was updated successfully, but these errors were encountered: