VirtualBox

source: vbox/trunk/src/libs/softfloat-3e/testfloat/source/test_abz_f128.c@ 99521

最後變更 在這個檔案從99521是 94551,由 vboxsync 提交於 3 年 前

libs/softfloat: Copied TestFloat-3e from vendor branch and to testfloat subdir. bugref:9898

  • 屬性 svn:eol-style 設為 native
檔案大小: 4.0 KB
 
1
2/*============================================================================
3
4This C source file is part of TestFloat, Release 3e, a package of programs for
5testing the correctness of floating-point arithmetic complying with the IEEE
6Standard for Floating-Point, by John R. Hauser.
7
8Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of
9California. All rights reserved.
10
11Redistribution and use in source and binary forms, with or without
12modification, are permitted provided that the following conditions are met:
13
14 1. Redistributions of source code must retain the above copyright notice,
15 this list of conditions, and the following disclaimer.
16
17 2. Redistributions in binary form must reproduce the above copyright notice,
18 this list of conditions, and the following disclaimer in the documentation
19 and/or other materials provided with the distribution.
20
21 3. Neither the name of the University nor the names of its contributors may
22 be used to endorse or promote products derived from this software without
23 specific prior written permission.
24
25THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
26EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
28DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
29DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
32ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
36=============================================================================*/
37
38#include <stdint.h>
39#include "platform.h"
40#include "softfloat.h"
41#include "genCases.h"
42#include "verCases.h"
43#include "writeCase.h"
44#include "testLoops.h"
45
46#ifdef FLOAT128
47
48#pragma STDC FENV_ACCESS ON
49
50void
51 test_abz_f128(
52 void trueFunction( const float128_t *, const float128_t *, float128_t * ),
53 void subjFunction( const float128_t *, const float128_t *, float128_t * )
54 )
55{
56 int count;
57 float128_t trueZ;
58 uint_fast8_t trueFlags;
59 float128_t subjZ;
60 uint_fast8_t subjFlags;
61
62 genCases_f128_ab_init();
63 genCases_writeTestsTotal( testLoops_forever );
64 verCases_errorCount = 0;
65 verCases_tenThousandsCount = 0;
66 count = 10000;
67 while ( ! genCases_done || testLoops_forever ) {
68 genCases_f128_ab_next();
69 *testLoops_trueFlagsPtr = 0;
70 trueFunction( &genCases_f128_a, &genCases_f128_b, &trueZ );
71 trueFlags = *testLoops_trueFlagsPtr;
72 testLoops_subjFlagsFunction();
73 subjFunction( &genCases_f128_a, &genCases_f128_b, &subjZ );
74 subjFlags = testLoops_subjFlagsFunction();
75 --count;
76 if ( ! count ) {
77 verCases_perTenThousand();
78 count = 10000;
79 }
80 if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) {
81 if (
82 ! verCases_checkNaNs
83 && (f128M_isSignalingNaN( &genCases_f128_a )
84 || f128M_isSignalingNaN( &genCases_f128_b ))
85 ) {
86 trueFlags |= softfloat_flag_invalid;
87 }
88 if (
89 verCases_checkNaNs
90 || ! f128M_isNaN( &trueZ )
91 || ! f128M_isNaN( &subjZ )
92 || f128M_isSignalingNaN( &subjZ )
93 || (trueFlags != subjFlags)
94 ) {
95 ++verCases_errorCount;
96 verCases_writeErrorFound( 10000 - count );
97 writeCase_ab_f128M( &genCases_f128_a, &genCases_f128_b );
98 writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags );
99 if ( verCases_errorCount == verCases_maxErrorCount ) break;
100 }
101 }
102 }
103 verCases_writeTestsPerformed( 10000 - count );
104
105}
106
107#endif
108
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette