gmp_libmpz_init_set_str Method |
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 int mpz_init_set_str(
mpz_t rop,
char_ptr str,
int base
)
Public Shared Function mpz_init_set_str (
rop As mpz_t,
str As char_ptr,
base As Integer
) As Integer
public:
static int mpz_init_set_str(
mpz_t^ rop,
char_ptr str,
int base
)
static member mpz_init_set_str :
rop : mpz_t *
str : char_ptr *
base : int -> int
Parameters
- rop
- Type: Math.Gmp.Nativempz_t
The destination integer. - str
- Type: Math.Gmp.Nativechar_ptr
The source integer. - base
- Type: SystemInt32
The base.
Return Value
Type:
Int32If the string is a correct base
base number, the function returns 0; if an error occurs it returns −1.
rop is initialized even if an error occurs.
Remarks Examples
mpz_t x = new mpz_t();
char_ptr value = new char_ptr(" 1 234 567 890 876 543 211 234 567 890 987 654 321 ");
gmp_lib.mpz_init_set_str(x, value, 10);
char_ptr s = gmp_lib.mpz_get_str(char_ptr.Zero, 10, x);
Assert.IsTrue(s.ToString() == value.ToString().Replace(" ", ""));
gmp_lib.mpz_clear(x);
gmp_lib.free(value);
gmp_lib.free(s);
Dim x As New mpz_t()
Dim value As New char_ptr(" 1 234 567 890 876 543 211 234 567 890 987 654 321 ")
gmp_lib.mpz_init_set_str(x, value, 10)
Dim s As char_ptr = gmp_lib.mpz_get_str(char_ptr.Zero, 10, x)
Assert.IsTrue(s.ToString() = value.ToString().Replace(" ", ""))
gmp_lib.mpz_clear(x)
gmp_lib.free(value)
gmp_lib.free(s)
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