Integers in Lua 5
嚜澠ntegers in Lua 5.3
妓. 妒快把批c忘抖我技扼抗我抄
PUC-Rio
Numbers in Lua
♂
Since its first version (1993), Lua has had one
single kind of number
♂
First versions used float
♂
Changed to double in version 3.1 (1998)
♂
♂
mainly because programmers needed 32-bit values
a float has only 24 bits of mantissa, a double has 53
bits.
2
Doubles
♂
♂
Well-defined rules (IEEE), including error and
overflow handling (㊣inf, NaN)
Hardware support in conventional platforms
♂
♂
GOOD
even in 1998
53 bits is enough for most counting purposes
♂
1 petabyte
♂
1 million times the world population
♂
300 000 years in seconds
♂
20% of total global wealth in cents of dollars
3
Doubles
♂
Big and slow for restricted hardware
♂
Awkward for bitwise operators
♂
♂
should they operate on 53 bits?
♂
~0 is 0xFFFFFFFF or -1?
Some algorithms need 64 bits
♂
♂
BAD
cryptography, encodings
Some data need 64 bits
♂
handles
4
Doubles
♂
Integers already present in Lua as secondclass values.
♂
♂
♂
♂
BAD
several library functions use integers (e.g., indices
in the string library)
conversions not well specified and/or not efficient
string.sub(s, -3.4, 8.7)
Confusing in the C API
♂
conversions always lose bits in some direction
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- where are programming languages going
- lex yacc epaperpress
- complete guide for rf 433mhz transmitter receiver module
- syhunt catarinka lua library
- an intermediate representation for structured input lua
- seminar con麍gurable systems
- scripting home iho
- jan schwinghammer december 5 2005 n ramsey
- gpu computing with pycuda
- luatex a user s perspective tug
Related searches
- calories in 1 5 cup cooked rice
- what happened in chapter 5 outsider
- best performing stocks in last 5 years
- firing 223 in a 5 56
- can you chamber 223 in a 5 56
- 24 inch barrel ar in 6 5 grendel
- float and integers in python
- ruger rifles in 6 5 creedmoor
- 24 in 6 5 grendel barrel
- how many pixels in 8 5 inches
- best movies in last 5 years
- concatenate integers in python