如何在 C++ 中将 z 值更改为 table(正态分布中的 Z-Table)?

How to change the z value to the one from the table (Z-Table from Normal Distribution) in C++?

我的任务是使用 C++ 编写一个程序来计算使用正态分布的概率。如果我已经找到了 Z 值,如何将其更改为 Z table 中的值?就像 -0.55,在 z-table 中是 0.29116。 table 中的 0.85 是 0.80234。

因为我知道数组只知道显示什么列和行。 谢谢

table 用于 Cumulative Normal Distribution Function. This is easiest to implement using the erfc 标准库数学函数:

double cumulativeNormal(double x) {
    return 0.5 * std::erfc(-x * M_SQRT1_2);
}

int main() {
    std::cout << cumulativeNormal(-0.55) << '\n';  // prints 0.29116
}