# Octave: how to do binary calculations?

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

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

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

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

-

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

-