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.6';
3              
4 3     3   17 use warnings;
  3         6  
  3         92  
5 3     3   14 use strict;
  3         4  
  3         56  
6 3     3   12 use base 'Data::CompactReadonly::V0::Scalar::Huge';
  3         6  
  3         727  
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   816 use Data::IEEE754 qw(unpack_double_be pack_double_be);
  3         2262  
  3         444  
13              
14             sub _create {
15 15     15   65 my($class, %args) = @_;
16 15         31 my $fh = $args{fh};
17 15         65 $class->_stash_already_seen(%args);
18             print $fh $class->_type_byte_from_class().
19 15         73 pack_double_be($args{data});
20 15         374 $class->_set_next_free_ptr(%args);
21             }
22              
23             sub _decode_word {
24 15     15   32 my($class, $word) = @_;
25 15         43 return unpack_double_be($word);
26             }
27              
28             1;