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

>> bin2dec ('10.1')
ans = NaN
link|improve this question

1  
So you want to convert from DEC/VAX formatted floating point binary string to a decimal? – hanleyp Oct 5 '09 at 23:38
1  
There is no correct delimiter for what you are trying to achieve. – DaveParillo Oct 6 '09 at 21:58
feedback

3 Answers

up vote 2 down vote accepted

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()

link|improve this answer
I meant by 10.1 a binary number 2^1 + 2^-1 in DEC, not decimal. – Masi Oct 5 '09 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 '09 at 23:35
feedback

Those functions only work with integers.

link|improve this answer
feedback

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.'

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.