diff --git a/hdrh/codec.py b/hdrh/codec.py
index a3f38f8..e6f2e3b 100644
--- a/hdrh/codec.py
+++ b/hdrh/codec.py
@@ -35,6 +35,7 @@ from ctypes import c_byte
 from ctypes import c_ushort
 from ctypes import c_uint
 from ctypes import c_ulonglong
+from ctypes import c_double
 
 import zlib
 
@@ -98,7 +99,7 @@ class PayloadHeader(BigEndianStructure):
         ("significant_figures", c_uint),
         ("lowest_trackable_value", c_ulonglong),
         ("highest_trackable_value", c_ulonglong),
-        ("conversion_ratio_bits", c_ulonglong)]
+        ("conversion_ratio_bits", c_double)]
 
 
 payload_header_size = ctypes.sizeof(PayloadHeader)
diff --git a/hdrh/histogram.py b/hdrh/histogram.py
index 8eb4951..a17a0a6 100644
--- a/hdrh/histogram.py
+++ b/hdrh/histogram.py
@@ -574,6 +574,9 @@ class HdrHistogram():
     def get_word_size(self):
         return self.word_size
 
+    def get_int_to_double_conversion_ratio(self):
+        return self.int_to_double_conversion_ratio
+
     def output_percentile_distribution(self,
                                        out_file,
                                        output_value_unit_scaling_ratio,

PayloadHeader conversion_ratio_bits type should be c_double
Based on the [Encoded Histogram format wiki](https://github.com/HdrHistogram/HdrHistogram.NET/wiki/Encoded-Histogram-format), the header element `Integer to double conversion ratio` is a double precision float. Currently the python version is using a long data type which alters the encoded output. 




diff --git a/test/test_hdrhistogram.py b/test/test_hdrhistogram.py
index 867d7a3..469e92f 100644
--- a/test/test_hdrhistogram.py
+++ b/test/test_hdrhistogram.py
@@ -425,17 +425,17 @@ def check_hist_encode(word_size,
 ENCODE_ARG_LIST = (
     # word size digits  expected_compressed_length, fill_start%, fill_count%
     # best case when all counters are zero
-    (8, 3, 48, 0, 0),        # V1=52 385 = size when compressing entire counts array
-    (8, 2, 48, 0, 0),        # 126
+    (8, 3, 52, 0, 0),        # V1=52 385 = size when compressing entire counts array
+    (8, 2, 52, 0, 0),        # 126
     # typical case when all counters are aggregated in a small contiguous area
-    (8, 3, 15560, 30, 20),   # V1=16452
-    (8, 2, 1688, 30, 20),    # V1=2096
+    (8, 3, 15564, 30, 20),   # V1=16452
+    (8, 2, 1692, 30, 20),    # V1=2096
     # worst case when all counters are different
     (8, 3, 76892, 0, 100),   # V1=80680
-    (8, 2, 9340, 0, 100),    # V1=10744
+    (8, 2, 9344, 0, 100),    # V1=10744
     # worst case 32-bit and 16-bit counters
     (2, 3, 76892, 0, 100),   # V1=68936
-    (2, 2, 9340, 0, 100),    # V1=9144
+    (2, 2, 9344, 0, 100),    # V1=9144
 )
 
 @pytest.mark.codec
@@ -618,6 +618,8 @@ def test_jHiccup_v2_log():
             accumulated_histogram.add(decoded_histogram)
             # These logs use 8 byte counters
             assert decoded_histogram.get_word_size() == 8
+            # These logs use the default 1.0 conversion ratio
+            assert decoded_histogram.get_int_to_double_conversion_ratio() == 1.0
         for statement in target_numbers:
             assert eval(statement) == target_numbers[statement]
 

pip install -e .
parse_log_pytest
requirements.txt
pytest flake8 pylint
apt-get update apt-get install -y gcc
3.6
requirements.txt test-requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
astroid==2.11.7
attrs==22.2.0
certifi==2021.5.30
dill==0.3.4
flake8==5.0.4
future==1.0.0
-e git+https://github.com/HdrHistogram/HdrHistogram_py.git@d566355a8f055d6ae78679f8f92e63be92c24470#egg=hdrhistogram
importlib-metadata==4.2.0
iniconfig==1.1.1
isort==5.10.1
lazy-object-proxy==1.7.1
mccabe==0.7.0
packaging==21.3
pbr==6.1.1
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
pylint==2.13.9
pyparsing==3.1.4
pytest==7.0.1
tomli==1.2.3
typed-ast==1.5.5
typing_extensions==4.1.1
wrapt==1.16.0
zipp==3.6.0

name: HdrHistogram_py
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - astroid==2.11.7
      - attrs==22.2.0
      - dill==0.3.4
      - flake8==5.0.4
      - future==1.0.0
      - importlib-metadata==4.2.0
      - iniconfig==1.1.1
      - isort==5.10.1
      - lazy-object-proxy==1.7.1
      - mccabe==0.7.0
      - packaging==21.3
      - pbr==6.1.1
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - py==1.11.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - pylint==2.13.9
      - pyparsing==3.1.4
      - pytest==7.0.1
      - tomli==1.2.3
      - typed-ast==1.5.5
      - typing-extensions==4.1.1
      - wrapt==1.16.0
      - zipp==3.6.0
prefix: /opt/conda/envs/HdrHistogram_py

test/test_hdrhistogram.py::test_hist_encode test/test_hdrhistogram.py::test_jHiccup_v2_log
test/test_hdrhistogram.py::test_basic test/test_hdrhistogram.py::test_empty_histogram test/test_hdrhistogram.py::test_large_numbers test/test_hdrhistogram.py::test_record_value test/test_hdrhistogram.py::test_highest_equivalent_value test/test_hdrhistogram.py::test_scaled_highest_equiv_value test/test_hdrhistogram.py::test_percentiles test/test_hdrhistogram.py::test_recorded_iterator test/test_hdrhistogram.py::test_linear_iterator test/test_hdrhistogram.py::test_log_iterator test/test_hdrhistogram.py::test_percentile_iterator test/test_hdrhistogram.py::test_reset_iterator test/test_hdrhistogram.py::test_reset test/test_hdrhistogram.py::test_invalid_significant_figures test/test_hdrhistogram.py::test_out_of_range_values test/test_hdrhistogram.py::test_mean_stddev test/test_hdrhistogram.py::test_hdr_payload test/test_hdrhistogram.py::test_hdr_payload_exceptions test/test_hdrhistogram.py::test_hist_codec test/test_hdrhistogram.py::test_hist_codec_partial test/test_hdrhistogram.py::test_hdr_interop test/test_hdrhistogram.py::test_log test/test_hdrhistogram.py::test_output_percentile_distribution test/test_hdrhistogram.py::test_add_array_errors test/test_hdrhistogram.py::test_add_array test/test_hdrhistogram.py::test_zz_encode_errors test/test_hdrhistogram.py::test_zz_encode test/test_hdrhistogram.py::test_zz_decode_errors test/test_hdrhistogram.py::test_zz_decode test/test_hdrhistogram.py::test_get_value_at_percentile
hdrh/histogram.py hdrh/codec.py
hdrh/histogram.py hdrh/codec.py