code: def test_longdouble_preserved(backend):
      if (
          issubclass(backend, backends.TempHDFBackend)
          and not does_hdf5_support_longdouble()
      ):
          pytest.xfail(
              "HDF5 does not support long double on this platform"
          )
      nwalkers = 10
      ndim = 2
      nsteps = 5
      with backend(dtype=np.longdouble) as b:
          b.reset(nwalkers, ndim)
          b.grow(nsteps, None)
          for i in range(nsteps):
              coords = np.zeros((nwalkers, ndim), dtype=np.longdouble)
              coords += i + 1
              coords += np.arange(nwalkers)[:, None]
              coords[:, 1] += (
                  coords[:, 0] * 2 * np.finfo(np.longdouble).eps
              )
              assert not np.any(coords[:, 1] == coords[:, 0])
              lp = 1 + np.arange(nwalkers) * np.finfo(np.longdouble).eps
              state = State(coords, log_prob=lp, random_state=())
              b.save_step(state, np.ones((nwalkers,), dtype=bool))
              s = b.get_last_sample()
              # check s has adequate precision and equals state
              assert s.coords.dtype == np.longdouble
              assert not np.any(s.coords[:, 1] == s.coords[:, 0])
              assert np.all(s.coords == coords)
  
              assert s.log_prob.dtype == np.longdouble
              assert np.all(s.log_prob == lp)
  
file_path: emcee/src/emcee/tests/unit/test_backends.py
imports: import os
  from itertools import product
  from os.path import join
  import numpy
  import pytest
  from emcee import EnsembleSampler, State, backends
  from emcee.backends.hdf import does_hdf5_support_longdouble
label_desc: Use image node_id 12 for calling a global function with example usage: test_longdouble_preserved(backend) without return types