int auacer_write_codec(void *v, uint8_t reg, uint16_t val) { struct auacer_softc *sc; DPRINTF(ALI_DEBUG_CODECIO, ("auacer_write_codec: reg=0x%x val=0x%x\n", reg, val)); sc = v; if (auacer_sema_codec(sc)) return EIO; WRITE2(sc, ALI_CPR, val); #if 0 if (ac97->num) reg |= ALI_CPR_ADDR_SECONDARY; #endif WRITE2(sc, ALI_CPR_ADDR, reg); auacer_ready_codec(sc, ALI_CSPSR_WRITE_OK); return 0; }
static void auacer_upd_chan(struct auacer_softc *sc, struct auacer_chan *chan) { uint32_t sts; uint32_t civ; sts = READ2(sc, chan->port + ALI_OFF_SR); /* intr ack */ WRITE2(sc, chan->port + ALI_OFF_SR, sts & ALI_SR_W1TC); WRITE4(sc, ALI_INTERRUPTSR, ALI_PORT2INTR(chan->port)); DPRINTF(ALI_DEBUG_INTR, ("auacer_upd_chan: sts=0x%x\n", sts)); if (sts & ALI_SR_DMA_INT_FIFO) { printf("%s: fifo underrun # %u\n", device_xname(&sc->sc_dev), ++chan->fifoe); } civ = READ1(sc, chan->port + ALI_OFF_CIV); DPRINTF(ALI_DEBUG_INTR,("auacer_intr: civ=%u ptr=%u\n",civ,chan->ptr)); /* XXX */ while (chan->ptr != civ) { auacer_add_entry(chan); } WRITE1(sc, chan->port + ALI_OFF_LVI, (chan->ptr - 1) & ALI_LVI_MASK); while (chan->ack != civ) { if (chan->intr) { DPRINTF(ALI_DEBUG_INTR,("auacer_upd_chan: callback\n")); chan->intr(chan->arg); } chan->ack++; if (chan->ack >= ALI_DMALIST_MAX) chan->ack = 0; } }
static int auacer_read_codec(void *v, uint8_t reg, uint16_t *val) { struct auacer_softc *sc; sc = v; if (auacer_sema_codec(sc)) return EIO; reg |= ALI_CPR_ADDR_READ; #if 0 if (ac97->num) reg |= ALI_CPR_ADDR_SECONDARY; #endif WRITE2(sc, ALI_CPR_ADDR, reg); if (auacer_ready_codec(sc, ALI_CSPSR_READ_OK)) return EIO; *val = READ2(sc, ALI_SPR); DPRINTF(ALI_DEBUG_CODECIO, ("auacer_read_codec: reg=0x%x val=0x%x\n", reg, *val)); return 0; }
void fbGlyph24(FbBits * dstBits, FbStride dstStride, int dstBpp, FbStip * stipple, FbBits fg, int x, int height) { int lshift; FbStip bits; CARD8 *dstLine; CARD8 *dst; FbStip f0, f1, f2; int n; int shift; f0 = fg; f1 = FbRot24(f0, 16); f2 = FbRot24(f0, 8); dstLine = (CARD8 *) dstBits; dstLine += (x & ~3) * 3; dstStride *= (sizeof(FbBits) / sizeof(CARD8)); shift = x & 3; lshift = 4 - shift; while (height--) { bits = *stipple++; n = lshift; dst = dstLine; while (bits) { switch (FbStipMoveLsb(FbLeftStipBits(bits, n), 4, n)) { case CASE(0, 0, 0, 0): break; case CASE(1, 0, 0, 0): WRITE2(dst, 0, _AB); WRITE1(dst, 2, _C); break; case CASE(0, 1, 0, 0): WRITE1(dst, 3, _A); WRITE2(dst, 4, _BC); break; case CASE(1, 1, 0, 0): WRITE4(dst, 0, _ABCA); WRITE2(dst, 4, _BC); break; case CASE(0, 0, 1, 0): WRITE2(dst, 6, _AB); WRITE1(dst, 8, _C); break; case CASE(1, 0, 1, 0): WRITE2(dst, 0, _AB); WRITE1(dst, 2, _C); WRITE2(dst, 6, _AB); WRITE1(dst, 8, _C); break; case CASE(0, 1, 1, 0): WRITE1(dst, 3, _A); WRITE4(dst, 4, _BCAB); WRITE1(dst, 8, _C); break; case CASE(1, 1, 1, 0): WRITE8(dst); WRITE1(dst, 8, _C); break; case CASE(0, 0, 0, 1): WRITE1(dst, 9, _A); WRITE2(dst, 10, _BC); break; case CASE(1, 0, 0, 1): WRITE2(dst, 0, _AB); WRITE1(dst, 2, _C); WRITE1(dst, 9, _A); WRITE2(dst, 10, _BC); break; case CASE(0, 1, 0, 1): WRITE1(dst, 3, _A); WRITE2(dst, 4, _BC); WRITE1(dst, 9, _A); WRITE2(dst, 10, _BC); break; case CASE(1, 1, 0, 1): WRITE4(dst, 0, _ABCA); WRITE2(dst, 4, _BC); WRITE1(dst, 9, _A); WRITE2(dst, 10, _BC); break; case CASE(0, 0, 1, 1): WRITE2(dst, 6, _AB); WRITE4(dst, 8, _CABC); break; case CASE(1, 0, 1, 1): WRITE2(dst, 0, _AB); WRITE1(dst, 2, _C); WRITE2(dst, 6, _AB); WRITE4(dst, 8, _CABC); break; case CASE(0, 1, 1, 1): WRITE1(dst, 3, _A); WRITE4(dst, 4, _BCAB); WRITE4(dst, 8, _CABC); break; case CASE(1, 1, 1, 1): WRITE8(dst); WRITE4(dst, 8, _CABC); break; } bits = FbStipLeft(bits, n); n = 4; dst += 12; } dstLine += dstStride; } }
static void icvCalcDCTMatrix(work_t * cfs, int n) { static const double sqrt2 = 1.4142135623730950488016887242097; static const double pi = 3.1415926535897932384626433832795; static const double sincos[16 * 2] = { 1.00000000000000000, 0.00000000000000006, 0.70710678118654746, 0.70710678118654757, 0.49999999999999994, 0.86602540378443871, 0.38268343236508978, 0.92387953251128674, 0.30901699437494740, 0.95105651629515353, 0.25881904510252074, 0.96592582628906831, 0.22252093395631439, 0.97492791218182362, 0.19509032201612825, 0.98078528040323043, 0.17364817766693033, 0.98480775301220802, 0.15643446504023087, 0.98768834059513777, 0.14231483827328514, 0.98982144188093268, 0.13052619222005157, 0.99144486137381038, 0.12053668025532305, 0.99270887409805397, 0.11196447610330786, 0.99371220989324260, 0.10452846326765346, 0.99452189536827329, 0.09801714032956060, 0.99518472667219693, }; #define ROTATE(c, s, dc, ds) \ { \ t = c*dc - s*ds; \ s = c*ds + s*dc; \ c = t; \ } #define WRITE2(j, a, b) \ { \ cfs[j] = SCALE(a); \ cfs2[j] = SCALE(b); \ } double t, scale = 1. / sqrt( (double)n ); int i, j, m = n / 2; cfs[0] = SCALE( scale ); scale *= sqrt2; cfs[1] = SCALE( scale ); cfs += 2 - m; // n为输入DCT的长或宽,12 if (n > 1) { double a0, b0; double da0, db0; work_t *cfs2 = cfs + m * n; if( n <= 16 ) { da0 = a0 = sincos[2 * n - 1]; db0 = b0 = sincos[2 * n - 2]; } else { t = pi / (2 * n); da0 = a0 = cos( t ); db0 = b0 = sin( t ); } // 其它行,m=n/2 /* other rows */ for (i = 1; i <= m; i++) { double a = a0 * scale; double b = b0 * scale; double da = a0 * a0 - b0 * b0; double db = a0 * b0 + a0 * b0; cfs += m; cfs2 -= m; for (j = 0; j < m; j += 2) { WRITE2( j, a, b ); ROTATE( a, b, da, db ); if (j + 1 < m) { WRITE2( j + 1, a, -b ); ROTATE( a, b, da, db ); } } ROTATE( a0, b0, da0, db0 ); } } #undef ROTATE #undef WRITE2 }
double __kernel_standard(double x, double y, int type) { struct exception exc; #ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */ #define HUGE_VAL inf double inf = 0.0; SET_HIGH_WORD(inf,0x7ff00000); /* set inf to infinite */ #endif #ifdef _USE_WRITE (void) fflush(stdout); #endif exc.arg1 = x; exc.arg2 = y; switch(type) { case 1: case 101: case 201: /* acos(|x|>1) */ exc.type = DOMAIN; exc.name = type < 100 ? "acos" : (type < 200 ? "acosf" : "acosl");; if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else exc.retval = NAN; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if(_LIB_VERSION == _SVID_) { (void) WRITE2("acos: DOMAIN error\n", 19); } __set_errno (EDOM); } break; case 2: case 102: case 202: /* asin(|x|>1) */ exc.type = DOMAIN; exc.name = type < 100 ? "asin" : (type < 200 ? "asinf" : "asinl"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else exc.retval = NAN; if(_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if(_LIB_VERSION == _SVID_) { (void) WRITE2("asin: DOMAIN error\n", 19); } __set_errno (EDOM); } break; case 3: case 103: case 203: /* atan2(+-0,+-0) */ exc.arg1 = y; exc.arg2 = x; exc.type = DOMAIN; exc.name = type < 100 ? "atan2" : (type < 200 ? "atan2f" : "atan2l"); assert (_LIB_VERSION == _SVID_); exc.retval = HUGE; if(_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if(_LIB_VERSION == _SVID_) { (void) WRITE2("atan2: DOMAIN error\n", 20); } __set_errno (EDOM); } break; case 4: case 104: case 204: /* hypot(finite,finite) overflow */ exc.type = OVERFLOW; exc.name = type < 100 ? "hypot" : (type < 200 ? "hypotf" : "hypotl"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 5: case 105: case 205: /* cosh(finite) overflow */ exc.type = OVERFLOW; exc.name = type < 100 ? "cosh" : (type < 200 ? "coshf" : "coshl"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 6: case 106: case 206: /* exp(finite) overflow */ exc.type = OVERFLOW; exc.name = type < 100 ? "exp" : (type < 200 ? "expf" : "expl"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 7: case 107: case 207: /* exp(finite) underflow */ exc.type = UNDERFLOW; exc.name = type < 100 ? "exp" : (type < 200 ? "expf" : "expl"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 8: case 108: case 208: /* y0(0) = -inf */ exc.type = DOMAIN; /* should be SING for IEEE */ exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("y0: DOMAIN error\n", 17); } __set_errno (EDOM); } break; case 9: case 109: case 209: /* y0(x<0) = NaN */ exc.type = DOMAIN; exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("y0: DOMAIN error\n", 17); } __set_errno (EDOM); } break; case 10: case 110: case 210: /* y1(0) = -inf */ exc.type = DOMAIN; /* should be SING for IEEE */ exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("y1: DOMAIN error\n", 17); } __set_errno (EDOM); } break; case 11: case 111: case 211: /* y1(x<0) = NaN */ exc.type = DOMAIN; exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("y1: DOMAIN error\n", 17); } __set_errno (EDOM); } break; case 12: case 112: case 212: /* yn(n,0) = -inf */ exc.type = DOMAIN; /* should be SING for IEEE */ exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("yn: DOMAIN error\n", 17); } __set_errno (EDOM); } break; case 13: case 113: case 213: /* yn(x<0) = NaN */ exc.type = DOMAIN; exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("yn: DOMAIN error\n", 17); } __set_errno (EDOM); } break; case 14: case 114: case 214: /* lgamma(finite) overflow */ exc.type = OVERFLOW; exc.name = type < 100 ? "lgamma" : (type < 200 ? "lgammaf" : "lgammal"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 15: case 115: case 215: /* lgamma(-integer) or lgamma(0) */ exc.type = SING; exc.name = type < 100 ? "lgamma" : (type < 200 ? "lgammaf" : "lgammal"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("lgamma: SING error\n", 19); } __set_errno (EDOM); } break; case 16: case 116: case 216: /* log(0) */ exc.type = SING; exc.name = type < 100 ? "log" : (type < 200 ? "logf" : "logl"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("log: SING error\n", 16); } __set_errno (EDOM); } break; case 17: case 117: case 217: /* log(x<0) */ exc.type = DOMAIN; exc.name = type < 100 ? "log" : (type < 200 ? "logf" : "logl"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else exc.retval = NAN; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("log: DOMAIN error\n", 18); } __set_errno (EDOM); } break; case 18: case 118: case 218: /* log10(0) */ exc.type = SING; exc.name = type < 100 ? "log10" : (type < 200 ? "log10f" : "log10l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("log10: SING error\n", 18); } __set_errno (EDOM); } break; case 19: case 119: case 219: /* log10(x<0) */ exc.type = DOMAIN; exc.name = type < 100 ? "log10" : (type < 200 ? "log10f" : "log10l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else exc.retval = NAN; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("log10: DOMAIN error\n", 20); } __set_errno (EDOM); } break; case 20: case 120: case 220: /* pow(0.0,0.0) */ /* error only if _LIB_VERSION == _SVID_ */ exc.type = DOMAIN; exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); exc.retval = zero; if (_LIB_VERSION != _SVID_) exc.retval = 1.0; else if (!matherr(&exc)) { (void) WRITE2("pow(0,0): DOMAIN error\n", 23); __set_errno (EDOM); } break; case 21: case 121: case 221: /* pow(x,y) overflow */ exc.type = OVERFLOW; exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); if (_LIB_VERSION == _SVID_) { exc.retval = HUGE; y *= 0.5; if(x<zero&&__rint(y)!=y) exc.retval = -HUGE; } else { exc.retval = HUGE_VAL; y *= 0.5; if(x<zero&&__rint(y)!=y) exc.retval = -HUGE_VAL; } if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 22: case 122: case 222: /* pow(x,y) underflow */ exc.type = UNDERFLOW; exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); exc.retval = zero; y *= 0.5; if (x < zero && __rint (y) != y) exc.retval = -zero; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 23: case 123: case 223: /* -0**neg */ exc.type = DOMAIN; exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); if (_LIB_VERSION == _SVID_) exc.retval = zero; else exc.retval = -HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("pow(0,neg): DOMAIN error\n", 25); } __set_errno (EDOM); } break; case 43: case 143: case 243: /* +0**neg */ exc.type = DOMAIN; exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); if (_LIB_VERSION == _SVID_) exc.retval = zero; else exc.retval = HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("pow(0,neg): DOMAIN error\n", 25); } __set_errno (EDOM); } break; case 24: case 124: case 224: /* neg**non-integral */ exc.type = DOMAIN; exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); if (_LIB_VERSION == _SVID_) exc.retval = zero; else exc.retval = zero/zero; /* X/Open allow NaN */ if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("neg**non-integral: DOMAIN error\n", 32); } __set_errno (EDOM); } break; case 25: case 125: case 225: /* sinh(finite) overflow */ exc.type = OVERFLOW; exc.name = type < 100 ? "sinh" : (type < 200 ? "sinhf" : "sinhl"); if (_LIB_VERSION == _SVID_) exc.retval = ( (x>zero) ? HUGE : -HUGE); else exc.retval = ( (x>zero) ? HUGE_VAL : -HUGE_VAL); if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 26: case 126: case 226: /* sqrt(x<0) */ exc.type = DOMAIN; exc.name = type < 100 ? "sqrt" : (type < 200 ? "sqrtf" : "sqrtl"); if (_LIB_VERSION == _SVID_) exc.retval = zero; else exc.retval = zero/zero; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("sqrt: DOMAIN error\n", 19); } __set_errno (EDOM); } break; case 27: case 127: case 227: /* fmod(x,0) */ exc.type = DOMAIN; exc.name = type < 100 ? "fmod" : (type < 200 ? "fmodf" : "fmodl"); if (_LIB_VERSION == _SVID_) exc.retval = x; else exc.retval = zero/zero; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("fmod: DOMAIN error\n", 20); } __set_errno (EDOM); } break; case 28: case 128: case 228: /* remainder(x,0) */ exc.type = DOMAIN; exc.name = type < 100 ? "remainder" : (type < 200 ? "remainderf" : "remainderl"); exc.retval = zero/zero; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("remainder: DOMAIN error\n", 24); } __set_errno (EDOM); } break; case 29: case 129: case 229: /* acosh(x<1) */ exc.type = DOMAIN; exc.name = type < 100 ? "acosh" : (type < 200 ? "acoshf" : "acoshl"); exc.retval = zero/zero; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("acosh: DOMAIN error\n", 20); } __set_errno (EDOM); } break; case 30: case 130: case 230: /* atanh(|x|>1) */ exc.type = DOMAIN; exc.name = type < 100 ? "atanh" : (type < 200 ? "atanhf" : "atanhl"); exc.retval = zero/zero; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("atanh: DOMAIN error\n", 20); } __set_errno (EDOM); } break; case 31: case 131: case 231: /* atanh(|x|=1) */ exc.type = SING; exc.name = type < 100 ? "atanh" : (type < 200 ? "atanhf" : "atanhl"); exc.retval = x/zero; /* sign(x)*inf */ if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("atanh: SING error\n", 18); } __set_errno (EDOM); } break; case 32: case 132: case 232: /* scalb overflow; SVID also returns +-HUGE_VAL */ exc.type = OVERFLOW; exc.name = type < 100 ? "scalb" : (type < 200 ? "scalbf" : "scalbl"); exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 33: case 133: case 233: /* scalb underflow */ exc.type = UNDERFLOW; exc.name = type < 100 ? "scalb" : (type < 200 ? "scalbf" : "scalbl"); exc.retval = __copysign(zero,x); if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 34: case 134: case 234: /* j0(|x|>X_TLOSS) */ exc.type = TLOSS; exc.name = type < 100 ? "j0" : (type < 200 ? "j0f" : "j0l"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2(exc.name, 2); (void) WRITE2(": TLOSS error\n", 14); } __set_errno (ERANGE); } break; case 35: case 135: case 235: /* y0(x>X_TLOSS) */ exc.type = TLOSS; exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2(exc.name, 2); (void) WRITE2(": TLOSS error\n", 14); } __set_errno (ERANGE); } break; case 36: case 136: case 236: /* j1(|x|>X_TLOSS) */ exc.type = TLOSS; exc.name = type < 100 ? "j1" : (type < 200 ? "j1f" : "j1l"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2(exc.name, 2); (void) WRITE2(": TLOSS error\n", 14); } __set_errno (ERANGE); } break; case 37: case 137: case 237: /* y1(x>X_TLOSS) */ exc.type = TLOSS; exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2(exc.name, 2); (void) WRITE2(": TLOSS error\n", 14); } __set_errno (ERANGE); } break; case 38: case 138: case 238: /* jn(|x|>X_TLOSS) */ exc.type = TLOSS; exc.name = type < 100 ? "jn" : (type < 200 ? "jnf" : "jnl"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2(exc.name, 2); (void) WRITE2(": TLOSS error\n", 14); } __set_errno (ERANGE); } break; case 39: case 139: case 239: /* yn(x>X_TLOSS) */ exc.type = TLOSS; exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2(exc.name, 2); (void) WRITE2(": TLOSS error\n", 14); } __set_errno (ERANGE); } break; case 40: case 140: case 240: /* tgamma(finite) overflow */ exc.type = OVERFLOW; exc.name = type < 100 ? "tgamma" : (type < 200 ? "tgammaf" : "tgammal"); exc.retval = HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 41: case 141: case 241: /* tgamma(-integer) */ exc.type = SING; exc.name = type < 100 ? "tgamma" : (type < 200 ? "tgammaf" : "tgammal"); exc.retval = NAN; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { (void) WRITE2("tgamma: SING error\n", 18); exc.retval = HUGE_VAL; } __set_errno (EDOM); } break; case 42: case 142: case 242: /* pow(NaN,0.0) */ /* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */ exc.type = DOMAIN; exc.name = type < 100 ? "pow" : (type < 200 ? "powf" : "powl"); exc.retval = x; if (_LIB_VERSION == _IEEE_ || _LIB_VERSION == _POSIX_) exc.retval = 1.0; else if (!matherr(&exc)) { __set_errno (EDOM); } break; case 44: case 144: case 244: /* exp(finite) overflow */ exc.type = OVERFLOW; exc.name = type < 100 ? "exp2" : (type < 200 ? "exp2f" : "exp2l"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 45: case 145: case 245: /* exp(finite) underflow */ exc.type = UNDERFLOW; exc.name = type < 100 ? "exp2" : (type < 200 ? "exp2f" : "exp2l"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 46: case 146: case 246: /* exp(finite) overflow */ exc.type = OVERFLOW; exc.name = type < 100 ? "exp10" : (type < 200 ? "exp10f" : "exp10l"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 47: case 147: case 247: /* exp(finite) underflow */ exc.type = UNDERFLOW; exc.name = type < 100 ? "exp10" : (type < 200 ? "exp10f" : "exp10l"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (ERANGE); } break; case 48: case 148: case 248: /* log2(0) */ exc.type = SING; exc.name = type < 100 ? "log2" : (type < 200 ? "log2f" : "log2l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { __set_errno (EDOM); } break; case 49: case 149: case 249: /* log2(x<0) */ exc.type = DOMAIN; exc.name = type < 100 ? "log2" : (type < 200 ? "log2f" : "log2l"); if (_LIB_VERSION == _SVID_) exc.retval = -HUGE; else exc.retval = NAN; if (_LIB_VERSION == _POSIX_) __set_errno (EDOM); else if (!matherr(&exc)) { __set_errno (EDOM); } break; case 50: case 150: case 250: /* tgamma(+-0) */ exc.type = SING; exc.name = type < 100 ? "tgamma" : (type < 200 ? "tgammaf" : "tgammal"); exc.retval = __copysign (HUGE_VAL, x); if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) (void) WRITE2("tgamma: SING error\n", 18); __set_errno (ERANGE); } break; /* #### Last used is 50/150/250 ### */ } return exc.retval; }
double __kernel_standard(double x, double y, int type) { struct exception exc; #ifdef CYGSEM_LIBM_USE_STDERR (void) fflush(stdout); #endif exc.arg1 = x; exc.arg2 = y; switch(type) { case 1: /* acos(|x|>1) */ exc.type = DOMAIN; exc.name = "acos"; exc.retval = zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("acos: DOMAIN error\n", 19); } errno = EDOM; } break; case 2: /* asin(|x|>1) */ exc.type = DOMAIN; exc.name = "asin"; exc.retval = zero; if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("asin: DOMAIN error\n", 19); } errno = EDOM; } break; case 3: /* atan2(+-0,+-0) */ exc.arg1 = y; exc.arg2 = x; exc.type = DOMAIN; exc.name = "atan2"; exc.retval = zero; if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("atan2: DOMAIN error\n", 20); } errno = EDOM; } break; case 4: /* hypot(finite,finite) overflow */ exc.type = OVERFLOW; exc.name = "hypot"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; case 5: /* cosh(finite) overflow */ exc.type = OVERFLOW; exc.name = "cosh"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; case 6: /* exp(finite) overflow */ exc.type = OVERFLOW; exc.name = "exp"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; case 7: /* exp(finite) underflow */ exc.type = UNDERFLOW; exc.name = "exp"; exc.retval = zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; case 8: /* y0(0) = -inf */ exc.type = DOMAIN; /* should be SING for IEEE */ exc.name = "y0"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("y0: DOMAIN error\n", 17); } errno = EDOM; } break; case 9: /* y0(x<0) = NaN */ exc.type = DOMAIN; exc.name = "y0"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("y0: DOMAIN error\n", 17); } errno = EDOM; } break; case 10: /* y1(0) = -inf */ exc.type = DOMAIN; /* should be SING for IEEE */ exc.name = "y1"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("y1: DOMAIN error\n", 17); } errno = EDOM; } break; case 11: /* y1(x<0) = NaN */ exc.type = DOMAIN; exc.name = "y1"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("y1: DOMAIN error\n", 17); } errno = EDOM; } break; case 12: /* yn(n,0) = -inf */ exc.type = DOMAIN; /* should be SING for IEEE */ exc.name = "yn"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("yn: DOMAIN error\n", 17); } errno = EDOM; } break; case 13: /* yn(x<0) = NaN */ exc.type = DOMAIN; exc.name = "yn"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("yn: DOMAIN error\n", 17); } errno = EDOM; } break; case 14: /* lgamma(finite) overflow */ exc.type = OVERFLOW; exc.name = "lgamma"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; case 15: /* lgamma(-integer) or lgamma(0) */ exc.type = SING; exc.name = "lgamma"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("lgamma: SING error\n", 19); } errno = EDOM; } break; case 16: /* log(0) */ exc.type = SING; exc.name = "log"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("log: SING error\n", 16); } errno = EDOM; } break; case 17: /* log(x<0) */ exc.type = DOMAIN; exc.name = "log"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("log: DOMAIN error\n", 18); } errno = EDOM; } break; case 18: /* log10(0) */ exc.type = SING; exc.name = "log10"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("log10: SING error\n", 18); } errno = EDOM; } break; case 19: /* log10(x<0) */ exc.type = DOMAIN; exc.name = "log10"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = -HUGE; else exc.retval = -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("log10: DOMAIN error\n", 20); } errno = EDOM; } break; case 20: /* pow(0.0,0.0) */ /* error only if cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID */ exc.type = DOMAIN; exc.name = "pow"; exc.retval = zero; if (cyg_libm_get_compat_mode() != CYGNUM_LIBM_COMPAT_SVID) exc.retval = 1.0; else if (!matherr(&exc)) { (void) WRITE2("pow(0,0): DOMAIN error\n", 23); errno = EDOM; } break; case 21: /* pow(x,y) overflow */ exc.type = OVERFLOW; exc.name = "pow"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { exc.retval = HUGE; y *= 0.5; if(x<zero&&rint(y)!=y) exc.retval = -HUGE; } else { exc.retval = HUGE_VAL; y *= 0.5; if(x<zero&&rint(y)!=y) exc.retval = -HUGE_VAL; } if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; case 22: /* pow(x,y) underflow */ exc.type = UNDERFLOW; exc.name = "pow"; exc.retval = zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; case 23: /* 0**neg */ exc.type = DOMAIN; exc.name = "pow"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = zero; else exc.retval = -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("pow(0,neg): DOMAIN error\n", 25); } errno = EDOM; } break; case 24: /* neg**non-integral */ exc.type = DOMAIN; exc.name = "pow"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = zero; else exc.retval = zero/zero; /* X/Open allow NaN */ if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("neg**non-integral: DOMAIN error\n", 32); } errno = EDOM; } break; case 25: /* sinh(finite) overflow */ exc.type = OVERFLOW; exc.name = "sinh"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = ( (x>zero) ? HUGE : -HUGE); else exc.retval = ( (x>zero) ? HUGE_VAL : -HUGE_VAL); if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; case 26: /* sqrt(x<0) */ exc.type = DOMAIN; exc.name = "sqrt"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = zero; else exc.retval = zero/zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("sqrt: DOMAIN error\n", 19); } errno = EDOM; } break; case 27: /* fmod(x,0) */ exc.type = DOMAIN; exc.name = "fmod"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = x; else exc.retval = zero/zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("fmod: DOMAIN error\n", 20); } errno = EDOM; } break; case 28: /* remainder(x,0) */ exc.type = DOMAIN; exc.name = "remainder"; exc.retval = zero/zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("remainder: DOMAIN error\n", 24); } errno = EDOM; } break; case 29: /* acosh(x<1) */ exc.type = DOMAIN; exc.name = "acosh"; exc.retval = zero/zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("acosh: DOMAIN error\n", 20); } errno = EDOM; } break; case 30: /* atanh(|x|>1) */ exc.type = DOMAIN; exc.name = "atanh"; exc.retval = zero/zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("atanh: DOMAIN error\n", 20); } errno = EDOM; } break; case 31: /* atanh(|x|=1) */ exc.type = SING; exc.name = "atanh"; exc.retval = x/zero; /* sign(x)*inf */ if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("atanh: SING error\n", 18); } errno = EDOM; } break; case 32: /* scalb overflow; SVID also returns +-HUGE_VAL */ exc.type = OVERFLOW; exc.name = "scalb"; exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; case 33: /* scalb underflow */ exc.type = UNDERFLOW; exc.name = "scalb"; exc.retval = copysign(zero,x); if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; case 34: /* j0(|x|>X_TLOSS) */ exc.type = TLOSS; exc.name = "j0"; exc.retval = zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2(exc.name, 2); (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; } break; case 35: /* y0(x>X_TLOSS) */ exc.type = TLOSS; exc.name = "y0"; exc.retval = zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2(exc.name, 2); (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; } break; case 36: /* j1(|x|>X_TLOSS) */ exc.type = TLOSS; exc.name = "j1"; exc.retval = zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2(exc.name, 2); (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; } break; case 37: /* y1(x>X_TLOSS) */ exc.type = TLOSS; exc.name = "y1"; exc.retval = zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2(exc.name, 2); (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; } break; case 38: /* jn(|x|>X_TLOSS) */ exc.type = TLOSS; exc.name = "jn"; exc.retval = zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2(exc.name, 2); (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; } break; case 39: /* yn(x>X_TLOSS) */ exc.type = TLOSS; exc.name = "yn"; exc.retval = zero; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2(exc.name, 2); (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; } break; case 40: /* gamma(finite) overflow */ exc.type = OVERFLOW; exc.name = "gamma"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; case 41: /* gamma(-integer) or gamma(0) */ exc.type = SING; exc.name = "gamma"; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) exc.retval = HUGE; else exc.retval = HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = EDOM; else if (!matherr(&exc)) { if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID) { (void) WRITE2("gamma: SING error\n", 18); } errno = EDOM; } break; case 42: /* pow(NaN,0.0) */ /* error only if cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_SVID & CYGNUM_LIBM_COMPAT_XOPEN */ exc.type = DOMAIN; exc.name = "pow"; exc.retval = x; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE || cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) exc.retval = 1.0; else if (!matherr(&exc)) { errno = EDOM; } break; case 43: /* ldexp overflow; SVID also returns +-HUGE_VAL */ exc.type = OVERFLOW; exc.name = "ldexp"; exc.retval = x > zero ? HUGE_VAL : -HUGE_VAL; if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; case 44: /* ldexp underflow */ exc.type = UNDERFLOW; exc.name = "ldexp"; exc.retval = copysign(zero,x); if (cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_POSIX) errno = ERANGE; else if (!matherr(&exc)) { errno = ERANGE; } break; } return exc.retval; }
void Pref::save() const { Record r(PREF_GROUP); #define WRITE(a) r.write(a, #a) WRITE(fit_to_video); WRITE(remember_stopped); WRITE(ask_record_found); WRITE(pause_minimized); WRITE(pause_video_only); WRITE(hide_cursor); WRITE(hide_cursor_fs_only); WRITE(hide_cursor_delay); WRITE(enable_system_tray); WRITE(hide_rather_close); QList<QByteArray> restore_properties; restore_properties.reserve(this->restore_properties.size()); for (auto &property : this->restore_properties) restore_properties.append(property.name()); WRITE(restore_properties); WRITE(invert_wheel); WRITE(disable_screensaver); WRITE(sub_enc); WRITE(sub_priority); WRITE(sub_enc_autodetection); WRITE(sub_enc_accuracy); WRITE(ms_per_char); WRITE(seek_step1); WRITE(seek_step2); WRITE(seek_step3); WRITE(speed_step); WRITE(volume_step); WRITE(amp_step); WRITE(sub_pos_step); WRITE(volume_step); WRITE(sub_sync_step); WRITE(brightness_step); WRITE(saturation_step); WRITE(contrast_step); WRITE(hue_step); WRITE(sub_ext); WRITE(blur_kern_c); WRITE(blur_kern_n); WRITE(blur_kern_d); WRITE(sharpen_kern_c); WRITE(sharpen_kern_n); WRITE(sharpen_kern_d); WRITE(remap_luma_min); WRITE(remap_luma_max); WRITE(channel_manipulation); WRITE(enable_generate_playist); WRITE(sub_enable_autoload); WRITE(sub_enable_autoselect); WRITE(generate_playlist); WRITE(sub_autoload); WRITE(sub_autoselect); WRITE(enable_hwaccel); WRITE(skin_name); WRITE(hwaccel_codecs); WRITE(hwdeints); r.write(HwAcc::backendName(hwaccel_backend), "hwaccel_backend"); WRITE(normalizer_silence); WRITE(normalizer_target); WRITE(normalizer_min); WRITE(normalizer_max); WRITE(lion_style_fullscreen); WRITE(show_logo); WRITE(bg_color); WRITE(deint_hwdec); WRITE(deint_swdec); WRITE(audio_driver); WRITE(clipping_method); WRITE(cache_local); WRITE(cache_disc); WRITE(cache_network); WRITE(cache_min_playback); WRITE(cache_min_seeking); WRITE(network_folders); WRITE(use_mpris2); #undef WRITE #define WRITE2(a) a.save(r, #a); WRITE2(open_media_from_file_manager); WRITE2(open_media_by_drag_and_drop); WRITE2(sub_style); WRITE2(double_click_map); WRITE2(middle_click_map); WRITE2(wheel_scroll_map); #undef WRITE2 r.beginWriteArray("shortcuts", shortcuts.size()); auto it = shortcuts.cbegin(); for (int i=0; it != shortcuts.cend(); ++it, ++i) { r.setArrayIndex(i); r.setValue("id", it.key()); r.setValue("keys", toStringList(it.value())); } r.endArray(); r.setValue("version", Info::versionNumber()); }