Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

>> bin2dec ('10.1')
ans = NaN
share|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

3 Answers 3

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

share|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

Those functions only work with integers.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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