You are trying to run a double computation on a number of 1560 bits, which causes an overflow. For such large numbers you should use GetMSB() instead of the logarithm. For instance, replace log2(cc->GetCryptoParameters()->GetElementParams()->GetModulus().ConvertToDouble()) with cc->GetCryptoParameters()->GetElementParams()->GetModulus().GetMSB(). When you are interested in computing the size of the ciphertext modulus, you can also determine it from the multiplicative depth, the scaling mod size and the first mod size, which are set in the cryptocontext generation. You can also find out more about the individual moduli using code like this openfhe-development/src/pke/examples/advanced-real-numbers.cpp at main · openfheorg/openfhe-development · GitHub.