File Coverage

blib/lib/Data/CompactReadonly/V0/Scalar/Float.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 25 25 100.0


line stmt bran cond sub pod time code
1             package Data::CompactReadonly::V0::Scalar::Float;
2             our $VERSION = '0.0.5';
3              
4 3     3   22 use warnings;
  3         8  
  3         105  
5 3     3   17 use strict;
  3         5  
  3         68  
6 3     3   14 use base 'Data::CompactReadonly::V0::Scalar::Huge';
  3         7  
  3         869  
7              
8             # FIXME this uses pack()'s d format underneath, which exposes the
9             # native machine floating point format. This is not guaranteed to
10             # actually be IEEE754. Yuck. Need to find a comprehensible spec and
11             # a comprehensive text suite and implement my own.
12 3     3   975 use Data::IEEE754 qw(unpack_double_be pack_double_be);
  3         2810  
  3         565  
13              
14             sub _create {
15 13     13   69 my($class, %args) = @_;
16 13         37 my $fh = $args{fh};
17 13         78 $class->_stash_already_seen(%args);
18             print $fh $class->_type_byte_from_class().
19 13         79 pack_double_be($args{data});
20 13         392 $class->_set_next_free_ptr(%args);
21             }
22              
23             sub _decode_word {
24 13     13   34 my($class, $word) = @_;
25 13         50 return unpack_double_be($word);
26             }
27              
28             1;