📄 itgl_03.cc
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -