[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#707127: marked as done (ocaml-base: Big_int.extract_big_int does not handle negative numbers properly)



Your message dated Fri, 28 Aug 2015 15:04:41 +0200
with message-id <55E05C69.2000908@debian.org>
and subject line Re: Bug#707127: ocaml-base: Big_int.extract_big_int does not handle negative numbers properly
has caused the Debian Bug report #707127,
regarding ocaml-base: Big_int.extract_big_int does not handle negative numbers properly
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
707127: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=707127
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: ocaml-base
Version: 3.12.1-4
Severity: normal

This function seems to assume that unrepresented prefix regions of
bits in a Big_int.big_int are always zero, but this is not so for
negative numbers.  The documentation explicitly states that a two's
complement representation is used for those, but see the transcript
with comments inline:

% ocaml nums.cma
        Objective Caml version 3.12.1

# open Big_int;;
# let mu = minus_big_int unit_big_int;;
val mu : Big_int.big_int = <abstr>
# let s offset count = string_of_big_int (extract_big_int mu offset count);;
val s : int -> int -> string = <fun>
# s 0 16;;
- : string = "65535"
# s 16 16;;
- : string = "65535"
# s 32 16;;
- : string = "65535"
# s 48 16;;
- : string = "65535"
  (* Okay so far... *)
# s 64 16;;
- : string = "0"
  (* Oops! *)
# s 56 16;;
- : string = "255"
  (* Function seems to think this is a 2^64-1. *)
# eq_big_int (big_int_of_int 255) (extract_big_int mu 56 16);;
- : bool = true
  (* It's not just a problem with the stringifier. *)
# eq_big_int (big_int_of_int (-1)) mu;;
- : bool = true
  (* Nor is it a problem with the earlier negation. *)

   ---> Drake Wilson

-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages ocaml-base depends on:
ii  libc6                                   2.13-38
ii  libx11-6                                2:1.5.0-1
ii  ocaml-base-nox [ocaml-base-nox-3.12.1]  3.12.1-4
ii  tcl8.5                                  8.5.11-2
ii  tk8.5                                   8.5.11-2

ocaml-base recommends no packages.

ocaml-base suggests no packages.

-- no debconf information

--- End Message ---
--- Begin Message ---
Version: 4.01.0-1

Le 07/05/2013 19:09, Drake Wilson a écrit :
> This function seems to assume that unrepresented prefix regions of
> bits in a Big_int.big_int are always zero, but this is not so for
> negative numbers.  The documentation explicitly states that a two's
> complement representation is used for those, but see the transcript
> with comments inline:

This bug has been fixed in trunk on 2013-05-08, so I'm assuming the fix
landed in OCaml 4.01.0. Closing this bug.

-- 
Stéphane

--- End Message ---

Reply to: