Last active
August 29, 2015 14:21
-
-
Save niiyz/012fe6feb360bacc082f to your computer and use it in GitHub Desktop.
Erlang 数 2015.05.12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## http://erlangworld.web.fc2.com/data_types/number.html | |
## Leaning Erlang 2015.05.12 | |
yoshida-book% erl | |
Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] | |
Eshell V6.4 (abort with ^G) | |
1> 42. | |
42 | |
2> 3.7. | |
3.7 | |
3> 4/7. | |
0.5714285714285714 | |
4> 9/4. | |
2.25 | |
5> 8 div 5. | |
1 | |
6> 7 rem 3. | |
1 | |
7> X = 123456789. | |
123456789 | |
8> X * X * X * X * X. | |
28679718602997181072337614380936720482949 | |
9> 16#A. | |
10 | |
10> 8#13. | |
11 | |
11> is_number(-3.4). | |
true | |
12> is_number({hello,3}). | |
false | |
13> is_integer(8). | |
true | |
14> is_integer(3.3). | |
false | |
15> is_float(8). | |
false | |
16> is_float(1.3). | |
true | |
17> abs(-3.33). | |
3.33 | |
18> abs(-3). | |
3 | |
19> round(5.5). | |
6 | |
20> round(5.4). | |
5 | |
21> trunc(5.5). | |
5 | |
22> float(55). | |
55.0 | |
23> integer_to_list(77). | |
"77" | |
24> list_to_integer("123"). | |
123 | |
25> list_to_integer('123'). | |
** exception error: bad argument | |
in function list_to_integer/1 | |
called as list_to_integer('123') | |
26> erlang:integer_to_list(1023, 16). | |
"3FF" | |
27> float_to_List(7.0). | |
** exception error: undefined shell command float_to_List/1 | |
28> float_to_list(7.0). | |
"7.00000000000000000000e+00" | |
29> list_to_float("2.2017764e+0"). | |
2.2017764 | |
30> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment