May. 7th, 2009

netch80: (Default)
4> <<P:32/big-float>> = <<63,128,0,0>>.
<<63,128,0,0>>
5> P.
1.0
6> <<P:32/big-float>> = <<127,128,0,0>>.
** exception error: no match of right hand side value <<127,128,0,0>>
7> <<P:32/big-float>> = <<127,128,0,1>>.
** exception error: no match of right hand side value <<127,128,0,1>>

в команде 6 я пытался расшифровать +INF, 7 - +NAN(1)

А вот что пишет ползучий питоний:

>>> struct.unpack('>f', '\x7f\x8f\x00\x00')[0]
nan
>>> struct.unpack('>f', '\xff\x8f\x00\xff')[0]
nan

"это не число, и к дьяволу подробности!"
Зато хоть создавать не запрещает:

>>> a = float('nan')
>>> a
nan
>>> -a
nan

и на том спасибо.

Profile

netch80: (Default)
netch80

January 2026

S M T W T F S
    1 23
45678910
11121314151617
18192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 3rd, 2026 08:57 pm
Powered by Dreamwidth Studios