Testing: Add new tests, and new ways of testing, for floating-point.
- Adds a pragma to see binary output of double values (not portable) - Print decimals that show more values, but in a portable way (lots of portability issues) - Expand the tests to test more double values Note: it is quite difficult to have 100% portable tests for floating point. The current situation works by not printing full precision, and working around several portability issues.
This commit is contained in:
parent
8e4b496d4a
commit
1ea1b13f38
11 changed files with 1161 additions and 78 deletions
18
Test/cppPassMacroName.frag
Normal file → Executable file
18
Test/cppPassMacroName.frag
Normal file → Executable file
|
|
@ -2,6 +2,10 @@
|
|||
#define I2(f, n) f(n) + f(n+1)
|
||||
#define I3(f, n) I2(f, n) + f(n+2)
|
||||
|
||||
#define FL_f1(i) ((i)*(i))
|
||||
#define FL_I2(f, n) f(n) + f(n+0.2)
|
||||
#define FL_I3(f, n) FL_I2(f, n) + f(n+0.5)
|
||||
|
||||
void main()
|
||||
{
|
||||
int f1 = 4;
|
||||
|
|
@ -9,4 +13,18 @@ void main()
|
|||
int f3 = f1(3);
|
||||
int f4 = I2(f1, 0);
|
||||
int f5 = I3(f1, 0);
|
||||
|
||||
highp float fl_f5 = FL_I3(FL_f1, 0.1);
|
||||
}
|
||||
|
||||
// f5 = I3(f1, 0)
|
||||
// = I2(f1, 0) + f1(0 + 2)
|
||||
// = f1(0) + f1(0+1) + f1(0+2)
|
||||
// = 0*0 + 1*1 + 2*2
|
||||
// = 5
|
||||
|
||||
// fl_f5 = FL_I3(FL_f1, 0.1)
|
||||
// = FL_I2(FL_f1, 0.1) + FL_f1(0.1 + 0.5)
|
||||
// = FL_f1(0.1) + FL_f1(0.1 + 0.2) + FL_f1(0.1 + 0.5)
|
||||
// = 0.1*0.1 + 0.3*0.3 + 0.6*0.6
|
||||
// = 0.46
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue