Test6796786.java revision 2444
2435N/A/*
2435N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
2435N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2435N/A *
2435N/A * This code is free software; you can redistribute it and/or modify it
2435N/A * under the terms of the GNU General Public License version 2 only, as
2435N/A * published by the Free Software Foundation.
2435N/A *
2435N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2435N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2435N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2435N/A * version 2 for more details (a copy is included in the LICENSE file that
2435N/A * accompanied this code).
2435N/A *
2435N/A * You should have received a copy of the GNU General Public License version
2435N/A * 2 along with this work; if not, write to the Free Software Foundation,
2435N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2435N/A *
2435N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2435N/A * or visit www.oracle.com if you need additional information or have any
2435N/A * questions.
2435N/A *
2435N/A */
2435N/A
2435N/A/**
2435N/A * @test
2435N/A * @bug 6796786
2435N/A * @summary invalid FP identity transform - (a - b) -> b - a
2435N/A *
2444N/A * @run main/othervm -Xbatch Test6796786
2435N/A */
2435N/A
2435N/Apublic class Test6796786 {
2435N/A static volatile float d1;
2435N/A static volatile float d2;
2435N/A
2435N/A public static void main(String[] args) {
2435N/A int total = 0;
2435N/A for (int i = 0; i < 100000; i++) {
2444N/A if (Float.floatToRawIntBits(- (d1 - d2)) == Float.floatToRawIntBits(-0.0f)) {
2435N/A total++;
2435N/A }
2435N/A }
2435N/A if (total != 100000) {
2435N/A throw new InternalError();
2435N/A }
2435N/A }
2435N/A}