This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 849279 - JDK calculates incorrectly
JDK calculates incorrectly
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: java-1.7.0-openjdk (Show other bugs)
23
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Orphan Owner
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-17 20:11 EDT by Need Real Name
Modified: 2016-12-20 07:17 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-12-20 07:17:40 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
The code (17.66 KB, text/x-java)
2012-08-17 20:13 EDT, Need Real Name
no flags Details
Same failure on Oracle jdk (17.78 KB, text/x-java)
2012-12-02 09:21 EST, Need Real Name
no flags Details

  None (edit)
Description Need Real Name 2012-08-17 20:11:05 EDT
Attached quartic polynomial solver (tested & debugged) 
fails on 
java version "1.7.0_05-icedtea"
OpenJDK Runtime Environment (fedora-2.2.1.fc17.9-x86_64)
OpenJDK 64-Bit Server VM (build 23.0-b21, mixed mode)


java  PolynomialRoot

!!!!!!!!n=4 test 787
!!!!!!!!n=4 test 788
!!!!!!!!n=4 test 789
!!!!!!!!n=4 test 790
Exception in thread "main" java.lang.RuntimeException: order=4  p[0]=0.0;p[1]=0.452284529771106;p[2]=0.54454120923573;p[3]=-0.06854826782854806;p[4]=0.6465099113690949;
         x.r=0.33797241959903046 x.i=0.284958330701781
res/sabs=0.02367127931554906 ims/sabs=0.037244001943407073 sabs=6.360407524751092
res=0.15055898307910312 ims=0.23688703021269064 n=4 eps=1.0E-6  sabs>1/eps=false f1=true f2=true  t=790
        at PolynomialRoot.checkValues(PolynomialRoot.java:424)
        at PolynomialRoot.testRoots(PolynomialRoot.java:491)
        at PolynomialRoot.main(PolynomialRoot.java:762)

In the same time 
on java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.6) (fedora-23.b16.fc10-x86_64)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
works OK
!!!!!!!!n=4 test 73631
!!!!!!!!n=4 test 73632
!!!!!!!!n=4 test 73633
!!!!!!!!n=4 test 73634
!!!!!!!!n=4 test 73635
!!!!!!!!n=4 test 73636
.....

Trying to enable println by settings PRINT_DEBUG=true
make the code working, no failure occur.
Comment 1 Need Real Name 2012-08-17 20:13:12 EDT
Created attachment 605282 [details]
The code

The code. Tested on 3 different computers. 
with 
 java -version
java version "1.7.0_05-icedtea"
OpenJDK Runtime Environment (fedora-2.2.1.fc17.9-x86_64)
OpenJDK 64-Bit Server VM (build 23.0-b21, mixed mode)

always give a failure above
Comment 2 Need Real Name 2012-08-18 16:55:27 EDT
Interesting that 
 java -XX:LoopUnrollLimit=1 PolynomialRoot 
give no this error on 
java -version
java version "1.7.0_05-icedtea"
OpenJDK Runtime Environment (fedora-2.2.1.fc17.9-x86_64)
OpenJDK 64-Bit Server VM (build 23.0-b21, mixed mode)

java -XX:LoopUnrollLimit=1 PolynomialRoot 
.......
!!!!!!!!n=4 test 30977
!!!!!!!!n=4 test 30978
!!!!!!!!n=4 test 30979
!!!!!!!!n=4 test 30980
!!!!!!!!n=4 test 30981
.......
Comment 3 Need Real Name 2012-08-18 16:57:36 EDT
There is just a single relevant  loop in attached code:

    int jmin=0;
      double vmin=Math.abs(u[jmin]);
      for(int j=1;j<3;j++)
      {
	  final double vx=Math.abs(u[j]);
	  if(vx<vmin)
	  {
	      vmin=vx;
	      jmin=j;
	  }
      }
      final double u1=u[(jmin+1)%3],u2=u[(jmin+2)%3];
Comment 4 Need Real Name 2012-08-18 17:13:22 EDT
The option
java  -XX:-UseLoopPredicate   PolynomialRoot
also make the unit test passing OK
Comment 5 Need Real Name 2012-08-18 18:22:56 EDT
And setting two options simultaneously
java -XX:LoopUnrollLimit=1 -XX:-UseLoopPredicate   PolynomialRoot
give an error 
!!!!!!!!n=4 test 779
!!!!!!!!n=4 test 780
!!!!!!!!n=4 test 781
Exception in thread "main" java.lang.RuntimeException: order=4  p[0]=-0.3643937449673187;p[1]=0.26975356192753797;p[2]=0.469327423289146;p[3]=0.5513987308711439;p[4]=0.4989414549559419;
         x.r=-0.22593059759284145 x.i=0.8351448422318095
