Go to the first, previous, next, last section, table of contents.

### `ntype`

ntype(num)
:: Classifier of type num. Returns a sub-type number, an integer, for obj.
return
integer
obj
number
• Sub-types for type number are listed below.
0
rational number
1
floating double (double precision floating point number)
2
algebraic number over rational number field
3
arbitrary precision floating point number (bigfloat)
4
complex number
5
element of a finite field
6
element of a large finite prime field
7
element of a finite field of characteristic 2
• When arithmetic operations for numbers are performed, type coercion will be taken if their number sub-types are different so that the object having smaller sub-type number will be transformed to match the other object, except for algebraic numbers.
• A number object created by `newalg(x^2+1)` and the unit of imaginary number `@i` have different number sub-types, and it is treated independently.
• See section Algebraic numbers for algebraic numbers.
``` [10/37,ntype(10/37)];
[10/37,0]
 [10.0/37.0,ntype(10.0/37.0)];
[0.27027,1]
 [newalg(x^2+1)+1,ntype(newalg(x^2+1)+1)];
[(#0+1),2]
 [eval(sin(@pi/6)),ntype(eval(sin(@pi/6)))];
[0.49999999999999999991,3]
 [@i+1,ntype(@i+1)];
[(1+1*@i),4]
```
References
section `type`.

Go to the first, previous, next, last section, table of contents.