Home | History | Annotate | Download | only in generated
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 // Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
     18 
     19 package android.renderscript.cts;
     20 
     21 import android.renderscript.Allocation;
     22 import android.renderscript.RSRuntimeException;
     23 import android.renderscript.Element;
     24 import android.renderscript.cts.Target;
     25 
     26 import java.util.Arrays;
     27 
     28 public class TestFract extends RSBaseCompute {
     29 
     30     private ScriptC_TestFract script;
     31     private ScriptC_TestFractRelaxed scriptRelaxed;
     32 
     33     @Override
     34     protected void setUp() throws Exception {
     35         super.setUp();
     36         script = new ScriptC_TestFract(mRS);
     37         scriptRelaxed = new ScriptC_TestFractRelaxed(mRS);
     38     }
     39 
     40     @Override
     41     protected void tearDown() throws Exception {
     42         script.destroy();
     43         scriptRelaxed.destroy();
     44         super.tearDown();
     45     }
     46 
     47     public class ArgumentsFloatFloatFloat {
     48         public float inV;
     49         public Target.Floaty outFloor;
     50         public Target.Floaty out;
     51     }
     52 
     53     private void checkFractFloatFloatFloat() {
     54         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x57d8e6573c675d27l, false);
     55         try {
     56             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
     57             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
     58             script.set_gAllocOutFloor(outFloor);
     59             script.forEach_testFractFloatFloatFloat(inV, out);
     60             verifyResultsFractFloatFloatFloat(inV, outFloor, out, false);
     61             outFloor.destroy();
     62             out.destroy();
     63         } catch (Exception e) {
     64             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloatFloatFloat: " + e.toString());
     65         }
     66         try {
     67             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
     68             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
     69             scriptRelaxed.set_gAllocOutFloor(outFloor);
     70             scriptRelaxed.forEach_testFractFloatFloatFloat(inV, out);
     71             verifyResultsFractFloatFloatFloat(inV, outFloor, out, true);
     72             outFloor.destroy();
     73             out.destroy();
     74         } catch (Exception e) {
     75             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloatFloatFloat: " + e.toString());
     76         }
     77         inV.destroy();
     78     }
     79 
     80     private void verifyResultsFractFloatFloatFloat(Allocation inV, Allocation outFloor, Allocation out, boolean relaxed) {
     81         float[] arrayInV = new float[INPUTSIZE * 1];
     82         Arrays.fill(arrayInV, (float) 42);
     83         inV.copyTo(arrayInV);
     84         float[] arrayOutFloor = new float[INPUTSIZE * 1];
     85         Arrays.fill(arrayOutFloor, (float) 42);
     86         outFloor.copyTo(arrayOutFloor);
     87         float[] arrayOut = new float[INPUTSIZE * 1];
     88         Arrays.fill(arrayOut, (float) 42);
     89         out.copyTo(arrayOut);
     90         StringBuilder message = new StringBuilder();
     91         boolean errorFound = false;
     92         for (int i = 0; i < INPUTSIZE; i++) {
     93             for (int j = 0; j < 1 ; j++) {
     94                 // Extract the inputs.
     95                 ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
     96                 args.inV = arrayInV[i];
     97                 // Figure out what the outputs should have been.
     98                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed);
     99                 CoreMathVerifier.computeFract(args, target);
    100                 // Validate the outputs.
    101                 boolean valid = true;
    102                 if (!args.outFloor.couldBe(arrayOutFloor[i * 1 + j])) {
    103                     valid = false;
    104                 }
    105                 if (!args.out.couldBe(arrayOut[i * 1 + j])) {
    106                     valid = false;
    107                 }
    108                 if (!valid) {
    109                     if (!errorFound) {
    110                         errorFound = true;
    111                         message.append("Input inV: ");
    112                         appendVariableToMessage(message, args.inV);
    113                         message.append("\n");
    114                         message.append("Expected output outFloor: ");
    115                         appendVariableToMessage(message, args.outFloor);
    116                         message.append("\n");
    117                         message.append("Actual   output outFloor: ");
    118                         appendVariableToMessage(message, arrayOutFloor[i * 1 + j]);
    119                         if (!args.outFloor.couldBe(arrayOutFloor[i * 1 + j])) {
    120                             message.append(" FAIL");
    121                         }
    122                         message.append("\n");
    123                         message.append("Expected output out: ");
    124                         appendVariableToMessage(message, args.out);
    125                         message.append("\n");
    126                         message.append("Actual   output out: ");
    127                         appendVariableToMessage(message, arrayOut[i * 1 + j]);
    128                         if (!args.out.couldBe(arrayOut[i * 1 + j])) {
    129                             message.append(" FAIL");
    130                         }
    131                         message.append("\n");
    132                         message.append("Errors at");
    133                     }
    134                     message.append(" [");
    135                     message.append(Integer.toString(i));
    136                     message.append(", ");
    137                     message.append(Integer.toString(j));
    138                     message.append("]");
    139                 }
    140             }
    141         }
    142         assertFalse("Incorrect output for checkFractFloatFloatFloat" +
    143                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
    144     }
    145 
    146     private void checkFractFloat2Float2Float2() {
    147         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xd1dbe683cdf8f525l, false);
    148         try {
    149             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
    150             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
    151             script.set_gAllocOutFloor(outFloor);
    152             script.forEach_testFractFloat2Float2Float2(inV, out);
    153             verifyResultsFractFloat2Float2Float2(inV, outFloor, out, false);
    154             outFloor.destroy();
    155             out.destroy();
    156         } catch (Exception e) {
    157             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat2Float2Float2: " + e.toString());
    158         }
    159         try {
    160             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
    161             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
    162             scriptRelaxed.set_gAllocOutFloor(outFloor);
    163             scriptRelaxed.forEach_testFractFloat2Float2Float2(inV, out);
    164             verifyResultsFractFloat2Float2Float2(inV, outFloor, out, true);
    165             outFloor.destroy();
    166             out.destroy();
    167         } catch (Exception e) {
    168             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat2Float2Float2: " + e.toString());
    169         }
    170         inV.destroy();
    171     }
    172 
    173     private void verifyResultsFractFloat2Float2Float2(Allocation inV, Allocation outFloor, Allocation out, boolean relaxed) {
    174         float[] arrayInV = new float[INPUTSIZE * 2];
    175         Arrays.fill(arrayInV, (float) 42);
    176         inV.copyTo(arrayInV);
    177         float[] arrayOutFloor = new float[INPUTSIZE * 2];
    178         Arrays.fill(arrayOutFloor, (float) 42);
    179         outFloor.copyTo(arrayOutFloor);
    180         float[] arrayOut = new float[INPUTSIZE * 2];
    181         Arrays.fill(arrayOut, (float) 42);
    182         out.copyTo(arrayOut);
    183         StringBuilder message = new StringBuilder();
    184         boolean errorFound = false;
    185         for (int i = 0; i < INPUTSIZE; i++) {
    186             for (int j = 0; j < 2 ; j++) {
    187                 // Extract the inputs.
    188                 ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
    189                 args.inV = arrayInV[i * 2 + j];
    190                 // Figure out what the outputs should have been.
    191                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed);
    192                 CoreMathVerifier.computeFract(args, target);
    193                 // Validate the outputs.
    194                 boolean valid = true;
    195                 if (!args.outFloor.couldBe(arrayOutFloor[i * 2 + j])) {
    196                     valid = false;
    197                 }
    198                 if (!args.out.couldBe(arrayOut[i * 2 + j])) {
    199                     valid = false;
    200                 }
    201                 if (!valid) {
    202                     if (!errorFound) {
    203                         errorFound = true;
    204                         message.append("Input inV: ");
    205                         appendVariableToMessage(message, args.inV);
    206                         message.append("\n");
    207                         message.append("Expected output outFloor: ");
    208                         appendVariableToMessage(message, args.outFloor);
    209                         message.append("\n");
    210                         message.append("Actual   output outFloor: ");
    211                         appendVariableToMessage(message, arrayOutFloor[i * 2 + j]);
    212                         if (!args.outFloor.couldBe(arrayOutFloor[i * 2 + j])) {
    213                             message.append(" FAIL");
    214                         }
    215                         message.append("\n");
    216                         message.append("Expected output out: ");
    217                         appendVariableToMessage(message, args.out);
    218                         message.append("\n");
    219                         message.append("Actual   output out: ");
    220                         appendVariableToMessage(message, arrayOut[i * 2 + j]);
    221                         if (!args.out.couldBe(arrayOut[i * 2 + j])) {
    222                             message.append(" FAIL");
    223                         }
    224                         message.append("\n");
    225                         message.append("Errors at");
    226                     }
    227                     message.append(" [");
    228                     message.append(Integer.toString(i));
    229                     message.append(", ");
    230                     message.append(Integer.toString(j));
    231                     message.append("]");
    232                 }
    233             }
    234         }
    235         assertFalse("Incorrect output for checkFractFloat2Float2Float2" +
    236                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
    237     }
    238 
    239     private void checkFractFloat3Float3Float3() {
    240         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x2640c4a3cfd6f6c6l, false);
    241         try {
    242             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
    243             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
    244             script.set_gAllocOutFloor(outFloor);
    245             script.forEach_testFractFloat3Float3Float3(inV, out);
    246             verifyResultsFractFloat3Float3Float3(inV, outFloor, out, false);
    247             outFloor.destroy();
    248             out.destroy();
    249         } catch (Exception e) {
    250             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat3Float3Float3: " + e.toString());
    251         }
    252         try {
    253             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
    254             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
    255             scriptRelaxed.set_gAllocOutFloor(outFloor);
    256             scriptRelaxed.forEach_testFractFloat3Float3Float3(inV, out);
    257             verifyResultsFractFloat3Float3Float3(inV, outFloor, out, true);
    258             outFloor.destroy();
    259             out.destroy();
    260         } catch (Exception e) {
    261             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat3Float3Float3: " + e.toString());
    262         }
    263         inV.destroy();
    264     }
    265 
    266     private void verifyResultsFractFloat3Float3Float3(Allocation inV, Allocation outFloor, Allocation out, boolean relaxed) {
    267         float[] arrayInV = new float[INPUTSIZE * 4];
    268         Arrays.fill(arrayInV, (float) 42);
    269         inV.copyTo(arrayInV);
    270         float[] arrayOutFloor = new float[INPUTSIZE * 4];
    271         Arrays.fill(arrayOutFloor, (float) 42);
    272         outFloor.copyTo(arrayOutFloor);
    273         float[] arrayOut = new float[INPUTSIZE * 4];
    274         Arrays.fill(arrayOut, (float) 42);
    275         out.copyTo(arrayOut);
    276         StringBuilder message = new StringBuilder();
    277         boolean errorFound = false;
    278         for (int i = 0; i < INPUTSIZE; i++) {
    279             for (int j = 0; j < 3 ; j++) {
    280                 // Extract the inputs.
    281                 ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
    282                 args.inV = arrayInV[i * 4 + j];
    283                 // Figure out what the outputs should have been.
    284                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed);
    285                 CoreMathVerifier.computeFract(args, target);
    286                 // Validate the outputs.
    287                 boolean valid = true;
    288                 if (!args.outFloor.couldBe(arrayOutFloor[i * 4 + j])) {
    289                     valid = false;
    290                 }
    291                 if (!args.out.couldBe(arrayOut[i * 4 + j])) {
    292                     valid = false;
    293                 }
    294                 if (!valid) {
    295                     if (!errorFound) {
    296                         errorFound = true;
    297                         message.append("Input inV: ");
    298                         appendVariableToMessage(message, args.inV);
    299                         message.append("\n");
    300                         message.append("Expected output outFloor: ");
    301                         appendVariableToMessage(message, args.outFloor);
    302                         message.append("\n");
    303                         message.append("Actual   output outFloor: ");
    304                         appendVariableToMessage(message, arrayOutFloor[i * 4 + j]);
    305                         if (!args.outFloor.couldBe(arrayOutFloor[i * 4 + j])) {
    306                             message.append(" FAIL");
    307                         }
    308                         message.append("\n");
    309                         message.append("Expected output out: ");
    310                         appendVariableToMessage(message, args.out);
    311                         message.append("\n");
    312                         message.append("Actual   output out: ");
    313                         appendVariableToMessage(message, arrayOut[i * 4 + j]);
    314                         if (!args.out.couldBe(arrayOut[i * 4 + j])) {
    315                             message.append(" FAIL");
    316                         }
    317                         message.append("\n");
    318                         message.append("Errors at");
    319                     }
    320                     message.append(" [");
    321                     message.append(Integer.toString(i));
    322                     message.append(", ");
    323                     message.append(Integer.toString(j));
    324                     message.append("]");
    325                 }
    326             }
    327         }
    328         assertFalse("Incorrect output for checkFractFloat3Float3Float3" +
    329                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
    330     }
    331 
    332     private void checkFractFloat4Float4Float4() {
    333         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x7aa5a2c3d1b4f867l, false);
    334         try {
    335             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
    336             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
    337             script.set_gAllocOutFloor(outFloor);
    338             script.forEach_testFractFloat4Float4Float4(inV, out);
    339             verifyResultsFractFloat4Float4Float4(inV, outFloor, out, false);
    340             outFloor.destroy();
    341             out.destroy();
    342         } catch (Exception e) {
    343             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat4Float4Float4: " + e.toString());
    344         }
    345         try {
    346             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
    347             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
    348             scriptRelaxed.set_gAllocOutFloor(outFloor);
    349             scriptRelaxed.forEach_testFractFloat4Float4Float4(inV, out);
    350             verifyResultsFractFloat4Float4Float4(inV, outFloor, out, true);
    351             outFloor.destroy();
    352             out.destroy();
    353         } catch (Exception e) {
    354             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat4Float4Float4: " + e.toString());
    355         }
    356         inV.destroy();
    357     }
    358 
    359     private void verifyResultsFractFloat4Float4Float4(Allocation inV, Allocation outFloor, Allocation out, boolean relaxed) {
    360         float[] arrayInV = new float[INPUTSIZE * 4];
    361         Arrays.fill(arrayInV, (float) 42);
    362         inV.copyTo(arrayInV);
    363         float[] arrayOutFloor = new float[INPUTSIZE * 4];
    364         Arrays.fill(arrayOutFloor, (float) 42);
    365         outFloor.copyTo(arrayOutFloor);
    366         float[] arrayOut = new float[INPUTSIZE * 4];
    367         Arrays.fill(arrayOut, (float) 42);
    368         out.copyTo(arrayOut);
    369         StringBuilder message = new StringBuilder();
    370         boolean errorFound = false;
    371         for (int i = 0; i < INPUTSIZE; i++) {
    372             for (int j = 0; j < 4 ; j++) {
    373                 // Extract the inputs.
    374                 ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
    375                 args.inV = arrayInV[i * 4 + j];
    376                 // Figure out what the outputs should have been.
    377                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed);
    378                 CoreMathVerifier.computeFract(args, target);
    379                 // Validate the outputs.
    380                 boolean valid = true;
    381                 if (!args.outFloor.couldBe(arrayOutFloor[i * 4 + j])) {
    382                     valid = false;
    383                 }
    384                 if (!args.out.couldBe(arrayOut[i * 4 + j])) {
    385                     valid = false;
    386                 }
    387                 if (!valid) {
    388                     if (!errorFound) {
    389                         errorFound = true;
    390                         message.append("Input inV: ");
    391                         appendVariableToMessage(message, args.inV);
    392                         message.append("\n");
    393                         message.append("Expected output outFloor: ");
    394                         appendVariableToMessage(message, args.outFloor);
    395                         message.append("\n");
    396                         message.append("Actual   output outFloor: ");
    397                         appendVariableToMessage(message, arrayOutFloor[i * 4 + j]);
    398                         if (!args.outFloor.couldBe(arrayOutFloor[i * 4 + j])) {
    399                             message.append(" FAIL");
    400                         }
    401                         message.append("\n");
    402                         message.append("Expected output out: ");
    403                         appendVariableToMessage(message, args.out);
    404                         message.append("\n");
    405                         message.append("Actual   output out: ");
    406                         appendVariableToMessage(message, arrayOut[i * 4 + j]);
    407                         if (!args.out.couldBe(arrayOut[i * 4 + j])) {
    408                             message.append(" FAIL");
    409                         }
    410                         message.append("\n");
    411                         message.append("Errors at");
    412                     }
    413                     message.append(" [");
    414                     message.append(Integer.toString(i));
    415                     message.append(", ");
    416                     message.append(Integer.toString(j));
    417                     message.append("]");
    418                 }
    419             }
    420         }
    421         assertFalse("Incorrect output for checkFractFloat4Float4Float4" +
    422                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
    423     }
    424 
    425     public class ArgumentsFloatFloat {
    426         public float inV;
    427         public Target.Floaty out;
    428     }
    429 
    430     private void checkFractFloatFloat() {
    431         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xf559208b9db2cad3l, false);
    432         try {
    433             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
    434             script.forEach_testFractFloatFloat(inV, out);
    435             verifyResultsFractFloatFloat(inV, out, false);
    436             out.destroy();
    437         } catch (Exception e) {
    438             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloatFloat: " + e.toString());
    439         }
    440         try {
    441             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
    442             scriptRelaxed.forEach_testFractFloatFloat(inV, out);
    443             verifyResultsFractFloatFloat(inV, out, true);
    444             out.destroy();
    445         } catch (Exception e) {
    446             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloatFloat: " + e.toString());
    447         }
    448         inV.destroy();
    449     }
    450 
    451     private void verifyResultsFractFloatFloat(Allocation inV, Allocation out, boolean relaxed) {
    452         float[] arrayInV = new float[INPUTSIZE * 1];
    453         Arrays.fill(arrayInV, (float) 42);
    454         inV.copyTo(arrayInV);
    455         float[] arrayOut = new float[INPUTSIZE * 1];
    456         Arrays.fill(arrayOut, (float) 42);
    457         out.copyTo(arrayOut);
    458         StringBuilder message = new StringBuilder();
    459         boolean errorFound = false;
    460         for (int i = 0; i < INPUTSIZE; i++) {
    461             for (int j = 0; j < 1 ; j++) {
    462                 // Extract the inputs.
    463                 ArgumentsFloatFloat args = new ArgumentsFloatFloat();
    464                 args.inV = arrayInV[i];
    465                 // Figure out what the outputs should have been.
    466                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed);
    467                 CoreMathVerifier.computeFract(args, target);
    468                 // Validate the outputs.
    469                 boolean valid = true;
    470                 if (!args.out.couldBe(arrayOut[i * 1 + j])) {
    471                     valid = false;
    472                 }
    473                 if (!valid) {
    474                     if (!errorFound) {
    475                         errorFound = true;
    476                         message.append("Input inV: ");
    477                         appendVariableToMessage(message, args.inV);
    478                         message.append("\n");
    479                         message.append("Expected output out: ");
    480                         appendVariableToMessage(message, args.out);
    481                         message.append("\n");
    482                         message.append("Actual   output out: ");
    483                         appendVariableToMessage(message, arrayOut[i * 1 + j]);
    484                         if (!args.out.couldBe(arrayOut[i * 1 + j])) {
    485                             message.append(" FAIL");
    486                         }
    487                         message.append("\n");
    488                         message.append("Errors at");
    489                     }
    490                     message.append(" [");
    491                     message.append(Integer.toString(i));
    492                     message.append(", ");
    493                     message.append(Integer.toString(j));
    494                     message.append("]");
    495                 }
    496             }
    497         }
    498         assertFalse("Incorrect output for checkFractFloatFloat" +
    499                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
    500     }
    501 
    502     private void checkFractFloat2Float2() {
    503         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x1096c5acc4d52edfl, false);
    504         try {
    505             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
    506             script.forEach_testFractFloat2Float2(inV, out);
    507             verifyResultsFractFloat2Float2(inV, out, false);
    508             out.destroy();
    509         } catch (Exception e) {
    510             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat2Float2: " + e.toString());
    511         }
    512         try {
    513             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
    514             scriptRelaxed.forEach_testFractFloat2Float2(inV, out);
    515             verifyResultsFractFloat2Float2(inV, out, true);
    516             out.destroy();
    517         } catch (Exception e) {
    518             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat2Float2: " + e.toString());
    519         }
    520         inV.destroy();
    521     }
    522 
    523     private void verifyResultsFractFloat2Float2(Allocation inV, Allocation out, boolean relaxed) {
    524         float[] arrayInV = new float[INPUTSIZE * 2];
    525         Arrays.fill(arrayInV, (float) 42);
    526         inV.copyTo(arrayInV);
    527         float[] arrayOut = new float[INPUTSIZE * 2];
    528         Arrays.fill(arrayOut, (float) 42);
    529         out.copyTo(arrayOut);
    530         StringBuilder message = new StringBuilder();
    531         boolean errorFound = false;
    532         for (int i = 0; i < INPUTSIZE; i++) {
    533             for (int j = 0; j < 2 ; j++) {
    534                 // Extract the inputs.
    535                 ArgumentsFloatFloat args = new ArgumentsFloatFloat();
    536                 args.inV = arrayInV[i * 2 + j];
    537                 // Figure out what the outputs should have been.
    538                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed);
    539                 CoreMathVerifier.computeFract(args, target);
    540                 // Validate the outputs.
    541                 boolean valid = true;
    542                 if (!args.out.couldBe(arrayOut[i * 2 + j])) {
    543                     valid = false;
    544                 }
    545                 if (!valid) {
    546                     if (!errorFound) {
    547                         errorFound = true;
    548                         message.append("Input inV: ");
    549                         appendVariableToMessage(message, args.inV);
    550                         message.append("\n");
    551                         message.append("Expected output out: ");
    552                         appendVariableToMessage(message, args.out);
    553                         message.append("\n");
    554                         message.append("Actual   output out: ");
    555                         appendVariableToMessage(message, arrayOut[i * 2 + j]);
    556                         if (!args.out.couldBe(arrayOut[i * 2 + j])) {
    557                             message.append(" FAIL");
    558                         }
    559                         message.append("\n");
    560                         message.append("Errors at");
    561                     }
    562                     message.append(" [");
    563                     message.append(Integer.toString(i));
    564                     message.append(", ");
    565                     message.append(Integer.toString(j));
    566                     message.append("]");
    567                 }
    568             }
    569         }
    570         assertFalse("Incorrect output for checkFractFloat2Float2" +
    571                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
    572     }
    573 
    574     private void checkFractFloat3Float3() {
    575         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x10988ec7baf04fbdl, false);
    576         try {
    577             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
    578             script.forEach_testFractFloat3Float3(inV, out);
    579             verifyResultsFractFloat3Float3(inV, out, false);
    580             out.destroy();
    581         } catch (Exception e) {
    582             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat3Float3: " + e.toString());
    583         }
    584         try {
    585             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
    586             scriptRelaxed.forEach_testFractFloat3Float3(inV, out);
    587             verifyResultsFractFloat3Float3(inV, out, true);
    588             out.destroy();
    589         } catch (Exception e) {
    590             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat3Float3: " + e.toString());
    591         }
    592         inV.destroy();
    593     }
    594 
    595     private void verifyResultsFractFloat3Float3(Allocation inV, Allocation out, boolean relaxed) {
    596         float[] arrayInV = new float[INPUTSIZE * 4];
    597         Arrays.fill(arrayInV, (float) 42);
    598         inV.copyTo(arrayInV);
    599         float[] arrayOut = new float[INPUTSIZE * 4];
    600         Arrays.fill(arrayOut, (float) 42);
    601         out.copyTo(arrayOut);
    602         StringBuilder message = new StringBuilder();
    603         boolean errorFound = false;
    604         for (int i = 0; i < INPUTSIZE; i++) {
    605             for (int j = 0; j < 3 ; j++) {
    606                 // Extract the inputs.
    607                 ArgumentsFloatFloat args = new ArgumentsFloatFloat();
    608                 args.inV = arrayInV[i * 4 + j];
    609                 // Figure out what the outputs should have been.
    610                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed);
    611                 CoreMathVerifier.computeFract(args, target);
    612                 // Validate the outputs.
    613                 boolean valid = true;
    614                 if (!args.out.couldBe(arrayOut[i * 4 + j])) {
    615                     valid = false;
    616                 }
    617                 if (!valid) {
    618                     if (!errorFound) {
    619                         errorFound = true;
    620                         message.append("Input inV: ");
    621                         appendVariableToMessage(message, args.inV);
    622                         message.append("\n");
    623                         message.append("Expected output out: ");
    624                         appendVariableToMessage(message, args.out);
    625                         message.append("\n");
    626                         message.append("Actual   output out: ");
    627                         appendVariableToMessage(message, arrayOut[i * 4 + j]);
    628                         if (!args.out.couldBe(arrayOut[i * 4 + j])) {
    629                             message.append(" FAIL");
    630                         }
    631                         message.append("\n");
    632                         message.append("Errors at");
    633                     }
    634                     message.append(" [");
    635                     message.append(Integer.toString(i));
    636                     message.append(", ");
    637                     message.append(Integer.toString(j));
    638                     message.append("]");
    639                 }
    640             }
    641         }
    642         assertFalse("Incorrect output for checkFractFloat3Float3" +
    643                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
    644     }
    645 
    646     private void checkFractFloat4Float4() {
    647         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x109a57e2b10b709bl, false);
    648         try {
    649             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
    650             script.forEach_testFractFloat4Float4(inV, out);
    651             verifyResultsFractFloat4Float4(inV, out, false);
    652             out.destroy();
    653         } catch (Exception e) {
    654             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat4Float4: " + e.toString());
    655         }
    656         try {
    657             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
    658             scriptRelaxed.forEach_testFractFloat4Float4(inV, out);
    659             verifyResultsFractFloat4Float4(inV, out, true);
    660             out.destroy();
    661         } catch (Exception e) {
    662             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat4Float4: " + e.toString());
    663         }
    664         inV.destroy();
    665     }
    666 
    667     private void verifyResultsFractFloat4Float4(Allocation inV, Allocation out, boolean relaxed) {
    668         float[] arrayInV = new float[INPUTSIZE * 4];
    669         Arrays.fill(arrayInV, (float) 42);
    670         inV.copyTo(arrayInV);
    671         float[] arrayOut = new float[INPUTSIZE * 4];
    672         Arrays.fill(arrayOut, (float) 42);
    673         out.copyTo(arrayOut);
    674         StringBuilder message = new StringBuilder();
    675         boolean errorFound = false;
    676         for (int i = 0; i < INPUTSIZE; i++) {
    677             for (int j = 0; j < 4 ; j++) {
    678                 // Extract the inputs.
    679                 ArgumentsFloatFloat args = new ArgumentsFloatFloat();
    680                 args.inV = arrayInV[i * 4 + j];
    681                 // Figure out what the outputs should have been.
    682                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed);
    683                 CoreMathVerifier.computeFract(args, target);
    684                 // Validate the outputs.
    685                 boolean valid = true;
    686                 if (!args.out.couldBe(arrayOut[i * 4 + j])) {
    687                     valid = false;
    688                 }
    689                 if (!valid) {
    690                     if (!errorFound) {
    691                         errorFound = true;
    692                         message.append("Input inV: ");
    693                         appendVariableToMessage(message, args.inV);
    694                         message.append("\n");
    695                         message.append("Expected output out: ");
    696                         appendVariableToMessage(message, args.out);
    697                         message.append("\n");
    698                         message.append("Actual   output out: ");
    699                         appendVariableToMessage(message, arrayOut[i * 4 + j]);
    700                         if (!args.out.couldBe(arrayOut[i * 4 + j])) {
    701                             message.append(" FAIL");
    702                         }
    703                         message.append("\n");
    704                         message.append("Errors at");
    705                     }
    706                     message.append(" [");
    707                     message.append(Integer.toString(i));
    708                     message.append(", ");
    709                     message.append(Integer.toString(j));
    710                     message.append("]");
    711                 }
    712             }
    713         }
    714         assertFalse("Incorrect output for checkFractFloat4Float4" +
    715                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
    716     }
    717 
    718     public class ArgumentsHalfHalfHalf {
    719         public short inV;
    720         public double inVDouble;
    721         public Target.Floaty outFloor;
    722         public Target.Floaty out;
    723     }
    724 
    725     private void checkFractHalfHalfHalf() {
    726         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 1, 0xd06c85e164a42fb6l, false);
    727         try {
    728             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 1), INPUTSIZE);
    729             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 1), INPUTSIZE);
    730             script.set_gAllocOutFloor(outFloor);
    731             script.forEach_testFractHalfHalfHalf(inV, out);
    732             verifyResultsFractHalfHalfHalf(inV, outFloor, out, false);
    733             outFloor.destroy();
    734             out.destroy();
    735         } catch (Exception e) {
    736             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalfHalfHalf: " + e.toString());
    737         }
    738         try {
    739             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 1), INPUTSIZE);
    740             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 1), INPUTSIZE);
    741             scriptRelaxed.set_gAllocOutFloor(outFloor);
    742             scriptRelaxed.forEach_testFractHalfHalfHalf(inV, out);
    743             verifyResultsFractHalfHalfHalf(inV, outFloor, out, true);
    744             outFloor.destroy();
    745             out.destroy();
    746         } catch (Exception e) {
    747             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalfHalfHalf: " + e.toString());
    748         }
    749         inV.destroy();
    750     }
    751 
    752     private void verifyResultsFractHalfHalfHalf(Allocation inV, Allocation outFloor, Allocation out, boolean relaxed) {
    753         short[] arrayInV = new short[INPUTSIZE * 1];
    754         Arrays.fill(arrayInV, (short) 42);
    755         inV.copyTo(arrayInV);
    756         short[] arrayOutFloor = new short[INPUTSIZE * 1];
    757         Arrays.fill(arrayOutFloor, (short) 42);
    758         outFloor.copyTo(arrayOutFloor);
    759         short[] arrayOut = new short[INPUTSIZE * 1];
    760         Arrays.fill(arrayOut, (short) 42);
    761         out.copyTo(arrayOut);
    762         StringBuilder message = new StringBuilder();
    763         boolean errorFound = false;
    764         for (int i = 0; i < INPUTSIZE; i++) {
    765             for (int j = 0; j < 1 ; j++) {
    766                 // Extract the inputs.
    767                 ArgumentsHalfHalfHalf args = new ArgumentsHalfHalfHalf();
    768                 args.inV = arrayInV[i];
    769                 args.inVDouble = Float16Utils.convertFloat16ToDouble(args.inV);
    770                 // Figure out what the outputs should have been.
    771                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed);
    772                 CoreMathVerifier.computeFract(args, target);
    773                 // Validate the outputs.
    774                 boolean valid = true;
    775                 if (!args.outFloor.couldBe(Float16Utils.convertFloat16ToDouble(arrayOutFloor[i * 1 + j]))) {
    776                     valid = false;
    777                 }
    778                 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 1 + j]))) {
    779                     valid = false;
    780                 }
    781                 if (!valid) {
    782                     if (!errorFound) {
    783                         errorFound = true;
    784                         message.append("Input inV: ");
    785                         appendVariableToMessage(message, args.inV);
    786                         message.append("\n");
    787                         message.append("Expected output outFloor: ");
    788                         appendVariableToMessage(message, args.outFloor);
    789                         message.append("\n");
    790                         message.append("Actual   output outFloor: ");
    791                         appendVariableToMessage(message, arrayOutFloor[i * 1 + j]);
    792                         message.append("\n");
    793                         message.append("Actual   output outFloor (in double): ");
    794                         appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOutFloor[i * 1 + j]));
    795                         if (!args.outFloor.couldBe(Float16Utils.convertFloat16ToDouble(arrayOutFloor[i * 1 + j]))) {
    796                             message.append(" FAIL");
    797                         }
    798                         message.append("\n");
    799                         message.append("Expected output out: ");
    800                         appendVariableToMessage(message, args.out);
    801                         message.append("\n");
    802                         message.append("Actual   output out: ");
    803                         appendVariableToMessage(message, arrayOut[i * 1 + j]);
    804                         message.append("\n");
    805                         message.append("Actual   output out (in double): ");
    806                         appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 1 + j]));
    807                         if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 1 + j]))) {
    808                             message.append(" FAIL");
    809                         }
    810                         message.append("\n");
    811                         message.append("Errors at");
    812                     }
    813                     message.append(" [");
    814                     message.append(Integer.toString(i));
    815                     message.append(", ");
    816                     message.append(Integer.toString(j));
    817                     message.append("]");
    818                 }
    819             }
    820         }
    821         assertFalse("Incorrect output for checkFractHalfHalfHalf" +
    822                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
    823     }
    824 
    825     private void checkFractHalf2Half2Half2() {
    826         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 2, 0x27492874734da11cl, false);
    827         try {
    828             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 2), INPUTSIZE);
    829             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 2), INPUTSIZE);
    830             script.set_gAllocOutFloor(outFloor);
    831             script.forEach_testFractHalf2Half2Half2(inV, out);
    832             verifyResultsFractHalf2Half2Half2(inV, outFloor, out, false);
    833             outFloor.destroy();
    834             out.destroy();
    835         } catch (Exception e) {
    836             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalf2Half2Half2: " + e.toString());
    837         }
    838         try {
    839             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 2), INPUTSIZE);
    840             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 2), INPUTSIZE);
    841             scriptRelaxed.set_gAllocOutFloor(outFloor);
    842             scriptRelaxed.forEach_testFractHalf2Half2Half2(inV, out);
    843             verifyResultsFractHalf2Half2Half2(inV, outFloor, out, true);
    844             outFloor.destroy();
    845             out.destroy();
    846         } catch (Exception e) {
    847             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalf2Half2Half2: " + e.toString());
    848         }
    849         inV.destroy();
    850     }
    851 
    852     private void verifyResultsFractHalf2Half2Half2(Allocation inV, Allocation outFloor, Allocation out, boolean relaxed) {
    853         short[] arrayInV = new short[INPUTSIZE * 2];
    854         Arrays.fill(arrayInV, (short) 42);
    855         inV.copyTo(arrayInV);
    856         short[] arrayOutFloor = new short[INPUTSIZE * 2];
    857         Arrays.fill(arrayOutFloor, (short) 42);
    858         outFloor.copyTo(arrayOutFloor);
    859         short[] arrayOut = new short[INPUTSIZE * 2];
    860         Arrays.fill(arrayOut, (short) 42);
    861         out.copyTo(arrayOut);
    862         StringBuilder message = new StringBuilder();
    863         boolean errorFound = false;
    864         for (int i = 0; i < INPUTSIZE; i++) {
    865             for (int j = 0; j < 2 ; j++) {
    866                 // Extract the inputs.
    867                 ArgumentsHalfHalfHalf args = new ArgumentsHalfHalfHalf();
    868                 args.inV = arrayInV[i * 2 + j];
    869                 args.inVDouble = Float16Utils.convertFloat16ToDouble(args.inV);
    870                 // Figure out what the outputs should have been.
    871                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed);
    872                 CoreMathVerifier.computeFract(args, target);
    873                 // Validate the outputs.
    874                 boolean valid = true;
    875                 if (!args.outFloor.couldBe(Float16Utils.convertFloat16ToDouble(arrayOutFloor[i * 2 + j]))) {
    876                     valid = false;
    877                 }
    878                 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 2 + j]))) {
    879                     valid = false;
    880                 }
    881                 if (!valid) {
    882                     if (!errorFound) {
    883                         errorFound = true;
    884                         message.append("Input inV: ");
    885                         appendVariableToMessage(message, args.inV);
    886                         message.append("\n");
    887                         message.append("Expected output outFloor: ");
    888                         appendVariableToMessage(message, args.outFloor);
    889                         message.append("\n");
    890                         message.append("Actual   output outFloor: ");
    891                         appendVariableToMessage(message, arrayOutFloor[i * 2 + j]);
    892                         message.append("\n");
    893                         message.append("Actual   output outFloor (in double): ");
    894                         appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOutFloor[i * 2 + j]));
    895                         if (!args.outFloor.couldBe(Float16Utils.convertFloat16ToDouble(arrayOutFloor[i * 2 + j]))) {
    896                             message.append(" FAIL");
    897                         }
    898                         message.append("\n");
    899                         message.append("Expected output out: ");
    900                         appendVariableToMessage(message, args.out);
    901                         message.append("\n");
    902                         message.append("Actual   output out: ");
    903                         appendVariableToMessage(message, arrayOut[i * 2 + j]);
    904                         message.append("\n");
    905                         message.append("Actual   output out (in double): ");
    906                         appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 2 + j]));
    907                         if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 2 + j]))) {
    908                             message.append(" FAIL");
    909                         }
    910                         message.append("\n");
    911                         message.append("Errors at");
    912                     }
    913                     message.append(" [");
    914                     message.append(Integer.toString(i));
    915                     message.append(", ");
    916                     message.append(Integer.toString(j));
    917                     message.append("]");
    918                 }
    919             }
    920         }
    921         assertFalse("Incorrect output for checkFractHalf2Half2Half2" +
    922                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
    923     }
    924 
    925     private void checkFractHalf3Half3Half3() {
    926         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 3, 0x4cfda85dd1ecb1ebl, false);
    927         try {
    928             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 3), INPUTSIZE);
    929             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 3), INPUTSIZE);
    930             script.set_gAllocOutFloor(outFloor);
    931             script.forEach_testFractHalf3Half3Half3(inV, out);
    932             verifyResultsFractHalf3Half3Half3(inV, outFloor, out, false);
    933             outFloor.destroy();
    934             out.destroy();
    935         } catch (Exception e) {
    936             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalf3Half3Half3: " + e.toString());
    937         }
    938         try {
    939             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 3), INPUTSIZE);
    940             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 3), INPUTSIZE);
    941             scriptRelaxed.set_gAllocOutFloor(outFloor);
    942             scriptRelaxed.forEach_testFractHalf3Half3Half3(inV, out);
    943             verifyResultsFractHalf3Half3Half3(inV, outFloor, out, true);
    944             outFloor.destroy();
    945             out.destroy();
    946         } catch (Exception e) {
    947             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalf3Half3Half3: " + e.toString());
    948         }
    949         inV.destroy();
    950     }
    951 
    952     private void verifyResultsFractHalf3Half3Half3(Allocation inV, Allocation outFloor, Allocation out, boolean relaxed) {
    953         short[] arrayInV = new short[INPUTSIZE * 4];
    954         Arrays.fill(arrayInV, (short) 42);
    955         inV.copyTo(arrayInV);
    956         short[] arrayOutFloor = new short[INPUTSIZE * 4];
    957         Arrays.fill(arrayOutFloor, (short) 42);
    958         outFloor.copyTo(arrayOutFloor);
    959         short[] arrayOut = new short[INPUTSIZE * 4];
    960         Arrays.fill(arrayOut, (short) 42);
    961         out.copyTo(arrayOut);
    962         StringBuilder message = new StringBuilder();
    963         boolean errorFound = false;
    964         for (int i = 0; i < INPUTSIZE; i++) {
    965             for (int j = 0; j < 3 ; j++) {
    966                 // Extract the inputs.
    967                 ArgumentsHalfHalfHalf args = new ArgumentsHalfHalfHalf();
    968                 args.inV = arrayInV[i * 4 + j];
    969                 args.inVDouble = Float16Utils.convertFloat16ToDouble(args.inV);
    970                 // Figure out what the outputs should have been.
    971                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed);
    972                 CoreMathVerifier.computeFract(args, target);
    973                 // Validate the outputs.
    974                 boolean valid = true;
    975                 if (!args.outFloor.couldBe(Float16Utils.convertFloat16ToDouble(arrayOutFloor[i * 4 + j]))) {
    976                     valid = false;
    977                 }
    978                 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) {
    979                     valid = false;
    980                 }
    981                 if (!valid) {
    982                     if (!errorFound) {
    983                         errorFound = true;
    984                         message.append("Input inV: ");
    985                         appendVariableToMessage(message, args.inV);
    986                         message.append("\n");
    987                         message.append("Expected output outFloor: ");
    988                         appendVariableToMessage(message, args.outFloor);
    989                         message.append("\n");
    990                         message.append("Actual   output outFloor: ");
    991                         appendVariableToMessage(message, arrayOutFloor[i * 4 + j]);
    992                         message.append("\n");
    993                         message.append("Actual   output outFloor (in double): ");
    994                         appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOutFloor[i * 4 + j]));
    995                         if (!args.outFloor.couldBe(Float16Utils.convertFloat16ToDouble(arrayOutFloor[i * 4 + j]))) {
    996                             message.append(" FAIL");
    997                         }
    998                         message.append("\n");
    999                         message.append("Expected output out: ");
   1000                         appendVariableToMessage(message, args.out);
   1001                         message.append("\n");
   1002                         message.append("Actual   output out: ");
   1003                         appendVariableToMessage(message, arrayOut[i * 4 + j]);
   1004                         message.append("\n");
   1005                         message.append("Actual   output out (in double): ");
   1006                         appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]));
   1007                         if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) {
   1008                             message.append(" FAIL");
   1009                         }
   1010                         message.append("\n");
   1011                         message.append("Errors at");
   1012                     }
   1013                     message.append(" [");
   1014                     message.append(Integer.toString(i));
   1015                     message.append(", ");
   1016                     message.append(Integer.toString(j));
   1017                     message.append("]");
   1018                 }
   1019             }
   1020         }
   1021         assertFalse("Incorrect output for checkFractHalf3Half3Half3" +
   1022                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
   1023     }
   1024 
   1025     private void checkFractHalf4Half4Half4() {
   1026         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 4, 0x72b22847308bc2bal, false);
   1027         try {
   1028             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 4), INPUTSIZE);
   1029             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 4), INPUTSIZE);
   1030             script.set_gAllocOutFloor(outFloor);
   1031             script.forEach_testFractHalf4Half4Half4(inV, out);
   1032             verifyResultsFractHalf4Half4Half4(inV, outFloor, out, false);
   1033             outFloor.destroy();
   1034             out.destroy();
   1035         } catch (Exception e) {
   1036             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalf4Half4Half4: " + e.toString());
   1037         }
   1038         try {
   1039             Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 4), INPUTSIZE);
   1040             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 4), INPUTSIZE);
   1041             scriptRelaxed.set_gAllocOutFloor(outFloor);
   1042             scriptRelaxed.forEach_testFractHalf4Half4Half4(inV, out);
   1043             verifyResultsFractHalf4Half4Half4(inV, outFloor, out, true);
   1044             outFloor.destroy();
   1045             out.destroy();
   1046         } catch (Exception e) {
   1047             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalf4Half4Half4: " + e.toString());
   1048         }
   1049         inV.destroy();
   1050     }
   1051 
   1052     private void verifyResultsFractHalf4Half4Half4(Allocation inV, Allocation outFloor, Allocation out, boolean relaxed) {
   1053         short[] arrayInV = new short[INPUTSIZE * 4];
   1054         Arrays.fill(arrayInV, (short) 42);
   1055         inV.copyTo(arrayInV);
   1056         short[] arrayOutFloor = new short[INPUTSIZE * 4];
   1057         Arrays.fill(arrayOutFloor, (short) 42);
   1058         outFloor.copyTo(arrayOutFloor);
   1059         short[] arrayOut = new short[INPUTSIZE * 4];
   1060         Arrays.fill(arrayOut, (short) 42);
   1061         out.copyTo(arrayOut);
   1062         StringBuilder message = new StringBuilder();
   1063         boolean errorFound = false;
   1064         for (int i = 0; i < INPUTSIZE; i++) {
   1065             for (int j = 0; j < 4 ; j++) {
   1066                 // Extract the inputs.
   1067                 ArgumentsHalfHalfHalf args = new ArgumentsHalfHalfHalf();
   1068                 args.inV = arrayInV[i * 4 + j];
   1069                 args.inVDouble = Float16Utils.convertFloat16ToDouble(args.inV);
   1070                 // Figure out what the outputs should have been.
   1071                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed);
   1072                 CoreMathVerifier.computeFract(args, target);
   1073                 // Validate the outputs.
   1074                 boolean valid = true;
   1075                 if (!args.outFloor.couldBe(Float16Utils.convertFloat16ToDouble(arrayOutFloor[i * 4 + j]))) {
   1076                     valid = false;
   1077                 }
   1078                 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) {
   1079                     valid = false;
   1080                 }
   1081                 if (!valid) {
   1082                     if (!errorFound) {
   1083                         errorFound = true;
   1084                         message.append("Input inV: ");
   1085                         appendVariableToMessage(message, args.inV);
   1086                         message.append("\n");
   1087                         message.append("Expected output outFloor: ");
   1088                         appendVariableToMessage(message, args.outFloor);
   1089                         message.append("\n");
   1090                         message.append("Actual   output outFloor: ");
   1091                         appendVariableToMessage(message, arrayOutFloor[i * 4 + j]);
   1092                         message.append("\n");
   1093                         message.append("Actual   output outFloor (in double): ");
   1094                         appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOutFloor[i * 4 + j]));
   1095                         if (!args.outFloor.couldBe(Float16Utils.convertFloat16ToDouble(arrayOutFloor[i * 4 + j]))) {
   1096                             message.append(" FAIL");
   1097                         }
   1098                         message.append("\n");
   1099                         message.append("Expected output out: ");
   1100                         appendVariableToMessage(message, args.out);
   1101                         message.append("\n");
   1102                         message.append("Actual   output out: ");
   1103                         appendVariableToMessage(message, arrayOut[i * 4 + j]);
   1104                         message.append("\n");
   1105                         message.append("Actual   output out (in double): ");
   1106                         appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]));
   1107                         if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) {
   1108                             message.append(" FAIL");
   1109                         }
   1110                         message.append("\n");
   1111                         message.append("Errors at");
   1112                     }
   1113                     message.append(" [");
   1114                     message.append(Integer.toString(i));
   1115                     message.append(", ");
   1116                     message.append(Integer.toString(j));
   1117                     message.append("]");
   1118                 }
   1119             }
   1120         }
   1121         assertFalse("Incorrect output for checkFractHalf4Half4Half4" +
   1122                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
   1123     }
   1124 
   1125     public class ArgumentsHalfHalf {
   1126         public short inV;
   1127         public double inVDouble;
   1128         public Target.Floaty out;
   1129     }
   1130 
   1131     private void checkFractHalfHalf() {
   1132         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 1, 0x924ee10e96468e55l, false);
   1133         try {
   1134             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 1), INPUTSIZE);
   1135             script.forEach_testFractHalfHalf(inV, out);
   1136             verifyResultsFractHalfHalf(inV, out, false);
   1137             out.destroy();
   1138         } catch (Exception e) {
   1139             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalfHalf: " + e.toString());
   1140         }
   1141         try {
   1142             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 1), INPUTSIZE);
   1143             scriptRelaxed.forEach_testFractHalfHalf(inV, out);
   1144             verifyResultsFractHalfHalf(inV, out, true);
   1145             out.destroy();
   1146         } catch (Exception e) {
   1147             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalfHalf: " + e.toString());
   1148         }
   1149         inV.destroy();
   1150     }
   1151 
   1152     private void verifyResultsFractHalfHalf(Allocation inV, Allocation out, boolean relaxed) {
   1153         short[] arrayInV = new short[INPUTSIZE * 1];
   1154         Arrays.fill(arrayInV, (short) 42);
   1155         inV.copyTo(arrayInV);
   1156         short[] arrayOut = new short[INPUTSIZE * 1];
   1157         Arrays.fill(arrayOut, (short) 42);
   1158         out.copyTo(arrayOut);
   1159         StringBuilder message = new StringBuilder();
   1160         boolean errorFound = false;
   1161         for (int i = 0; i < INPUTSIZE; i++) {
   1162             for (int j = 0; j < 1 ; j++) {
   1163                 // Extract the inputs.
   1164                 ArgumentsHalfHalf args = new ArgumentsHalfHalf();
   1165                 args.inV = arrayInV[i];
   1166                 args.inVDouble = Float16Utils.convertFloat16ToDouble(args.inV);
   1167                 // Figure out what the outputs should have been.
   1168                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed);
   1169                 CoreMathVerifier.computeFract(args, target);
   1170                 // Validate the outputs.
   1171                 boolean valid = true;
   1172                 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 1 + j]))) {
   1173                     valid = false;
   1174                 }
   1175                 if (!valid) {
   1176                     if (!errorFound) {
   1177                         errorFound = true;
   1178                         message.append("Input inV: ");
   1179                         appendVariableToMessage(message, args.inV);
   1180                         message.append("\n");
   1181                         message.append("Expected output out: ");
   1182                         appendVariableToMessage(message, args.out);
   1183                         message.append("\n");
   1184                         message.append("Actual   output out: ");
   1185                         appendVariableToMessage(message, arrayOut[i * 1 + j]);
   1186                         message.append("\n");
   1187                         message.append("Actual   output out (in double): ");
   1188                         appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 1 + j]));
   1189                         if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 1 + j]))) {
   1190                             message.append(" FAIL");
   1191                         }
   1192                         message.append("\n");
   1193                         message.append("Errors at");
   1194                     }
   1195                     message.append(" [");
   1196                     message.append(Integer.toString(i));
   1197                     message.append(", ");
   1198                     message.append(Integer.toString(j));
   1199                     message.append("]");
   1200                 }
   1201             }
   1202         }
   1203         assertFalse("Incorrect output for checkFractHalfHalf" +
   1204                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
   1205     }
   1206 
   1207     private void checkFractHalf2Half2() {
   1208         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 2, 0xbbb6923f0ad1120fl, false);
   1209         try {
   1210             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 2), INPUTSIZE);
   1211             script.forEach_testFractHalf2Half2(inV, out);
   1212             verifyResultsFractHalf2Half2(inV, out, false);
   1213             out.destroy();
   1214         } catch (Exception e) {
   1215             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalf2Half2: " + e.toString());
   1216         }
   1217         try {
   1218             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 2), INPUTSIZE);
   1219             scriptRelaxed.forEach_testFractHalf2Half2(inV, out);
   1220             verifyResultsFractHalf2Half2(inV, out, true);
   1221             out.destroy();
   1222         } catch (Exception e) {
   1223             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalf2Half2: " + e.toString());
   1224         }
   1225         inV.destroy();
   1226     }
   1227 
   1228     private void verifyResultsFractHalf2Half2(Allocation inV, Allocation out, boolean relaxed) {
   1229         short[] arrayInV = new short[INPUTSIZE * 2];
   1230         Arrays.fill(arrayInV, (short) 42);
   1231         inV.copyTo(arrayInV);
   1232         short[] arrayOut = new short[INPUTSIZE * 2];
   1233         Arrays.fill(arrayOut, (short) 42);
   1234         out.copyTo(arrayOut);
   1235         StringBuilder message = new StringBuilder();
   1236         boolean errorFound = false;
   1237         for (int i = 0; i < INPUTSIZE; i++) {
   1238             for (int j = 0; j < 2 ; j++) {
   1239                 // Extract the inputs.
   1240                 ArgumentsHalfHalf args = new ArgumentsHalfHalf();
   1241                 args.inV = arrayInV[i * 2 + j];
   1242                 args.inVDouble = Float16Utils.convertFloat16ToDouble(args.inV);
   1243                 // Figure out what the outputs should have been.
   1244                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed);
   1245                 CoreMathVerifier.computeFract(args, target);
   1246                 // Validate the outputs.
   1247                 boolean valid = true;
   1248                 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 2 + j]))) {
   1249                     valid = false;
   1250                 }
   1251                 if (!valid) {
   1252                     if (!errorFound) {
   1253                         errorFound = true;
   1254                         message.append("Input inV: ");
   1255                         appendVariableToMessage(message, args.inV);
   1256                         message.append("\n");
   1257                         message.append("Expected output out: ");
   1258                         appendVariableToMessage(message, args.out);
   1259                         message.append("\n");
   1260                         message.append("Actual   output out: ");
   1261                         appendVariableToMessage(message, arrayOut[i * 2 + j]);
   1262                         message.append("\n");
   1263                         message.append("Actual   output out (in double): ");
   1264                         appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 2 + j]));
   1265                         if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 2 + j]))) {
   1266                             message.append(" FAIL");
   1267                         }
   1268                         message.append("\n");
   1269                         message.append("Errors at");
   1270                     }
   1271                     message.append(" [");
   1272                     message.append(Integer.toString(i));
   1273                     message.append(", ");
   1274                     message.append(Integer.toString(j));
   1275                     message.append("]");
   1276                 }
   1277             }
   1278         }
   1279         assertFalse("Incorrect output for checkFractHalf2Half2" +
   1280                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
   1281     }
   1282 
   1283     private void checkFractHalf3Half3() {
   1284         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 3, 0xbbb69ce069d8d703l, false);
   1285         try {
   1286             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 3), INPUTSIZE);
   1287             script.forEach_testFractHalf3Half3(inV, out);
   1288             verifyResultsFractHalf3Half3(inV, out, false);
   1289             out.destroy();
   1290         } catch (Exception e) {
   1291             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalf3Half3: " + e.toString());
   1292         }
   1293         try {
   1294             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 3), INPUTSIZE);
   1295             scriptRelaxed.forEach_testFractHalf3Half3(inV, out);
   1296             verifyResultsFractHalf3Half3(inV, out, true);
   1297             out.destroy();
   1298         } catch (Exception e) {
   1299             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalf3Half3: " + e.toString());
   1300         }
   1301         inV.destroy();
   1302     }
   1303 
   1304     private void verifyResultsFractHalf3Half3(Allocation inV, Allocation out, boolean relaxed) {
   1305         short[] arrayInV = new short[INPUTSIZE * 4];
   1306         Arrays.fill(arrayInV, (short) 42);
   1307         inV.copyTo(arrayInV);
   1308         short[] arrayOut = new short[INPUTSIZE * 4];
   1309         Arrays.fill(arrayOut, (short) 42);
   1310         out.copyTo(arrayOut);
   1311         StringBuilder message = new StringBuilder();
   1312         boolean errorFound = false;
   1313         for (int i = 0; i < INPUTSIZE; i++) {
   1314             for (int j = 0; j < 3 ; j++) {
   1315                 // Extract the inputs.
   1316                 ArgumentsHalfHalf args = new ArgumentsHalfHalf();
   1317                 args.inV = arrayInV[i * 4 + j];
   1318                 args.inVDouble = Float16Utils.convertFloat16ToDouble(args.inV);
   1319                 // Figure out what the outputs should have been.
   1320                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed);
   1321                 CoreMathVerifier.computeFract(args, target);
   1322                 // Validate the outputs.
   1323                 boolean valid = true;
   1324                 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) {
   1325                     valid = false;
   1326                 }
   1327                 if (!valid) {
   1328                     if (!errorFound) {
   1329                         errorFound = true;
   1330                         message.append("Input inV: ");
   1331                         appendVariableToMessage(message, args.inV);
   1332                         message.append("\n");
   1333                         message.append("Expected output out: ");
   1334                         appendVariableToMessage(message, args.out);
   1335                         message.append("\n");
   1336                         message.append("Actual   output out: ");
   1337                         appendVariableToMessage(message, arrayOut[i * 4 + j]);
   1338                         message.append("\n");
   1339                         message.append("Actual   output out (in double): ");
   1340                         appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]));
   1341                         if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) {
   1342                             message.append(" FAIL");
   1343                         }
   1344                         message.append("\n");
   1345                         message.append("Errors at");
   1346                     }
   1347                     message.append(" [");
   1348                     message.append(Integer.toString(i));
   1349                     message.append(", ");
   1350                     message.append(Integer.toString(j));
   1351                     message.append("]");
   1352                 }
   1353             }
   1354         }
   1355         assertFalse("Incorrect output for checkFractHalf3Half3" +
   1356                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
   1357     }
   1358 
   1359     private void checkFractHalf4Half4() {
   1360         Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 4, 0xbbb6a781c8e09bf7l, false);
   1361         try {
   1362             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 4), INPUTSIZE);
   1363             script.forEach_testFractHalf4Half4(inV, out);
   1364             verifyResultsFractHalf4Half4(inV, out, false);
   1365             out.destroy();
   1366         } catch (Exception e) {
   1367             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalf4Half4: " + e.toString());
   1368         }
   1369         try {
   1370             Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 4), INPUTSIZE);
   1371             scriptRelaxed.forEach_testFractHalf4Half4(inV, out);
   1372             verifyResultsFractHalf4Half4(inV, out, true);
   1373             out.destroy();
   1374         } catch (Exception e) {
   1375             throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractHalf4Half4: " + e.toString());
   1376         }
   1377         inV.destroy();
   1378     }
   1379 
   1380     private void verifyResultsFractHalf4Half4(Allocation inV, Allocation out, boolean relaxed) {
   1381         short[] arrayInV = new short[INPUTSIZE * 4];
   1382         Arrays.fill(arrayInV, (short) 42);
   1383         inV.copyTo(arrayInV);
   1384         short[] arrayOut = new short[INPUTSIZE * 4];
   1385         Arrays.fill(arrayOut, (short) 42);
   1386         out.copyTo(arrayOut);
   1387         StringBuilder message = new StringBuilder();
   1388         boolean errorFound = false;
   1389         for (int i = 0; i < INPUTSIZE; i++) {
   1390             for (int j = 0; j < 4 ; j++) {
   1391                 // Extract the inputs.
   1392                 ArgumentsHalfHalf args = new ArgumentsHalfHalf();
   1393                 args.inV = arrayInV[i * 4 + j];
   1394                 args.inVDouble = Float16Utils.convertFloat16ToDouble(args.inV);
   1395                 // Figure out what the outputs should have been.
   1396                 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed);
   1397                 CoreMathVerifier.computeFract(args, target);
   1398                 // Validate the outputs.
   1399                 boolean valid = true;
   1400                 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) {
   1401                     valid = false;
   1402                 }
   1403                 if (!valid) {
   1404                     if (!errorFound) {
   1405                         errorFound = true;
   1406                         message.append("Input inV: ");
   1407                         appendVariableToMessage(message, args.inV);
   1408                         message.append("\n");
   1409                         message.append("Expected output out: ");
   1410                         appendVariableToMessage(message, args.out);
   1411                         message.append("\n");
   1412                         message.append("Actual   output out: ");
   1413                         appendVariableToMessage(message, arrayOut[i * 4 + j]);
   1414                         message.append("\n");
   1415                         message.append("Actual   output out (in double): ");
   1416                         appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]));
   1417                         if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) {
   1418                             message.append(" FAIL");
   1419                         }
   1420                         message.append("\n");
   1421                         message.append("Errors at");
   1422                     }
   1423                     message.append(" [");
   1424                     message.append(Integer.toString(i));
   1425                     message.append(", ");
   1426                     message.append(Integer.toString(j));
   1427                     message.append("]");
   1428                 }
   1429             }
   1430         }
   1431         assertFalse("Incorrect output for checkFractHalf4Half4" +
   1432                 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound);
   1433     }
   1434 
   1435     public void testFract() {
   1436         checkFractFloatFloatFloat();
   1437         checkFractFloat2Float2Float2();
   1438         checkFractFloat3Float3Float3();
   1439         checkFractFloat4Float4Float4();
   1440         checkFractFloatFloat();
   1441         checkFractFloat2Float2();
   1442         checkFractFloat3Float3();
   1443         checkFractFloat4Float4();
   1444         checkFractHalfHalfHalf();
   1445         checkFractHalf2Half2Half2();
   1446         checkFractHalf3Half3Half3();
   1447         checkFractHalf4Half4Half4();
   1448         checkFractHalfHalf();
   1449         checkFractHalf2Half2();
   1450         checkFractHalf3Half3();
   1451         checkFractHalf4Half4();
   1452     }
   1453 }
   1454