FloatingPoint
Copyright By PowCoder代写 加微信 powcoder
using ColorBitstring
Floating point numbers are typically 64-bit
printbits(-23.3)
1100000000110111010011001100110011001100110011001100110011001101
q = parse(Int, “10000000011”; base=2)
sig = 2^(-1.0*S) * parse(Int, “1” * “0111010011001100110011001100110011001100110011001101”; base=2)
-2^(q-σ) * sig
x = Float16(1/3)
printbits(x)
0011010101010101
Sub-normal number:
x = Float16(2^(-17)/3)
printbits(x)
0000000000101011
two types of zeros:
printlnbits(0.0)
printbits(-0.0)
0.0 == -0.0
0000000000000000000000000000000000000000000000000000000000000000
1000000000000000000000000000000000000000000000000000000000000000
printbits(NaN)
0111111111111000000000000000000000000000000000000000000000000000
NaN == NaN
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com