<math.h>
头文件中。double erf(double x);
#include <stdio.h> #include <math.h> int main() { double numbers[] = {0.0, 0.5, 1.0, -1.0, 1.5}; double result; for(int i = 0; i < 5; i++) { result = erf(numbers[i]); printf("erf(%.2f) = %.2f\n", numbers[i], result); } return 0; }输出结果为(由于系统和编译器的差异,输出可能会略有不同):
erf(0.00) = 0.00
erf(0.50) = 0.52
erf(1.00) = 0.84
erf(-1.00) = -0.84
erf(1.50) = 0.97
本文链接:http://task.lmcjl.com/news/12646.html