Class: CBOR_DIAG::App_nan

Inherits:
Object show all
Defined in:
lib/cbor-diagnostic-app/nan.rb

Class Method Summary collapse

Class Method Details

.decode(_, s) ⇒ Object



4
5
6
7
8
9
# File 'lib/cbor-diagnostic-app/nan.rb', line 4

def self.decode(_, s)
  val, = s.sub("p0", "p+0").scanf("%a")
  raise ArgumentError.new ("nan'#{s}' not valid") unless val &&
                                                         val.abs > 1.0 && val.abs < 2.0
  val.cbor_nan_toggle
end