diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-04-28 20:26:41 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-04-28 20:26:41 +0000 |
commit | 3a8788228a7105279ef349092131fa6475620665 (patch) | |
tree | 9159ef66bd6dd746709e3627a186e1c6cfec61d8 | |
parent | 34782740fca3518981d05dcb7be29c0d34d4073d (diff) | |
parent | e4b2d03505a4f1b6ea42ba026fb05e996de6256b (diff) | |
download | crcalc-android12-mainline-tzdata-release.tar.gz |
Snap for 6439596 from e4b2d03505a4f1b6ea42ba026fb05e996de6256b to qt-aml-tzdata-releaseq_tzdata_aml_297100400q_tzdata_aml_297100300q_tzdata_aml_297100000q_tzdata_aml_296200000q_tzdata_aml_295600118q_tzdata_aml_295600110q_tzdata_aml_295500002q_tzdata_aml_295500001q_tzdata_aml_294400310android-mainline-12.0.0_r54android-mainline-12.0.0_r111android-mainline-10.0.0_r13android-mainline-10.0.0_r12android-mainline-10.0.0_r11q_tzdata_aml_297100000android12-mainline-tzdata-releaseandroid10-mainline-tzdata-releaseandroid10-android13-mainline-tzdata-release
Change-Id: Ib69e7a7a0470f6b43cff0c38e5e3291f663fe378
-rw-r--r-- | src/com/hp/creals/CR.java | 16 | ||||
-rw-r--r-- | tests/README.txt | 6 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/com/hp/creals/CR.java b/src/com/hp/creals/CR.java index 20f88e6..c5a1c41 100644 --- a/src/com/hp/creals/CR.java +++ b/src/com/hp/creals/CR.java @@ -116,9 +116,6 @@ // hboehm@google.com 11/20/2018. // Fix an exception-safety issue in gl_pi_CR.approximate. // hboehm@google.com 3/3/2019. -// Near-overflow floating point exponents were not handled correctly in -// doubleValue(). Fixed. -// hboehm@google.com 7/23/2019. package com.hp.creals; @@ -416,7 +413,7 @@ public volatile static boolean please_stop = false; { int prec = 0; - for (; prec > n + 30; prec = (prec * 3)/2 - 16) { + for (;prec > n + 30; prec = (prec * 3)/2 - 16) { int msd = msd(prec); if (msd != Integer.MIN_VALUE) return msd; check_prec(prec); @@ -750,11 +747,10 @@ public volatile static boolean please_stop = false; long scaled_int_rep = Double.doubleToLongBits(scaled_int); long exp_adj = may_underflow? needed_prec + 96 : needed_prec; long orig_exp = (scaled_int_rep >> 52) & 0x7ff; - // Original unbiased exponent is > 50. Exp_adj > -1050. - // Thus the sum must be > the smallest representable exponent - // of -1023. - if (orig_exp + exp_adj >= 0x7ff) { - // Exponent overflowed. + if (((orig_exp + exp_adj) & ~0x7ff) != 0) { + // Original unbiased exponent is > 50. Exp_adj > -1050. + // Thus this can overflow the 11 bit exponent only if the result + // itself overflows. if (scaled_int < 0.0) { return Double.NEGATIVE_INFINITY; } else { @@ -764,8 +760,6 @@ public volatile static boolean please_stop = false; scaled_int_rep += exp_adj << 52; double result = Double.longBitsToDouble(scaled_int_rep); if (may_underflow) { - // Exponent is too large by 96. Compensate, relying on fp arithmetic - // to handle gradual underflow correctly. double two48 = (double)(1L << 48); return result/two48/two48; } else { diff --git a/tests/README.txt b/tests/README.txt index e8aca3a..6cedac3 100644 --- a/tests/README.txt +++ b/tests/README.txt @@ -1,14 +1,14 @@ Run on Android with 1) Build the tests. -2) adb install <tree root>/out/target/product/<name>/testcases/CRTests/arn64/CRTests.apk +2) adb install <tree root>/out/target/product/<name>/data/app/CRTests/CRTests.apk 3) adb shell am instrument -w com.hp.creals.tests/android.test.InstrumentationTestRunner -Depending on the device, the last step may take a while. +The last step takes around 10 minutes on a Nexus 5. (CRTest is quick, SlowCRTest is not, especially not the final trig function test.) -Note that Random seeds are not set. Hence repeated runs should improve +Note that Random seeds are not set. Hence repreated runs should improve coverage at the cost of reproducibility. Failing arguments should however be printed. |