using BenchmarkTools
@benchmark sum(rand(1000))
BenchmarkTools.Trial: 10000 samples with 10 evaluations.
Range (min … max): 1.182 μs … 145.397 μs ┊ GC (min … max): 0.00% … 96.62%
Time (median): 1.277 μs ┊ GC (median): 0.00%
Time (mean ± σ): 1.789 μs ± 4.410 μs ┊ GC (mean ± σ): 9.23% ± 3.75%
▄██▅▃▃▄▃ ▁▃▄▃▃▄▃▂▂▁ ▂
████████▇▇▆▆▆▁▅▄▅▄▅▄▁▃▄▄▅▁▁▅▄▃▃▁▁▃▃▁▃▁▃▃▁▁▄██████████▇▇▇▆▇▆ █
1.18 μs Histogram: log(frequency) by time 3.51 μs <
Memory estimate: 7.94 KiB, allocs estimate: 1.
function printbitsf64(x::Float64)
= bitstring(x)
s printstyled(s[1], color = :blue, reverse=true)
printstyled(s[2:12], color = :green, reverse=true)
printstyled(s[13:end], color=:red, bold=true, reverse=true)
print("\n")
end
printbitsf64(27.56640625)
0100000000111011100100010000000000000000000000000000000000000000
=0.5
Epswhile 1 != 1 + Eps
/= 2
Epsprintbitsf64(1+Eps)
end
0011111111110100000000000000000000000000000000000000000000000000
0011111111110010000000000000000000000000000000000000000000000000
0011111111110001000000000000000000000000000000000000000000000000
0011111111110000100000000000000000000000000000000000000000000000
0011111111110000010000000000000000000000000000000000000000000000
0011111111110000001000000000000000000000000000000000000000000000
0011111111110000000100000000000000000000000000000000000000000000
0011111111110000000010000000000000000000000000000000000000000000
0011111111110000000001000000000000000000000000000000000000000000
0011111111110000000000100000000000000000000000000000000000000000
0011111111110000000000010000000000000000000000000000000000000000
0011111111110000000000001000000000000000000000000000000000000000
0011111111110000000000000100000000000000000000000000000000000000
0011111111110000000000000010000000000000000000000000000000000000
0011111111110000000000000001000000000000000000000000000000000000
0011111111110000000000000000100000000000000000000000000000000000
0011111111110000000000000000010000000000000000000000000000000000
0011111111110000000000000000001000000000000000000000000000000000
0011111111110000000000000000000100000000000000000000000000000000
0011111111110000000000000000000010000000000000000000000000000000
0011111111110000000000000000000001000000000000000000000000000000
0011111111110000000000000000000000100000000000000000000000000000
0011111111110000000000000000000000010000000000000000000000000000
0011111111110000000000000000000000001000000000000000000000000000
0011111111110000000000000000000000000100000000000000000000000000
0011111111110000000000000000000000000010000000000000000000000000
0011111111110000000000000000000000000001000000000000000000000000
0011111111110000000000000000000000000000100000000000000000000000
0011111111110000000000000000000000000000010000000000000000000000
0011111111110000000000000000000000000000001000000000000000000000
0011111111110000000000000000000000000000000100000000000000000000
0011111111110000000000000000000000000000000010000000000000000000
0011111111110000000000000000000000000000000001000000000000000000
0011111111110000000000000000000000000000000000100000000000000000
0011111111110000000000000000000000000000000000010000000000000000
0011111111110000000000000000000000000000000000001000000000000000
0011111111110000000000000000000000000000000000000100000000000000
0011111111110000000000000000000000000000000000000010000000000000
0011111111110000000000000000000000000000000000000001000000000000
0011111111110000000000000000000000000000000000000000100000000000
0011111111110000000000000000000000000000000000000000010000000000
0011111111110000000000000000000000000000000000000000001000000000
0011111111110000000000000000000000000000000000000000000100000000
0011111111110000000000000000000000000000000000000000000010000000
0011111111110000000000000000000000000000000000000000000001000000
0011111111110000000000000000000000000000000000000000000000100000
0011111111110000000000000000000000000000000000000000000000010000
0011111111110000000000000000000000000000000000000000000000001000
0011111111110000000000000000000000000000000000000000000000000100
0011111111110000000000000000000000000000000000000000000000000010
0011111111110000000000000000000000000000000000000000000000000001
0011111111110000000000000000000000000000000000000000000000000000
function printbits2f64(x::Float64)
= bitstring(x)
s printstyled(s[1], color = 142, reverse=true)
printstyled(s[2:12], color = 190, reverse=false, underline=true)
printstyled(s[13:end], color= 27, bold=true, reverse=true)
print("\n")
end
printbits2f64(27.56640625)
0100000000111011100100010000000000000000000000000000000000000000