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

Bug#573978: libgmp-ocaml: Wrong conversion from int on 64 bits computer



Package: libgmp-ocaml
Version: 20021123-16+b1
Severity: important


The gmp bindings for ocaml proveded by this package 
have a buggy implementation of Z.from_int on 64bits computer.
The wrong behavior can be reproduced as follows:

> ocaml
#directory "+gmp";;
#load "gmp.cma";;
open Gmp;;
#install_printer Z.print;;
Z.from_int Pervasives.max_int;; (* gives -1 instead of 4611686018427387903 *)
Z.from_int Pervasives.min_int;; (* gives 0 instead of -4611686018427387904 *)

My guess is that the C stubs are using Int_val instead of Long_val, but I can't provide a patch since I'm not sure.

Remark: there exists another open-source library providing Ocaml bindings for GMP, named MLGMPIDL and
available at

http://www.inrialpes.fr/pop-art/people/bjeannet/mlxxxidl-forge/mlgmpidl/index.html

Moreover, it additionally provides bindings for MPFR.

I've tested it and it does not have the bug above. Hence, you maintainers should consider replacing
the current MLGMP bindings with this new MLGMPIDL.

Thanks!

- Claude Marche



-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-trunk-amd64 (SMP w/8 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 libgmp-ocaml depends on:
ii  libc6                     2.10.2-2       GNU C Library: Shared libraries
ii  libgmp3c2                 2:4.3.2+dfsg-1 Multiprecision arithmetic library
ii  ocaml-base-nox [ocaml-bas 3.11.2-1       Runtime system for OCaml bytecode 

libgmp-ocaml recommends no packages.

libgmp-ocaml suggests no packages.

-- no debconf information



Reply to: