📄 x-cvsweb-markup(60)
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><!-- hennerik CVSweb $Revision: 1.93 $ --><TITLE>glibc.dead/soft-fp/testit.c - view - 1.1.1.1</TITLE></HEAD><BODY BGCOLOR="#eeeeee"><table width="100%" border=0 cellspacing=0 cellpadding=1 bgcolor="#9999ee"><tr valign=bottom><td><a href="testit.c#rev1.1.1.1"><IMG SRC="/icons/back.gif" ALT="[BACK]" BORDER="0" WIDTH="20" HEIGHT="22"></a> <b>Return to <A HREF="testit.c#rev1.1.1.1">testit.c</A> CVS log</b> <IMG SRC="/icons/text.gif" ALT="[TXT]" BORDER="0" WIDTH="20" HEIGHT="22"></td><td align=right><IMG SRC="/icons/dir.gif" ALT="[DIR]" BORDER="0" WIDTH="20" HEIGHT="22"> <b>Up to <a href="/cgi-bin/cvsweb.cgi/#dirlist">[Development]</a> / <a href="/cgi-bin/cvsweb.cgi/glibc.dead/#dirlist">glibc.dead</a> / <a href="/cgi-bin/cvsweb.cgi/glibc.dead/soft-fp/#dirlist">soft-fp</a></b></td></tr></table><HR noshade><table width="100%"><tr><td bgcolor="#ffffff">File: <a href="/cgi-bin/cvsweb.cgi/#dirlist">[Development]</a> / <a href="/cgi-bin/cvsweb.cgi/glibc.dead/#dirlist">glibc.dead</a> / <a href="/cgi-bin/cvsweb.cgi/glibc.dead/soft-fp/#dirlist">soft-fp</a> / <a href="/cgi-bin/cvsweb.cgi/glibc.dead/soft-fp/testit.c">testit.c</a> (<A HREF="/cgi-bin/cvsweb.cgi/~checkout~/glibc.dead/soft-fp/testit.c?rev=1.1.1.1" target="cvs_checkout" onClick="window.open('/cgi-bin/cvsweb.cgi/~checkout~/glibc.dead/soft-fp/testit.c?rev=1.1.1.1','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>)<BR>Revision <B>1.1.1.1</B> <i>(vendor branch)</i>, <i>Thu Nov 2 14:15:16 2000 UTC</i> (4 years, 1 month ago) by <i>aj</i><BR>Branch: <b>glibc-2001-09-13, MAIN</b><BR>CVS Tags: <b>x86_64versionl20, x86_64versionl1, x86_64versiong4, x86_64versiong31-branch, x86_64versiong31, x86_64versiong3, start, pre-merge-2001-08-02, pre-merge-2001-06-29, pre-merge-2001-04-19, pre-merge-2001-03-22, glibc-pre-merge-2001-09-13, glibc-pre-import-20010403, glibc-20010430, glibc-20010322, glibc-20010212, glibc-2001-08-02, glibc-2001-06-29, glibc-2001-04-17, glibc-2001-03-06, glibc-2001-02-20, glibc-2001-02-15, glibc-2001-01-24, glibc-2001-01-17, glibc-2001-01-04, glibc-2000-11-02, HEAD, GLIBC_MAIN</b><BR>Changes since <b>1.1: +0 -0 lines</b><PRE>Import glibc 2000-11-02</PRE></td></tr></table><HR noshade><PRE>#include <stdio.h>#include <stdlib.h>#include <math.h>#include "soft-fp.h"#include "single.h"#include "double.h"#include <fpu_control.h>/*======================================================================*//* declarations for the functions we are testing */double __adddf3(double, double);double __subdf3(double, double);double __muldf3(double, double);double __divdf3(double, double);double __negdf2(double);double __sqrtdf2(double);double __negdf3(double a, double dummy) { return __negdf2(a); }double __sqrtdf3(double a, double dummy) { return __sqrtdf2(a); }float __addsf3(float, float);float __subsf3(float, float);float __mulsf3(float, float);float __divsf3(float, float);float __negsf2(float);float __sqrtsf2(float);float __negsf3(float a, float dummy) { return __negsf2(a); }float __sqrtsf3(float a, float dummy) { return __sqrtsf2(a); }int __fixdfsi(double);int __fixsfsi(float);double __floatsidf(int);float __floatsisf(int);double __extendsfdf2(float);float __truncdfsf2(double);int __eqdf2(double, double);int __nedf2(double, double);int __gtdf2(double, double);int __gedf2(double, double);int __ltdf2(double, double);int __ledf2(double, double);int __eqsf2(float, float);int __nesf2(float, float);int __gtsf2(float, float);int __gesf2(float, float);int __ltsf2(float, float);int __lesf2(float, float);/*======================================================================*//* definitions for functions we are checking against */double r_adddf3(double a, double b) { return a + b; }double r_subdf3(double a, double b) { return a - b; }double r_muldf3(double a, double b) { return a * b; }double r_divdf3(double a, double b) { return a / b; }double r_negdf3(double a, double b) { return -a; }double sqrt(double x);double r_sqrtdf3(double a, double b) { return sqrt(a); }float r_addsf3(float a, float b) { return a + b; }float r_subsf3(float a, float b) { return a - b; }float r_mulsf3(float a, float b) { return a * b; }float r_divsf3(float a, float b) { return a / b; }float r_negsf3(float a, float b) { return -a; }float sqrtf(float x);float r_sqrtsf3(float a, float b) { return sqrtf(a); }int r_fixdfsi(double a) { return (int)a; }int r_fixsfsi(float a) { return (int)a; }double r_floatsidf(int a) { return (double)a; }float r_floatsisf(int a) { return (float)a; }double r_extendsfdf2(float a) { return (double)a; }float r_truncdfsf2(double a) { return (float)a; }int r_eqdf2(double a, double b) { return !(a == b); }int r_nedf2(double a, double b) { return a != b; }int r_gtdf2(double a, double b) { return a > b; }int r_gedf2(double a, double b) { return (a >= b) - 1; }int r_ltdf2(double a, double b) { return -(a < b); }int r_ledf2(double a, double b) { return 1 - (a <= b); }int r_eqsf2(float a, float b) { return !(a == b); }int r_nesf2(float a, float b) { return a != b; }int r_gtsf2(float a, float b) { return a > b; }int r_gesf2(float a, float b) { return (a >= b) - 1; }int r_ltsf2(float a, float b) { return -(a < b); }int r_lesf2(float a, float b) { return 1 - (a <= b); }/*======================================================================*/void print_float(float x){ union _FP_UNION_S ux; ux.flt = x; printf("%-20.8e %X %02X %06lX", x, ux.bits.sign, ux.bits.exp, (unsigned long)ux.bits.frac);}void print_double(double x){ union _FP_UNION_D ux; ux.flt = x;#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D printf("%-30.18e %X %04X %06lX%08lX", x, ux.bits.sign, ux.bits.exp, (unsigned long)ux.bits.frac1, (unsigned long)ux.bits.frac0);#else printf("%-30.18e %X %04X %014lX", x, ux.bits.sign, ux.bits.exp, (unsigned long)ux.bits.frac);#endif}float rand_float(void){ union { union _FP_UNION_S u; int i; } u; u.i = lrand48() << 1; if (u.u.bits.exp == _FP_EXPMAX_S) u.u.bits.exp--; else if (u.u.bits.exp == 0 && u.u.bits.frac != 0) u.u.bits.exp++; return u.u.flt;}double rand_double(void){ union { union _FP_UNION_D u; int i[2]; } u; u.i[0] = lrand48() << 1; u.i[1] = lrand48() << 1; if (u.u.bits.exp == _FP_EXPMAX_D) u.u.bits.exp--;#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D else if (u.u.bits.exp == 0 && !(u.u.bits.frac0 == 0 && u.u.bits.frac1 == 0)) u.u.bits.exp++;#else else if (u.u.bits.exp == 0 && u.u.bits.frac != 0) u.u.bits.exp++;#endif return u.u.flt;}#define NSPECIALS 10float gen_special_float(int i){ FP_DECL_EX; FP_DECL_S(X); float x; switch (i & ~1) { case 0: X_c = FP_CLS_NAN; X_f = 0x1234; break; case 2: X_c = FP_CLS_NAN; X_f = 0x1; break; case 4: X_c = FP_CLS_INF; break; case 6: X_c = FP_CLS_ZERO; break; case 8: X_c = FP_CLS_NORMAL; X_e = 0; X_f = 0x4321; break; } X_s = (i & 1); FP_PACK_S(x, X); return x;}double gen_special_double(int i){ FP_DECL_EX; FP_DECL_D(X); double x; switch (i & ~1) { case 0: X_c = FP_CLS_NAN;#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D __FP_FRAC_SET_2(X, _FP_QNANBIT_D, 0x1234);#else _FP_FRAC_SET_1(X, _FP_QNANBIT_D | 0x1234);#endif break; case 2: X_c = FP_CLS_NAN;#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D __FP_FRAC_SET_2(X, _FP_QNANBIT_D, 0x1);#else _FP_FRAC_SET_1(X, _FP_QNANBIT_D | 0x1);#endif break; case 4: X_c = FP_CLS_INF; break; case 6: X_c = FP_CLS_ZERO; break; case 8: X_c = FP_CLS_NORMAL; X_e = 0;#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D __FP_FRAC_SET_2(X, 0, 0x87654321);#else _FP_FRAC_SET_1(X, 0x87654321);#endif break; } X_s = (i & 1); FP_PACK_D(x, X); return x;}float build_float(const char *s, const char *e, const char *f){ union _FP_UNION_S u; u.bits.sign = strtoul(s, 0, 16); u.bits.exp = strtoul(e, 0, 16); u.bits.frac = strtoul(f, 0, 16); return u.flt;} double build_double(const char *s, const char *e, const char *f){ union _FP_UNION_D u; u.bits.sign = strtoul(s, 0, 16); u.bits.exp = strtoul(e, 0, 16);#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -