JVM Strict Sensitivity Example

We all know how strictfp works .

Something like that:

package com.hk.basicjava.tests.strictfp;

import java.util.*;

public class StrictFP {
    public static void main(String[] argv) {
        double d = Double.MIN_VALUE; 
        System.out.println("non strictfp : " + notStrictFP(d)); // may be 4.9E-324
        System.out.println("strictfp : " + strictFP(d)); // should be 0
    }

    static double notStrictFP(double a) {
        return (a / 2 ) * 2;
    }
    static strictfp double strictFP(double a) {
        return (a / 2 ) * 2 ;
    }
}

But does anyone know a specific hardware / OS (and possibly JRE) combination where there is a difference in the results returned by methods with and without strictfp ?

I tried several combinations, but there was no difference.

+5
source share
1 answer

, : Double.MIN_VALUE; , . , , , . strictfp , JVM , .

0

All Articles