[gs-longan](../README.md) / DTolerance

# Class: DTolerance

双精度容差工具类

## Table of contents

### Constructors

- [constructor](DTolerance.md#constructor)

### Properties

- [resabs](DTolerance.md#resabs)
- [resnor](DTolerance.md#resnor)

### Methods

- [sameValue](DTolerance.md#samevalue)
- [sameValueFloatArray](DTolerance.md#samevaluefloatarray)
- [sameValueWithTolerance](DTolerance.md#samevaluewithtolerance)

## Constructors

### constructor

• **new DTolerance**(): [`DTolerance`](DTolerance.md)

#### Returns

[`DTolerance`](DTolerance.md)

## Properties

### resabs

▪ `Static` **resabs**: `number` = `1.0e-6`

双精度绝对容差

___

### resnor

▪ `Static` **resnor**: `number` = `1.0e-10`

双精度法线容差

## Methods

### sameValue

▸ **sameValue**(`a`, `b`): `boolean`

判断两个双精度数是否在容差内相等

#### Parameters

| Name | Type |
| :------ | :------ |
| `a` | `number` |
| `b` | `number` |

#### Returns

`boolean`

___

### sameValueFloatArray

▸ **sameValueFloatArray**(`a`, `b`): `boolean`

比较两个 Float64Array 是否逐元素相等（基于双精度绝对容差）

#### Parameters

| Name | Type |
| :------ | :------ |
| `a` | `Float64Array` |
| `b` | `Float64Array` |

#### Returns

`boolean`

___

### sameValueWithTolerance

▸ **sameValueWithTolerance**(`a`, `b`, `tolerance`): `boolean`

使用指定容差判断两个数是否相等

#### Parameters

| Name | Type |
| :------ | :------ |
| `a` | `number` |
| `b` | `number` |
| `tolerance` | `number` |

#### Returns

`boolean`
