Browse thread
[Caml-list] Bug? Printf, %X and negative numbers
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Brian Hurt <brian.hurt@q...> |
| Subject: | [Caml-list] Bug? Printf, %X and negative numbers |
$ ocaml
Objective Caml version 3.06
# Printf.printf "%08X\n" (1 lsl 30);;
C0000000
- : unit = ()
# Printf.printf "%010X\n" (1 lsl 30);;
00C0000000
- : unit = ()
#
I expected output of 40000000, not C0000000. Note that this isn't a case
of simple sign extension, as the second example demonstrates. Where'd the
extra bit come from?
Brian
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners