Lines Matching defs:sgn

300 fp16_pack(uint16_t sgn, uint16_t exp, uint16_t mnt)
302 return sgn << (FP16_BITS - 1) | exp << FP16_MANT_BITS | FP16_MANT(mnt);
306 fp32_pack(uint32_t sgn, uint32_t exp, uint32_t mnt)
308 return sgn << (FP32_BITS - 1) | exp << FP32_MANT_BITS | FP32_MANT(mnt);
312 fp64_pack(uint64_t sgn, uint64_t exp, uint64_t mnt)
314 return sgn << (FP64_BITS - 1) | exp << FP64_MANT_BITS | FP64_MANT(mnt);
318 fp16_zero(int sgn)
320 return fp16_pack(sgn, 0, 0);
324 fp32_zero(int sgn)
326 return fp32_pack(sgn, 0, 0);
330 fp64_zero(int sgn)
332 return fp64_pack(sgn, 0, 0);
336 fp16_max_normal(int sgn)
338 return fp16_pack(sgn, FP16_EXP_INF - 1, -1);
342 fp32_max_normal(int sgn)
344 return fp32_pack(sgn, FP32_EXP_INF - 1, -1);
348 fp64_max_normal(int sgn)
350 return fp64_pack(sgn, FP64_EXP_INF - 1, -1);
354 fp16_infinity(int sgn)
356 return fp16_pack(sgn, FP16_EXP_INF, 0);
360 fp32_infinity(int sgn)
362 return fp32_pack(sgn, FP32_EXP_INF, 0);
366 fp64_infinity(int sgn)
368 return fp64_pack(sgn, FP64_EXP_INF, 0);
390 fp16_unpack(int *sgn, int *exp, uint16_t *mnt, uint16_t x, int mode,
393 *sgn = x >> (FP16_BITS - 1);
409 fp32_unpack(int *sgn, int *exp, uint32_t *mnt, uint32_t x, int mode,
412 *sgn = x >> (FP32_BITS - 1);
429 fp64_unpack(int *sgn, int *exp, uint64_t *mnt, uint64_t x, int mode,
432 *sgn = x >> (FP64_BITS - 1);
707 fp16_round_(int sgn, int exp, uint16_t mnt, int rm, int mode, int *flags)
718 return fp16_zero(sgn);
742 (((rm == FPLIB_RP && !sgn) || (rm == FPLIB_RM && sgn)) && error)) {
763 if (rm == FPLIB_RN || (rm == FPLIB_RP && !sgn) ||
764 (rm == FPLIB_RM && sgn)) {
765 return fp16_infinity(sgn);
767 return fp16_max_normal(sgn);
773 return fp16_pack(sgn, FP16_EXP_INF, -1);
781 return fp16_pack(sgn, biased_exp, int_mant);
785 fp16_round(int sgn, int exp, uint16_t mnt, int mode, int *flags)
787 return fp16_round_(sgn, exp, mnt, mode & 3, mode, flags);
791 fp32_round_(int sgn, int exp, uint32_t mnt, int rm, int mode, int *flags)
802 return fp32_zero(sgn);
826 (((rm == FPLIB_RP && !sgn) || (rm == FPLIB_RM && sgn)) && error)) {
846 if (rm == FPLIB_RN || (rm == FPLIB_RP && !sgn) ||
847 (rm == FPLIB_RM && sgn)) {
848 return fp32_infinity(sgn);
850 return fp32_max_normal(sgn);
858 return fp32_pack(sgn, biased_exp, int_mant);
862 fp32_round(int sgn, int exp, uint32_t mnt, int mode, int *flags)
864 return fp32_round_(sgn, exp, mnt, mode & 3, mode, flags);
868 fp64_round_(int sgn, int exp, uint64_t mnt, int rm, int mode, int *flags)
879 return fp64_zero(sgn);
903 (((rm == FPLIB_RP && !sgn) || (rm == FPLIB_RM && sgn)) && error)) {
923 if (rm == FPLIB_RN || (rm == FPLIB_RP && !sgn) ||
924 (rm == FPLIB_RM && sgn)) {
925 return fp64_infinity(sgn);
927 return fp64_max_normal(sgn);
935 return fp64_pack(sgn, biased_exp, int_mant);
939 fp64_round(int sgn, int exp, uint64_t mnt, int mode, int *flags)
941 return fp64_round_(sgn, exp, mnt, mode & 3, mode, flags);
2558 fp16_FPOnePointFive(int sgn)
2560 return fp16_pack(sgn, FP16_EXP_BIAS, 1ULL << (FP16_MANT_BITS - 1));
2564 fp32_FPOnePointFive(int sgn)
2566 return fp32_pack(sgn, FP32_EXP_BIAS, 1ULL << (FP32_MANT_BITS - 1));
2570 fp64_FPOnePointFive(int sgn)
2572 return fp64_pack(sgn, FP64_EXP_BIAS, 1ULL << (FP64_MANT_BITS - 1));
2576 fp16_FPThree(int sgn)
2578 return fp16_pack(sgn, FP16_EXP_BIAS + 1, 1ULL << (FP16_MANT_BITS - 1));
2582 fp32_FPThree(int sgn)
2584 return fp32_pack(sgn, FP32_EXP_BIAS + 1, 1ULL << (FP32_MANT_BITS - 1));
2588 fp64_FPThree(int sgn)
2590 return fp64_pack(sgn, FP64_EXP_BIAS + 1, 1ULL << (FP64_MANT_BITS - 1));
2594 fp16_FPTwo(int sgn)
2596 return fp16_pack(sgn, FP16_EXP_BIAS + 1, 0);
2600 fp32_FPTwo(int sgn)
2602 return fp32_pack(sgn, FP32_EXP_BIAS + 1, 0);
2606 fp64_FPTwo(int sgn)
2608 return fp64_pack(sgn, FP64_EXP_BIAS + 1, 0);
2617 int sgn, exp;
2622 fp32_unpack(&sgn, &exp, &mnt, op, mode, &flags);
2628 result = fp16_zero(sgn);
2639 result = ((uint16_t)sgn << (FP16_BITS - 1) |
2643 result = fp16_infinity(sgn);
2646 result = fp16_zero(sgn);
2649 fp16_round_(sgn, exp - FP32_EXP_BIAS + FP16_EXP_BIAS,
2666 int sgn, exp;
2671 fp64_unpack(&sgn, &exp, &mnt, op, mode, &flags);
2677 result = fp16_zero(sgn);
2688 result = ((uint16_t)sgn << (FP16_BITS - 1) |
2692 result = fp16_infinity(sgn);
2695 result = fp16_zero(sgn);
2698 fp16_round_(sgn, exp - FP64_EXP_BIAS + FP16_EXP_BIAS,
2715 int sgn, exp;
2720 fp16_unpack(&sgn, &exp, &mnt, op, mode & 0xf, &flags);
2732 result = fp32_infinity(sgn);
2734 result = fp32_zero(sgn);
2737 result = fp32_pack(sgn, (exp - FP16_EXP_BIAS +
2753 int sgn, exp;
2758 fp64_unpack(&sgn, &exp, &mnt, op, mode, &flags);
2770 result = fp32_infinity(sgn);
2772 result = fp32_zero(sgn);
2775 fp32_round_(sgn, exp - FP64_EXP_BIAS + FP32_EXP_BIAS,
2792 int sgn, exp;
2797 fp16_unpack(&sgn, &exp, &mnt, op, mode & 0xf, &flags);
2809 result = fp64_infinity(sgn);
2811 result = fp64_zero(sgn);
2814 result = fp64_pack(sgn, (exp - FP16_EXP_BIAS +
2830 int sgn, exp;
2835 fp32_unpack(&sgn, &exp, &mnt, op, mode, &flags);
2847 result = fp64_infinity(sgn);
2849 result = fp64_zero(sgn);
2852 result = fp64_pack(sgn, (exp - FP32_EXP_BIAS +
3113 fp16_repack(int sgn, int exp, uint16_t mnt)
3115 return fp16_pack(sgn, mnt >> FP16_MANT_BITS ? exp : 0, mnt);
3119 fp32_repack(int sgn, int exp, uint32_t mnt)
3121 return fp32_pack(sgn, mnt >> FP32_MANT_BITS ? exp : 0, mnt);
3125 fp64_repack(int sgn, int exp, uint64_t mnt)
3127 return fp64_pack(sgn, mnt >> FP64_MANT_BITS ? exp : 0, mnt);
3131 fp16_minmaxnum(uint16_t *op1, uint16_t *op2, int sgn)
3136 *op1 = fp16_infinity(sgn);
3139 *op2 = fp16_infinity(sgn);
3143 fp32_minmaxnum(uint32_t *op1, uint32_t *op2, int sgn)
3148 *op1 = fp32_infinity(sgn);
3151 *op2 = fp32_infinity(sgn);
3155 fp64_minmaxnum(uint64_t *op1, uint64_t *op2, int sgn)
3160 *op1 = fp64_infinity(sgn);
3163 *op2 = fp64_infinity(sgn);
3521 int sgn, exp;
3524 fp16_unpack(&sgn, &exp, &mnt, op, mode, &flags);
3529 result = fp16_infinity(sgn);
3531 } else if (sgn) {
3556 int sgn, exp;
3559 fp32_unpack(&sgn, &exp, &mnt, op, mode, &flags);
3564 result = fp32_infinity(sgn);
3566 } else if (sgn) {
3591 int sgn, exp;
3594 fp64_unpack(&sgn, &exp, &mnt, op, mode, &flags);
3599 result = fp64_infinity(sgn);
3601 } else if (sgn) {
3716 int sgn, exp;
3719 fp16_unpack(&sgn, &exp, &mnt, op, mode, &flags);
3724 result = fp16_zero(sgn);
3726 result = fp16_infinity(sgn);
3735 overflow_to_inf = !sgn;
3738 overflow_to_inf = sgn;
3746 result = overflow_to_inf ? fp16_infinity(sgn) : fp16_max_normal(sgn);
3749 result = fp16_zero(sgn);
3764 result = fp16_pack(sgn, result_exp, fraction);
3778 int sgn, exp;
3781 fp32_unpack(&sgn, &exp, &mnt, op, mode, &flags);
3786 result = fp32_zero(sgn);
3788 result = fp32_infinity(sgn);
3797 overflow_to_inf = !sgn;
3800 overflow_to_inf = sgn;
3808 result = overflow_to_inf ? fp32_infinity(sgn) : fp32_max_normal(sgn);
3811 result = fp32_zero(sgn);
3826 result = fp32_pack(sgn, result_exp, fraction);
3840 int sgn, exp;
3843 fp64_unpack(&sgn, &exp, &mnt, op, mode, &flags);
3848 result = fp64_zero(sgn);
3850 result = fp64_infinity(sgn);
3859 overflow_to_inf = !sgn;
3862 overflow_to_inf = sgn;
3870 result = overflow_to_inf ? fp64_infinity(sgn) : fp64_max_normal(sgn);
3873 result = fp64_zero(sgn);
3888 result = fp64_pack(sgn, result_exp, fraction);
3992 int sgn, exp;
3995 fp16_unpack(&sgn, &exp, &mnt, op, mode, &flags);
4002 result = fp16_pack(sgn, FP16_EXP_INF - 1, 0);
4004 result = fp16_pack(sgn, exp ^ FP16_EXP_INF, 0);
4019 int sgn, exp;
4022 fp32_unpack(&sgn, &exp, &mnt, op, mode, &flags);
4029 result = fp32_pack(sgn, FP32_EXP_INF - 1, 0);
4031 result = fp32_pack(sgn, exp ^ FP32_EXP_INF, 0);
4046 int sgn, exp;
4049 fp64_unpack(&sgn, &exp, &mnt, op, mode, &flags);
4056 result = fp64_pack(sgn, FP64_EXP_INF - 1, 0);
4058 result = fp64_pack(sgn, exp ^ FP64_EXP_INF, 0);
4074 int sgn, exp;
4078 fp16_unpack(&sgn, &exp, &mnt, op, mode, &flags);
4084 result = fp16_infinity(sgn);
4086 result = fp16_zero(sgn);
4101 x += err && !sgn;
4104 x += err && sgn;
4116 result = fp16_zero(sgn);
4120 result = fp16_pack(sgn, exp + FP16_EXP_BITS, mnt >> FP16_EXP_BITS);
4139 int sgn, exp;
4143 fp32_unpack(&sgn, &exp, &mnt, op, mode, &flags);
4149 result = fp32_infinity(sgn);
4151 result = fp32_zero(sgn);
4166 x += err && !sgn;
4169 x += err && sgn;
4181 result = fp32_zero(sgn);
4185 result = fp32_pack(sgn, exp + FP32_EXP_BITS, mnt >> FP32_EXP_BITS);
4204 int sgn, exp;
4208 fp64_unpack(&sgn, &exp, &mnt, op, mode, &flags);
4214 result = fp64_infinity(sgn);
4216 result = fp64_zero(sgn);
4231 x += err && !sgn;
4234 x += err && sgn;
4246 result = fp64_zero(sgn);
4250 result = fp64_pack(sgn, exp + FP64_EXP_BITS, mnt >> FP64_EXP_BITS);
4459 int sgn, exp;
4466 fp16_unpack(&sgn, &exp, &mnt, result, mode, &flags);
4479 int sgn, exp;
4486 fp32_unpack(&sgn, &exp, &mnt, result, mode, &flags);
4498 int sgn, exp;
4505 fp64_unpack(&sgn, &exp, &mnt, result, mode, &flags);
4546 FPToFixed_64(int sgn, int exp, uint64_t mnt, bool u, FPRounding rounding,
4555 return ((uint64_t)!u << (FP64_BITS - 1)) - !sgn;
4568 x += err && !sgn;
4571 x += err && sgn;
4582 if (u ? sgn && x : x > (1ULL << (FP64_BITS - 1)) - !sgn) {
4584 return ((uint64_t)!u << (FP64_BITS - 1)) - !sgn;
4591 return sgn ? -x : x;
4595 FPToFixed_32(int sgn, int exp, uint64_t mnt, bool u, FPRounding rounding,
4598 uint64_t x = FPToFixed_64(sgn, exp, mnt, u, rounding, flags);
4603 x = ((uint32_t)!u << (FP32_BITS - 1)) - !sgn;
4609 FPToFixed_16(int sgn, int exp, uint64_t mnt, bool u, FPRounding rounding,
4612 uint64_t x = FPToFixed_64(sgn, exp, mnt, u, rounding, flags);
4617 x = ((uint16_t)!u << (FP16_BITS - 1)) - !sgn;
4628 int sgn, exp;
4632 fp16_unpack(&sgn, &exp, &mnt, op, modeConv(fpscr), &flags);
4642 FPToFixed_16(sgn, exp + FP64_EXP_BIAS - FP16_EXP_BIAS + fbits,
4658 int sgn, exp;
4663 fp16_unpack(&sgn, &exp, &mnt, op, modeConv(fpscr), &flags);
4674 FPToFixed_32(sgn, exp + FP64_EXP_BIAS - FP16_EXP_BIAS + fbits,
4689 int sgn, exp;
4693 fp32_unpack(&sgn, &exp, &mnt, op, modeConv(fpscr), &flags);
4703 FPToFixed_32(sgn, exp + FP64_EXP_BIAS - FP32_EXP_BIAS + fbits,
4718 int sgn, exp;
4723 fp64_unpack(&sgn, &exp, &mnt, op, modeConv(fpscr), &flags);
4732 result = FPToFixed_32(sgn, exp + fbits, mnt, u, rounding, &flags);
4746 int sgn, exp;
4751 fp16_unpack(&sgn, &exp, &mnt, op, modeConv(fpscr), &flags);
4762 FPToFixed_64(sgn, exp + FP64_EXP_BIAS - FP16_EXP_BIAS + fbits,
4777 int sgn, exp;
4782 fp32_unpack(&sgn, &exp, &mnt, op, modeConv(fpscr), &flags);
4792 FPToFixed_64(sgn, exp + FP64_EXP_BIAS - FP32_EXP_BIAS + fbits,
4807 int sgn, exp;
4811 fp64_unpack(&sgn, &exp, &mnt, op, modeConv(fpscr), &flags);
4820 result = FPToFixed_64(sgn, exp + fbits, mnt, u, rounding, &flags);
4924 fplibInfinity(int sgn)
4926 return fp16_infinity(sgn);
4931 fplibInfinity(int sgn)
4933 return fp32_infinity(sgn);
4938 fplibInfinity(int sgn)
4940 return fp64_infinity(sgn);