mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-14 02:34:17 +02:00
don't be lazy and actually make the first change I suggested.
This commit is contained in:
@@ -48,17 +48,8 @@ div(5, 2) #=> 2
|
|||||||
2 << 1 #=> 4 # logical/arithmetic shift left
|
2 << 1 #=> 4 # logical/arithmetic shift left
|
||||||
|
|
||||||
# You can use the bits function to see the binary representation of a number.
|
# You can use the bits function to see the binary representation of a number.
|
||||||
bits(2) #=> "0000000000000000000000000000000000000000000000000000000000000010"
|
bits(12345) #=> "0000000000000000000000000000000000000000000000000011000000111001"
|
||||||
bits(2.0) #=> "0100000000000000000000000000000000000000000000000000000000000000"
|
bits(12345.0) #=> "0100000011001000000111001000000000000000000000000000000000000000"
|
||||||
|
|
||||||
# this might be a better example:
|
|
||||||
julia> bits(123)
|
|
||||||
"0000000000000000000000000000000000000000000000000000000001111011"
|
|
||||||
|
|
||||||
julia> bits(123.0)
|
|
||||||
"0100000001011110110000000000000000000000000000000000000000000000"
|
|
||||||
# the other one stands the risk of someone thinking that floating-point
|
|
||||||
# numbers are just integers with reversed bit-patterns or something.
|
|
||||||
|
|
||||||
# Boolean values are primitives
|
# Boolean values are primitives
|
||||||
true
|
true
|
||||||
|
Reference in New Issue
Block a user