Initialize x to 0 and set its precision to be at least prec bits.
Namespace:
Math.Gmp.Native
Assembly:
Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static void mpf_init2(
mpf_t x,
mp_bitcnt_t prec
)
Public Shared Sub mpf_init2 (
x As mpf_t,
prec As mp_bitcnt_t
)
public:
static void mpf_init2(
mpf_t^ x,
mp_bitcnt_t prec
)
static member mpf_init2 :
x : mpf_t *
prec : mp_bitcnt_t -> unit
Parameters
- x
- Type: Math.Gmp.Nativempf_t
The operand float. - prec
- Type: Math.Gmp.Nativemp_bitcnt_t
The minimum precision in bits.
Remarks
Normally, a variable should be initialized once only or at least be cleared, using mpf_clear(mpf_t), between initializations.
Examples
mpf_t x = new mpf_t();
gmp_lib.mpf_init2(x, 64U);
Assert.IsTrue(gmp_lib.mpf_get_d(x) == 0.0);
uint p = gmp_lib.mpf_get_prec(x);
Assert.IsTrue(gmp_lib.mpf_get_prec(x) == 64U);
gmp_lib.mpf_clear(x);
Dim x As New mpf_t()
gmp_lib.mpf_init2(x, 64UI)
Assert.IsTrue(gmp_lib.mpf_get_d(x) = 0.0)
Dim p As UInteger = gmp_lib.mpf_get_prec(x)
Assert.IsTrue(gmp_lib.mpf_get_prec(x) = 64UI)
gmp_lib.mpf_clear(x)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also