my $packed_integer = int($float * 1_000_000); my $unpacked_float = $packed_integer / 1_000_000;