Version française
Home     About     Download     Resources     Contact us    
Browse thread
Logical operators...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Reinhard Budde <reinhard.budde@g...>
Subject: Re: Logical operators...
Hugues CASSE wrote:
> Is there a bug or is there a way to get the correct result...
>         # 0xffff0000 lsr 16;;
>         - : int = 32767
> while
>         # 0x0000ffff;;
>         - : int = 65535
ints are represented with 31 bits. This is sometimes suprising:

        Objective Caml version 2.01
# 0xffff0000;;
- : int = -65536
# 0x7fff0000;;
- : int = -65536

Consequently:
# 0xffff0000 = 0x7fff0000;;
- : bool = true

0xffff0000 ist not represented in ocaml as you expected

Reinhard
--------------
Reinhard Budde  reinhard.budde@gmd.de
GMD          -  German National Research Center for Information
Technology
AiS          -  Autonomous intelligent Systems
D-53754 St.Augustin     tel: +2241-14-2417,fax: +2241-14-2324