Log-normal mean and standard deviation change after sampling I have the log-normal standard deviation and the mean that I want to use to sample from a log-normal distribution in Python. However after I do the sampling and compute the arithmetic mean and standard deviation I don't get the same values that plugged in. This only happens when the mean is too small, but for my case I have to work with this exact mean. Any idea on how to solve this will be greatly appreciated.
here's the code :
import numpy as np
import scipy.stats as stats
from statistics import mean
import matplotlib.pyplot as plt
import scipy.stats as stats
from math import exp
N=1000000
m = 1.75917e-7
siglog = 1.510297984
sigma= np.sqrt(np.log(1 + (siglog/m)**2)) #normal std
mu= (np.log(m) - sigma**2 / 2) #normal mean
f = stats.lognorm.rvs(sigma, loc=0, scale=exp(mu), size=N)
print(mean(f), np.std(f))

I get this result : 2.6542845542733312e-08 6.413511018978618e-06
which is very different from siglog and m.

I did this in R and got very similar results to you, even when I tried sampling from the corresponding normal then exponentiating.
The issue here is the scale of the values you're trying to sample. Here's a plot of the density of lognorm(mu = 5.650763, sigma = -31.51881), which are the parameters corresponding to your m and siglog:

When you're this close to the machine epsilon, weird things start to happen. For example:
> 1 + 2e-16 == 1
[1] FALSE
> 1 + 1e-16 == 1
[1] TRUE

