3

What is the Octave NaN for? Is dot wrong delimiter?

>> bin2dec ('10.1')
ans = NaN
2
  • 1
    So you want to convert from DEC/VAX formatted floating point binary string to a decimal?
    – hanleyp
    Oct 5, 2009 at 23:38
  • 1
    There is no correct delimiter for what you are trying to achieve. Oct 6, 2009 at 21:58

3 Answers 3

3

Nan means Not a Number

You operation produced an undefined result. bin2dec(s) returns the decimal representation of the binary number in s. But you passed a decimal number.

You probably wanted to use dec2bin()

2
  • 1
    I meant by 10.1 a binary number 2^1 + 2^-1 in DEC, not decimal. Oct 5, 2009 at 23:15
  • I understand you question Masi. But you cannot use fractional binary representation with dec2bin or bin2dec. As far as I know Octave doesn't support it.
    – A Dwarf
    Oct 5, 2009 at 23:35
1

Those functions only work with integers.

1

According to Octave's manual, you can open and read binary floating point data in VAX D and VAX G floating format, but 'Conversions are currently only supported for "ieee-be" and "ieee-le" formats.'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .