diff --git a/src/libraries/stdlib/integer.ml b/src/libraries/stdlib/integer.ml
index e41adaacae90ac7616050a51e8788b920d3081ee..1a7e593f79aede19b4ecddaf53d51964fa7020ce 100644
--- a/src/libraries/stdlib/integer.ml
+++ b/src/libraries/stdlib/integer.ml
@@ -165,7 +165,8 @@ let popcount = Z.popcount
         d.pp fmt r ;
       end
 
-  let pp_bin ?(nbits=0) ?(sep="") fmt v =
+  let pp_bin ?(nbits=1) ?(sep="") fmt v =
+    let nbits = if nbits <= 0 then 1 else nbits in
     if le zero v then
       ( Format.pp_print_string fmt "0b" ;
         pp_digits { nbits ; sep ; bsize=4 ;
@@ -175,7 +176,8 @@ let popcount = Z.popcount
         pp_digits { nbits ; sep ; bsize=4 ;
                     bmask = bmask_bin ; pp = pp_bin_neg } fmt 0 (Z.lognot v) )
 
-  let pp_hex ?(nbits=0) ?(sep="") fmt v =
+  let pp_hex ?(nbits=1) ?(sep="") fmt v =
+    let nbits = if nbits <= 0 then 1 else nbits in
     if le zero v then
       ( Format.pp_print_string fmt "0x" ;
         pp_digits { nbits ; sep ; bsize=16 ;
diff --git a/src/libraries/stdlib/integer.mli b/src/libraries/stdlib/integer.mli
index 7c1c663bea3af17aa4cdb2b0a660402920e9d4ac..3ed0f1297471b8c393056437955eec4085c79363 100644
--- a/src/libraries/stdlib/integer.mli
+++ b/src/libraries/stdlib/integer.mli
@@ -151,15 +151,17 @@ val popcount: t -> int
 val pretty : ?hexa:bool -> t Pretty_utils.formatter
 
 val pp_bin : ?nbits:int -> ?sep:string -> t Pretty_utils.formatter
-(** Print binary format. Digits are output by blocs of 4 bits 
-    separated by [~sep] with at least [~nbits] total bits.
+(** Print binary format. Digits are output by blocs of 4 bits
+    separated by [~sep] with at least [~nbits] total bits. If [nbits] is
+    non positive, it will be ignored.
     
-    Positive values are preffixed with ["0b"] and negative values 
+    Positive values are prefixed with ["0b"] and negative values 
     are printed as their 2-complement ([lnot]) with prefix ["1b"]. *)
 
 val pp_hex : ?nbits:int -> ?sep:string -> t Pretty_utils.formatter
 (** Print hexadecimal format. Digits are output by blocs of 16 bits 
-    (4 hex digits) separated by [~sep] with at least [~nbits] total bits.
+    (4 hex digits) separated by [~sep] with at least [~nbits] total bits. 
+    If [nbits] is non positive, it will be ignored.
     
     Positive values are preffixed with ["0x"] and negative values 
     are printed as their 2-complement ([lnot]) with prefix ["1x"]. *)