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

Unix.gmtime failure on Ubuntu (IA64)



Hi,

This may or may not be expected behaviour, but I wanted to make sure the debian packaging team knew about it.

I recently tried to recompile and re-run my ocaml program on a new machine with a fresh install of Ubuntu (gutsy). The program was originally developed and tested on debian-stable (etch). The old machine was 32-bit and the new one is 64-bit. My Debian install lists the ocaml package as version 3.09.2 and the ubuntu install lists it as 3.09.2ubuntu.

It compiled without problems on the Ubuntu machine but then I got this error message at runtime:
Fatal error: exception Unix.Unix_error(12, "gmtime", "")

An abbreviation of the offending code looks something like this:
 let reallySmallFloat = -1.0 * max_float in (* a very large magnitude negative number*)
 let reallySmallInt64 = Int64.of_float reallySmallFloat in (* truncated to int64 *)
 let smallestTimeFlt = Int64.to_float reallySmallInt64 in (* back to float *)
 let smallestTime = Unix.gmtime smallestTimeFlt

On both the debian and ubuntu machines, smallestTimeFlt = -9.22337203685e+18

If I replace the first line with:
 let reallySmallFloat = -1.0 *. (10.0**10.0) in

then it runs correctly on the Ubuntu machine. 

This is a suitable work around for my program b/c any large-magnitude negative number will do, but it still seems rather "unsafe" from a typing standpoint.

I'll leave it to others to decide if a formal bug report is necessary. I'm not subscribed to this list but will check for any replies over the next few days in the archives. If anyone wants more info feel free to cc me directly and I'll respond more quickly.

Peter
-- 
http://petergroves.com



 



Reply to: