itgl_03.cc

来自「这是一个从音频信号里提取特征参量的程序」· CC 代码 · 共 49 行

CC
49 行
字号
// file: $isip/class/system/Integral/itgl_03.cc// version: $Id: itgl_03.cc,v 1.6 2000/09/29 20:36:36 picone Exp $//// isip include files//#include "Integral.h"#include <Error.h>// uncomment this line to debug almost equal////#define ISIP_DEBUG_EQUALITY// method: almostEqual//// arguments://  double x: (input) first value to be compared//  double y: (input) second value to be compared//  double percent: (input) *percentage* of difference allowable//  double bound: (input) a lower bound on the comparison//// return: a boolean value indicating status//// this method compares two floating point numbers and determines if they// are equal to within a specified precision. this method is vital to// our diagnose methods, which require a comparison of computations to some// known result.//// this method implements a comparison as:////   x == y if  abs(x-y) < (percent/100.0) * (abs(x) + bound)//// hence, this method essentially provides a means of comparing numbers// in a user-specified precision, since the user controls percent and bound.//boolean Integral::almostEqual(double x_a, double y_a,			      double percent_a, double bound_a) {    // compare values to a threshold  // with them a bit fields.  //  if (abs(x_a - y_a) < ((0.01 * percent_a) * (abs(x_a) + bound_a))) {    return true;  }  else {    return false;  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?