note 14207 added to function.gmp-strval.php

From: Date: Sun, 22 Jul 2001 12:17:20 +0000
Subject: note 14207 added to function.gmp-strval.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-15665@lists.php.net to get a copy of this message
Warning: gmp_strval may return a null terminated string (e.g., gmp_strval(gmp_init(8)) has two characters. This is because gmp is built for speed, so uses estimates based on things it can get quickly, like the number of bits in N. So since 8 is a 4 bit number, it will be allocated ceil(log10(2^4))=ceil(4*0.30103....) = 2 characters. The gmp folks feel it is the caller's responsibility (in this case the PHP interface) to check whether or not all the characters were required. PHP might have done this for us (and may in the future), but for now, you need to check (if it matters to you--it sure did in my program!). http://www.php.net/manual/en/function.gmp-strval.php

« previous php.notes (#15665) next »