res/sabs=-0.02103905708525171 ims/sabs=0.0025556115548346493 sabs=16.016871636436743
res=-0.3369798766861416 ims=0.0409329022263811 n=4 eps=1.0E-6  sabs>1/eps=false f1=true f2=true  t=781
        at PolynomialRoot.checkValues(PolynomialRoot.java:424)
        at PolynomialRoot.testRoots(PolynomialRoot.java:491)
        at PolynomialRoot.main(PolynomialRoot.java:762)

as well as 
java -XX:LoopUnrollLimit=0  -XX:-UseLoopPredicate   PolynomialRoot
!!!!!!!!n=4 test 809
!!!!!!!!n=4 test 810
Exception in thread "main" java.lang.RuntimeException: order=4  p[0]=-0.7203446925952928;p[1]=0.9162323551969194;p[2]=0.7020835015265718;p[3]=0.6581445844611;p[4]=0.65585375261305;
         x.r=-0.05428215319033669 x.i=0.9322319811155485
res/sabs=-0.04156563071819642 ims/sabs=0.0192423628643677 sabs=19.243195867204115
res=-0.7998555732541297 ims=0.3702845575468425 n=4 eps=1.0E-6  sabs>1/eps=false f1=true f2=true  t=810
        at PolynomialRoot.checkValues(PolynomialRoot.java:424)
        at PolynomialRoot.testRoots(PolynomialRoot.java:491)
        at PolynomialRoot.main(PolynomialRoot.java:762)


but again. Single -XX:LoopUnrollLimit=1 or -XX:-UseLoopPredicate 
produce no error
But together they do produce an error (as well as when the code is run without any option)


single option produce no error
Comment 6 Need Real Name 2012-08-22 15:38:28 EDT
Another thing - the failure almost never occur on a computer with high load.
Idle computer give a failure almost immediately.
Comment 7 Need Real Name 2012-11-27 01:20:13 EST
Still the same problem in 
java -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (fedora-2.3.3.fc17.1-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
Comment 8 Need Real Name 2012-12-02 09:21:32 EST
Created attachment 656014 [details]
Same failure on Oracle jdk

same thing with Oracle JDK

 java -version
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)

java PolynomialRoot
.....

!!!!!!!!n=4 test 777
!!!!!!!!n=4 test 778
!!!!!!!!n=4 test 779
Exception in thread "main" java.lang.RuntimeException: order=4  p[0]=0.9757454361894038;p[1]=0.0;p[2]=-0.9063855238682716;p[3]=0.8365853061995829;p[4]=-0.48284015470752206;
         x.r=0.6072512814712652 x.i=0.9978109661117348
res/sabs=0.05808884723864624 ims/sabs=-0.021584173284394766 sabs=12.62240660496392
res=0.7332210490598285 ims=-0.2724442114276303 n=4 eps=1.0E-6  sabs>1/eps=false f1=true f2=true  t=779
        at PolynomialRoot.checkValues(PolynomialRoot.java:426)
        at PolynomialRoot.testRoots(PolynomialRoot.java:493)
        at PolynomialRoot.main(PolynomialRoot.java:764)
Comment 9 Need Real Name 2012-12-02 09:23:57 EST
And disabling hotspot 
java -Xint PolynomialRoot
Make the test passing OK
Comment 10 Need Real Name 2012-12-12 16:47:15 EST
This well documented with test case provided bug some time ago 
was submitted to Oracle java bug database as  2396372

There is no reaction. Same thing with other bugs I submitted to Oracle.
java development at Oracle 
is stalled and Oracle does not care about bugs.

Can somebody look at fix this bug here. The test case is provided. 
It should not be difficult.
Comment 11 Fedora End Of Life 2013-12-21 03:41:37 EST
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 12 Fedora Admin XMLRPC Client 2014-06-25 11:44:03 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 13 Jan Kurik 2015-07-15 11:04:14 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23
Comment 14 Fedora End Of Life 2016-11-24 05:43:34 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 15 Fedora End Of Life 2016-12-20 07:17:40 EST
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.