Set rop to the fractional part of op, having the same sign as 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_frac(
mpfr_t rop,
mpfr_t op,
mpfr_rnd_t rnd
)
Public Shared Function mpfr_frac (
rop As mpfr_t,
op As mpfr_t,
rnd As mpfr_rnd_t
) As Integer
public:
static int mpfr_frac(
mpfr_t^ rop,
mpfr_t^ op,
mpfr_rnd_t rnd
)
static member mpfr_frac :
rop : mpfr_t *
op : mpfr_t *
rnd : mpfr_rnd_t -> int
Parameters
- rop
- Type: Math.Mpfr.Nativempfr_t
The result floating-point number. - op
- Type: Math.Mpfr.Nativempfr_t
The operand floating-point number. - rnd
- Type: Math.Mpfr.Nativempfr_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
Unlike in mpfr_rint, rnd affects only how the exact fractional part is rounded, not how the fractional part is generated.
When op is an integer or an infinity, set rop to zero with the same sign as op.
Examples
mpfr_t op = new mpfr_t();
mpfr_lib.mpfr_init2(op, 64U);
Assert.IsTrue(mpfr_lib.mpfr_set_d(op, 10.0, mpfr_rnd_t.MPFR_RNDN) == 0);
mpfr_t rop = new mpfr_t();
mpfr_lib.mpfr_init2(rop, 64U);
Assert.IsTrue(mpfr_lib.mpfr_frac(rop, op, mpfr_rnd_t.MPFR_RNDN) == 0);
Assert.IsTrue(mpfr_lib.mpfr_get_d(rop, mpfr_rnd_t.MPFR_RNDN) == 0.0);
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, 10.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_frac(rop, op, mpfr_rnd_t.MPFR_RNDN) = 0)
Assert.IsTrue(mpfr_lib.mpfr_get_d(rop, mpfr_rnd_t.MPFR_RNDN) = 0.0)
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