Custom weibull function

Hello stan-community,

I try to code a custom weibull density function.
the custom destribution returns “NaN”.

The same Issue with a custom normal destribution.
If I use the “build in” distribution function it worked fine.

the function code is:

functions {
  real weibull_custom_lpdf(real time, real eta, real alpha){

   density = alpha*log(2)*exp(-alpha*eta)*(time)^(alpha-1)*exp(-log(2)*exp(alpha*eta)*time^alpha);
    return density;

alpha is a model parameter (exponential distribution).
eta and time are data.

I am a total beginner using STAN.
thank you for your help in advance.

I think the first thing you should do is to express your pdf in log-scale by taking the log of your current formula.