mpfr_lib.mpfr_root Method |
Set rop to the kth root of op rounded in the direction rnd.
Namespace:
Math.Mpfr.Native
Assembly:
Math.Mpfr.Native (in Math.Mpfr.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntaxpublic static int mpfr_root(
mpfr_t rop,
mpfr_t op,
uint k,
mpfr_rnd_t rnd
)
Public Shared Function mpfr_root (
rop As mpfr_t,
op As mpfr_t,
k As UInteger,
rnd As mpfr_rnd_t
) As Integer
public:
static int mpfr_root(
mpfr_t^ rop,
mpfr_t^ op,
unsigned int k,
mpfr_rnd_t rnd
)
static member mpfr_root :
rop : mpfr_t *
op : mpfr_t *
k : uint32 *
rnd : mpfr_rnd_t -> int
Parameters
- rop
- Type: Math.Mpfr.Native.mpfr_t
The result floating-point number. - op
- Type: Math.Mpfr.Native.mpfr_t
The operand floating-point number. - k
- Type: System.UInt32
The degree of the root. - rnd
- Type: Math.Mpfr.Native.mpfr_rnd_t
The rounding direction.
Return Value
Type:
Int32Return zero, a positive, or a negative value if
rop is respectively equal to, greater than, or lower than the exact result. See
GNU MPFR - Rounding Modes for details.
Remarks
This function is the same as mpfr_rootn_ui(mpfr_t, mpfr_t, UInt32, mpfr_rnd_t) except when op is −0 and
k is even: the result is −0 instead of +0 (the reason was to be consistent
with mpfr_sqrt(mpfr_t, mpfr_t, mpfr_rnd_t)).
Said otherwise, if op is zero, set rop to op.
This function predates the IEEE 754-2008 standard and behaves differently from its rootn function.
It is marked as deprecated and will be removed in a future release.
Examples
mpfr_t op = new mpfr_t();
mpfr_lib.mpfr_init2(op, 64U);
Assert.IsTrue(mpfr_lib.mpfr_set_d(op, 32.0, mpfr_rnd_t.MPFR_RNDN) == 0);
mpfr_t rop = new mpfr_t();
mpfr_lib.mpfr_init2(rop, 64U);
Assert.IsTrue(mpfr_lib.mpfr_root(rop, op, 5, mpfr_rnd_t.MPFR_RNDN) == 0);
Assert.IsTrue(rop.ToString() == "0.200000000000000000000e1");
mpfr_lib.mpfr_clears(rop, op, null);
Dim op As mpfr_t = New mpfr_t()
mpfr_lib.mpfr_init2(op, 64U)
Assert.IsTrue(mpfr_lib.mpfr_set_d(op, 32.0, mpfr_rnd_t.MPFR_RNDN) = 0)
Dim rop As mpfr_t = New mpfr_t()
mpfr_lib.mpfr_init2(rop, 64U)
Assert.IsTrue(mpfr_lib.mpfr_root(rop, op, 5, mpfr_rnd_t.MPFR_RNDN) = 0)
Assert.IsTrue(rop.ToString() = "0.200000000000000000000e1")
mpfr_lib.mpfr_clears(rop, op, Nothing)
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