| 630 | |
| 631 | PG_FUNCTION_INFO_V1(floatvector_sub); |
| 632 | Datum floatvector_sub(PG_FUNCTION_ARGS) |
| 633 | { |
| 634 | FloatVector *a = PG_GETARG_FLOATVECTOR_P(0); |
| 635 | FloatVector *b = PG_GETARG_FLOATVECTOR_P(1); |
| 636 | CheckDims(a, b); |
| 637 | const float *ax = a->x; |
| 638 | const float *bx = b->x; |
| 639 | FloatVector *result = InitFloatVector(a->dim); |
| 640 | float *rx = result->x; |
| 641 | for (int16 i = 0, imax = a->dim; i < imax; ++i) { |
| 642 | rx[i] = ax[i] - bx[i]; |
| 643 | } |
| 644 | for (int16 i = 0, imax = a->dim; i < imax; ++i) { |
| 645 | if (isinf(rx[i])) { |
| 646 | float_overflow_error(); |
| 647 | } |
| 648 | } |
| 649 | |
| 650 | PG_RETURN_POINTER(result); |
| 651 | } |
| 652 | |
| 653 | /* |
| 654 | * Subtract floatvectors without allocate new floatvector |
nothing calls this directly
no test coverage detected