I am trying to realize a block in gnuradio. It must send a message to the output and command the frequency of a signal source block. The message is a pmt pairs which contains the frequency value in the cdr field. When I put it into the pairs, its precision decreases a lot. For example, with this code
import numpy as np
import pmt
freqval = np.float64(123494235.48994166)
msg = pmt.cons(pmt.intern("freq"), pmt.to_pmt(freqval))
print("freqval : ", freqval)
print("msg : ", msg)
freqval = np.float64(123.49423548994166)
msg = pmt.cons(pmt.intern("freq"), pmt.to_pmt(freqval))
print("freqval : ", freqval)
print("msg : ", msg)
i get
freqval : 123494235.48994166
msg : (freq . 1.23494e+08)
freqval : 123.49423548994166
msg : (freq . 123.494)
while I want the value in the msg to be the same as the one contained in freqval. I tried to replace to_pmt() whith from_float() and from_double(), but nothing changed, and making the value as string, but gnuradio raises the warning
gr::log :WARN: sig_source0 - frequency value needs to be a number
Is there a way to change the precision of the pmt pairs value?