Mirror of
forum.nim-lang.org
index
8318 :: what is positive number in nim called
[2021-08-11T14:13:21+02:00]
View Orginal
Kalbhairab
(orginal)
[2021-08-11T14:13:21+02:00]
view original
as int and float support -ve and positive value. what pure positive number is called in nim. I have read somewhere but forget.
juancarlospaco
(orginal)
[2021-08-11T14:15:06+02:00]
view original
https://nim-lang.github.io/Nim/system.html#Positive
Kalbhairab
(orginal)
[2021-08-11T15:37:30+02:00]
view original
thanks it is Natural.
Yardanico
(orginal)
[2021-08-11T17:17:25+02:00]
view original
You're a bit wrong - a
positive
number is Positive, Natural also includes 0 which is not a positive number :)
tmsa04
(orginal)
[2021-08-12T00:50:08+02:00]
view original
https://nim-lang.org/docs/system.html#abs%2Cfloat64
An absolute number is the distance of a number from 0. 0 is 0, 1 is 1, -1 is 1. abs is often used to make all numbers positive.
ynfle
(orginal)
[2021-08-12T01:00:28+02:00]
view original
abs
in nim uses
float``s not ``int
and
uint
can accept 0.
Kalbhairab
(orginal)
[2021-08-14T03:38:11+02:00]
view original
for my case 0 is also fine but not negative number