I would rewrite the code as the following to avoid all unnecessary conversions that can induce errors:
const gasPrice = await ethers.getDefaultProvider().getGasPrice();
const gasUnits =
await new Contract(
address,
abi,
ethers.getDefaultProvider()
).estimateGas.functionName(params);
const transactionFee = gasPrice.mul(gasUnits);
console.log("transactionFee in wei: " + transactionFee.toString());
console.log("transactionFee in ether: " + ethers.utils.formatUnits(transactionFee, "ether"));