# SubtractPostChecks

`type` in `services` · v0.7.1

<https://docs.seedcord.org/packages/services/0.7.1/types/subtract-post-checks>

Subtracts two numbers A and B, such that they are not equal and neither of them are 0, +/- infinity or the `number` type

## Declaration

```ts
type SubtractPostChecks<A extends number, B extends number, AreNegative = [IsNegative<A>, IsNegative<B>]> = AreNegative extends [false, false] ? SubtractPositives<A, B> : AreNegative extends [true, true] // When both numbers are negative we subtract the absolute values and then reverse the sign ? ReverseSign<SubtractPositives<Absolute<A>, Absolute<B>>> // When the signs are different we can add the absolute values and then reverse the sign if A < B : [...TupleOf<Absolute<A>>, ...TupleOf<Absolute<B>>] extends infer R extends unknown[] ? LessThan<A, B> extends true ? ReverseSign<R['length']> : R['length'] : never
```
