forked from Mirror/wren
Reorganize core library docs.
This commit is contained in:
92
doc/site/core/num.markdown
Normal file
92
doc/site/core/num.markdown
Normal file
@ -0,0 +1,92 @@
|
||||
^title Num Class
|
||||
^category core
|
||||
|
||||
**TODO**
|
||||
|
||||
### **abs**
|
||||
|
||||
The absolute value of the number.
|
||||
|
||||
:::dart
|
||||
-123.abs // 123
|
||||
|
||||
### **ceil**
|
||||
|
||||
**TODO**
|
||||
|
||||
### **cos**
|
||||
|
||||
The cosine of the number.
|
||||
|
||||
### **floor**
|
||||
|
||||
**TODO**
|
||||
|
||||
### **isNan**
|
||||
|
||||
Whether the number is [not a number](http://en.wikipedia.org/wiki/NaN). This is
|
||||
`false` for normal number values and infinities, and `true` for the result of
|
||||
`0/0`, the square root of a negative number, etc.
|
||||
|
||||
### **sin**
|
||||
|
||||
The sine of the number.
|
||||
|
||||
### **sqrt**
|
||||
|
||||
The square root of the number. Returns `nan` if the number is negative.
|
||||
|
||||
### **-** operator
|
||||
|
||||
Negates the number.
|
||||
|
||||
:::dart
|
||||
var a = 123
|
||||
-a // -123
|
||||
|
||||
### **-**(other), **+**(other), **/**(other), **\***(other) operators
|
||||
|
||||
The usual arithmetic operators you know and love. All of them do 64-bit
|
||||
floating point arithmetic. It is a runtime error if the right-hand operand is
|
||||
not a number. Wren doesn't roll with implicit conversions.
|
||||
|
||||
### **%**(denominator) operator
|
||||
|
||||
The floating-point remainder of this number divided by `denominator`.
|
||||
|
||||
It is a runtime error if `denominator` is not a number.
|
||||
|
||||
### **<**(other), **>**(other), **<=**(other), **>=**(other) operators
|
||||
|
||||
Compares this and `other`, returning `true` or `false` based on how the numbers
|
||||
are ordered. It is a runtime error if `other` is not a number.
|
||||
|
||||
### **~** operator
|
||||
|
||||
Performs *bitwise* negation on the number. The number is first converted to a
|
||||
32-bit unsigned value, which will truncate any floating point value. The bits
|
||||
of the result of that are then negated, yielding the result.
|
||||
|
||||
### **&**(other) operator
|
||||
|
||||
Performs bitwise and on the number. Both numbers are first converted to 32-bit
|
||||
unsigned values. The result is then a 32-bit unsigned number where each bit is
|
||||
`true` only where the corresponding bits of both inputs were `true`.
|
||||
|
||||
It is a runtime error if `other` is not a number.
|
||||
|
||||
### **|**(other) operator
|
||||
|
||||
Performs bitwise or on the number. Both numbers are first converted to 32-bit
|
||||
unsigned values. The result is then a 32-bit unsigned number where each bit is
|
||||
`true` only where the corresponding bits of both inputs were `true`.
|
||||
|
||||
It is a runtime error if `other` is not a number.
|
||||
|
||||
### **..**(other) operator
|
||||
|
||||
**TODO**
|
||||
|
||||
### **...**(other) operator
|
||||
|
||||
**TODO**
|
||||
Reference in New Issue
Block a user