File Coverage

blib/lib/Data/CompactReadonly/V0/Scalar/Float64.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::Float64;
2             our $VERSION = '0.1.0';
3              
4 3     3   24 use warnings;
  3         7  
  3         109  
5 3     3   17 use strict;
  3         8  
  3         66  
6 3     3   16 use base 'Data::CompactReadonly::V0::Scalar::Huge';
  3         6  
  3         809  
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   897 use Data::IEEE754 qw(unpack_double_be pack_double_be);
  3         2821  
  3         532  
13              
14             sub _create {
15 15     15   69 my($class, %args) = @_;
16 15         36 my $fh = $args{fh};
17 15         87 $class->_stash_already_seen(%args);
18             print $fh $class->_type_byte_from_class().
19 15         91 pack_double_be($args{data});
20 15         486 $class->_set_next_free_ptr(%args);
21             }
22              
23             sub _decode_word {
24 15     15   39 my($class, $word) = @_;
25 15         52 return unpack_double_be($word);
26             }
27              
28             1;