Changeset 4337


Ignore:
Timestamp:
Apr 14, 2023, 3:22:32 AM (5 months ago)
Author:
Peter
Message:

avoid a couple of multiplications

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/statistics/ln_pdf.cc

    r4336 r4337  
    6969    // pdf = 1/(s sqrt(2pi)) * exp(-1/2 * (x/s)^2)
    7070
    71     return -std::log(s) - 0.5*M_LN2 - 0.5*M_LNPI - 0.5 * std::pow(x/s, 2);
     71    return -std::log(s) - 0.5 * (M_LN2 + M_LNPI + std::pow(x/s, 2));
    7272  }
    7373
     
    126126    // pdf = 1/(sqrt(2pi)) * exp(-1/2 * x^2)
    127127
    128     return - 0.5*M_LN2 - 0.5*M_LNPI - 0.5 * x*x;
     128    return - 0.5 * (M_LN2 + M_LNPI + x*x);
    129129  }
    130130
Note: See TracChangeset for help on using the changeset viewer.