update the doc
This commit is contained in:
parent
0c9c1c013e
commit
b3a80dd2eb
3 changed files with 10 additions and 4 deletions
|
|
@ -81,6 +81,8 @@
|
||||||
Imported exceptions can be raised and caught just like Nim exceptions.
|
Imported exceptions can be raised and caught just like Nim exceptions.
|
||||||
More details in language manual.
|
More details in language manual.
|
||||||
|
|
||||||
|
- Range float typed, example `range[0.0 .. Inf]`. More details in language manual.
|
||||||
|
|
||||||
### Tool changes
|
### Tool changes
|
||||||
|
|
||||||
- ``jsondoc2`` has been renamed ``jsondoc``, similar to how ``doc2`` was renamed
|
- ``jsondoc2`` has been renamed ``jsondoc``, similar to how ``doc2`` was renamed
|
||||||
|
|
|
||||||
|
|
@ -704,7 +704,7 @@ proc lastValue*[T:BiggestInt|BiggestFloat](t: PType; fixedUnsigned = false): T =
|
||||||
internalError("invalid kind for first(" & $t.kind & ')')
|
internalError("invalid kind for first(" & $t.kind & ')')
|
||||||
result = NaN
|
result = NaN
|
||||||
|
|
||||||
proc lastOrd*(t: PType; fixedUnsigned = false): BiggestInt {.inline.}=
|
proc lastOrd*(t: PType; fixedUnsigned = false): BiggestInt {.inline.} =
|
||||||
lastValue[BiggestInt](t, fixedUnsigned)
|
lastValue[BiggestInt](t, fixedUnsigned)
|
||||||
|
|
||||||
proc lengthOrd*(t: PType): BiggestInt =
|
proc lengthOrd*(t: PType): BiggestInt =
|
||||||
|
|
|
||||||
|
|
@ -741,22 +741,26 @@ For further details, see `Convertible relation
|
||||||
|
|
||||||
Subrange types
|
Subrange types
|
||||||
--------------
|
--------------
|
||||||
A subrange type is a range of values from an ordinal type (the base
|
A subrange type is a range of values from an ordinal or float point type (the base
|
||||||
type). To define a subrange type, one must specify it's limiting values: the
|
type). To define a subrange type, one must specify it's limiting values: the
|
||||||
lowest and highest value of the type:
|
lowest and highest value of the type:
|
||||||
|
|
||||||
.. code-block:: nim
|
.. code-block:: nim
|
||||||
type
|
type
|
||||||
Subrange = range[0..5]
|
Subrange = range[0..5]
|
||||||
|
PositiveFloat = range[0.0..Inf]
|
||||||
|
|
||||||
|
|
||||||
``Subrange`` is a subrange of an integer which can only hold the values 0
|
``Subrange`` is a subrange of an integer which can only hold the values 0
|
||||||
to 5. Assigning any other value to a variable of type ``Subrange`` is a
|
to 5. ``PositiveFloat`` defines a subrange of all positive floating point values.
|
||||||
|
NaN does not belong to any subrange of floating point types.
|
||||||
|
Assigning any other value to a variable of type ``Subrange`` is a
|
||||||
checked runtime error (or static error if it can be statically
|
checked runtime error (or static error if it can be statically
|
||||||
determined). Assignments from the base type to one of its subrange types
|
determined). Assignments from the base type to one of its subrange types
|
||||||
(and vice versa) are allowed.
|
(and vice versa) are allowed.
|
||||||
|
|
||||||
A subrange type has the same size as its base type (``int`` in the example).
|
A subrange type has the same size as its base type (``int`` in the
|
||||||
|
Subrange example).
|
||||||
|
|
||||||
|
|
||||||
Pre-defined floating point types
|
Pre-defined floating point types
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue