num

num(x)

Numerator of the rational representation of x

Examples

julia> num(3//4)
3

julia> num(-5.5)
-5

The num function returns the numerator of the rational representation of a number x. It can be used with rational numbers or floating-point numbers.

Example 1: Retrieve the numerator of a rational number

julia> num(3//4)
3

In this example, the numerator of the rational number 3//4 is 3.

Example 2: Retrieve the numerator of a floating-point number

julia> num(-5.5)
-5

In this example, the numerator of the floating-point number -5.5 is -5.

Note: The num function does not work with complex numbers.

See Also

abs2, beta, binomial, ceil, cell, cross, ctranspose, ctranspose!, cummin, cumprod, cumprod!, cumsum, cumsum!, cumsum_kbn, div, divrem, eigfact, eigfact!, eigmin, eps, erf, erfc, erfcinv, erfcx, erfi, erfinv, exp, exp10, exp2, expm1, exponent, factor, factorial, factorize, floor, gcd, invmod, log, log10, log1p, log2, logspace, max, min, mod, mod1, modf, next, nextpow, nextprod, num, primes, primesmask, prod, realmin, sqrt, sum!, sumabs, sumabs!, sumabs2, sumabs2!,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: