Re: [PATCH] 4511638: Double.toString(double) sometimes produces incorrect results

2018-09-28 Thread Dmitry Nadezhin
I would like to tell about some steps towards formal check of Raffaello's human proof. I work on formal verification of some Oracle projects but they are unrelated to JDK. In April Brian Burkhalter requested me to review the Raffaello's paper. His paper is smart and clear but nevertheless I was afr

Re: JDK 9 RFR of JDK-4851642: Add fused mac to Java math library

2016-04-15 Thread Dmitry Nadezhin
I think that the final webrev http://cr.openjdk.java.net/~darcy/4851642.2/ is good. Thanks. On Fri, Apr 15, 2016 at 8:00 AM, joe darcy wrote: > Hi Dmitry, > > On 4/14/2016 7:43 PM, Dmitry Nadezhin wrote: > > Hi Joe, > > It looks good except a guard expression in the line Ma

Re: JDK 9 RFR of JDK-4851642: Add fused mac to Java math library

2016-04-14 Thread Dmitry Nadezhin
Hi Joe, It looks good except a guard expression in the line Math:1550 (tmp == 0.0 && a == 0.0 || b == 0.0) Variables a and b occur asymmetrically in this expression. A symmetrical expression would be either (a == 0.0 || b == 0.0) or (product.signum() == 0) On Fri, Apr 15, 2016 at 3:14 AM, joe dar

Re: JDK 9 RFR of JDK-4851642: Add fused mac to Java math library

2016-04-13 Thread Dmitry Nadezhin
Joe, Here are my comments. 1) Probably in lines StrictMath:1171, StrictMath:1220, Math:1487, Math:1593 you meant {@code -0.0 * +0.0} {@code -0.0f * +0.0f} 2) Lines Math:1508-1525 could be simpler: double result = a * b + c; return Double.isNaN(result) && Double.isFinite(a) && Doub

Re: 8014320 ready for review

2014-02-07 Thread Dmitry Nadezhin
I'm curious to compare performance on huge numbers between this pure Java implementation of SS and some native implementation of SS (libgmp, for example). On Thu, Feb 6, 2014 at 9:22 PM, Tim Buktu wrote: > Hi, > > 8014320 is a JDK9 enhancement and everybody is probably busy with JDK8, > but I

Re: BigDecimal performance

2014-02-07 Thread Dmitry Nadezhin
I think that better name is BigBinary. Both BigDecimal and BigBinary are floating-point number with radix=10 and radix=2 respectively. More general approach is an abstract class or interface Rational which has implementation subclasses. Each nonzero rational number P/Q can be represented as P/Q =

Re: Bug in Long.parseUnsignedLong

2013-12-23 Thread Dmitry Nadezhin
t) (first >>> 57); > if (guard >= 128 || (result >= 0 && guard >= 128 - Character.MAX_RADIX)) { > … > > provided reasonable comments were added. I understand the first part of > this conditional, guard >= 128, but the second part eludes me. Would you > please

Re: Bug in Long.parseUnsignedLong

2013-12-21 Thread Dmitry Nadezhin
&& (guard >= (1 << GUARD_BIT) || result >= 0)) { . . . On Fri, Dec 20, 2013 at 10:48 PM, Louis Wasserman wrote: > @Paul Sandoz: Is there a particular reason you prefer an extra division to > the cache? > > > On Fri, Dec 20, 2013 at 8:54 AM, Dmitry Nadezh

Re: Bug in Long.parseUnsignedLong

2013-12-20 Thread Dmitry Nadezhin
What is performance of Long.compareUnsigned(x, y) ? Does HotSpot implement it as a call of Long.compare(x + MIN_VALUE, y + MIN_VALUE) or as a single machine instruction ? On Fri, Dec 20, 2013 at 7:53 PM, Paul Sandoz wrote: > Hi Brian, > > It would be nice to avoid the caches, on a hunch i am w

Re: BigInteger Burnikel-Ziegler division algorithm crossover heuristic

2013-11-23 Thread Dmitry Nadezhin
Time complexity of Knuth divide a/b=q approximately the same as complexity of school multiplication b*q and is length(b)*length(q) = length(b) * (length(a) - length(b)). So the new heuristic seems reasonable for me. On Sat, Nov 23, 2013 at 1:47 AM, Brian Burkhalter < brian.burkhal...@oracle.com>

Re: RFC 6910473: BigInteger negative bit length, value range, and future prospects

2013-10-21 Thread Dmitry Nadezhin
18/10/2013 17:24, Dmitry Nadezhin wrote: > >> The WebRev with @ignore in SymmetricRangeTests is here: >> http://cr.openjdk.java.net/~**bpb/6910473/webrev.3/<http://cr.openjdk.java.net/~bpb/6910473/webrev.3/> >> >> jtreg ignores the test with a message >> &q

Re: RFC 6910473: BigInteger negative bit length, value range, and future prospects

2013-10-18 Thread Dmitry Nadezhin
;. On Fri, Oct 18, 2013 at 2:12 PM, Alan Bateman wrote: > On 17/10/2013 15:59, Dmitry Nadezhin wrote: > >> Another solution may be to exclude the SymmetricRangeTests from automatic >> test runs, >> and to keep this file somewhere for manual tests runs only. >> What d

Re: RFC 6910473: BigInteger negative bit length, value range, and future prospects

2013-10-17 Thread Dmitry Nadezhin
-ignore:run . On Thu, Oct 17, 2013 at 6:59 PM, Dmitry Nadezhin wrote: > Another solution may be to exclude the SymmetricRangeTests from automatic > test runs, > and to keep this file somewhere for manual tests runs only. > What do you think about this ? > Can this be implemente

Re: RFC 6910473: BigInteger negative bit length, value range, and future prospects

2013-10-17 Thread Dmitry Nadezhin
Another solution may be to exclude the SymmetricRangeTests from automatic test runs, and to keep this file somewhere for manual tests runs only. What do you think about this ? Can this be implemented in jtreg (for example by "@key hugeMemory" tag) ? On Thu, Oct 17, 2013 at 2:18 PM, Alan Bateman w

Re: RFC 6910473: BigInteger negative bit length, value range, and future prospects

2013-10-16 Thread Dmitry Nadezhin
Thank you, Paul. I tried to combine your and Joe's suggestions in the updated WebRev: http://cr.openjdk.java.net/~bpb/6910473/webrev.2/ -Dima On Tue, Oct 15, 2013 at 12:20 PM, Paul Sandoz wrote: > Hi, > > I took a look at the patch, but i am not an expert in this area. > > On BigInteger: > >

Re: RFC 6910473: BigInteger negative bit length, value range, and future prospects

2013-10-01 Thread Dmitry Nadezhin
be > documented, but I daresay most applications won't ever check for it and > produce incorrect results as a consequence. > > Gili > > > On 01/10/2013 2:19 PM, Dmitry Nadezhin wrote: > >> Dear BigInteger experts, >> Do you have comments to my previous messa

Re: RFC 6910473: BigInteger negative bit length, value range, and future prospects

2013-10-01 Thread Dmitry Nadezhin
Dear BigInteger experts, Do you have comments to my previous message ? http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-September/021264.html On Sat, Sep 21, 2013 at 8:13 AM, Dmitry Nadezhin wrote: > It is important that BigInteger objects be full-fledged instances on which &g

Re: RFC 6910473: BigInteger negative bit length, value range, and future prospects

2013-09-20 Thread Dmitry Nadezhin
It is important that BigInteger objects be full-fledged instances on which all methods may be correctly invoked. This bitLength bug started this discussion: P4 JDK-6910473 : java.math.BigInteger.bitLength() may return negative "int" on large numbers https://bugs.openjdk.java.net/browse/JDK-6910473

Re: JDK 7u-dev review request 8024356: Double.parseDouble() is slow for long Strings

2013-09-13 Thread Dmitry Nadezhin
w (JDK7) and to 768 > (0x003) in JDK8. The latter will require another issue to be filed. > > On Sep 12, 2013, at 9:25 PM, Dmitry Nadezhin wrote: > > > For me, it is the only consideration. > > I'm sure in 768 because I proved it formally using ACL2 tool. > > > >

Re: JDK 7u-dev review request 8024356: Double.parseDouble() is slow for long Strings

2013-09-12 Thread Dmitry Nadezhin
n the context of the test. > > > On 09/12/2013 10:13 PM, Dmitry Nadezhin wrote: > >> Should we change conservative constant 1100 to optimal constant 768 ? >> My opinion is no (in JDK7), because the constant 1100 has lower cost of >> review. >> I mean that chances t

Re: JDK 7u-dev review request 8024356: Double.parseDouble() is slow for long Strings

2013-09-12 Thread Dmitry Nadezhin
Burkhalter < brian.burkhal...@oracle.com> wrote: > On Sep 12, 2013, at 1:00 PM, David Chase wrote: > > On 2013-09-12, at 1:17 AM, Dmitry Nadezhin > wrote: > > The optimal constant for double conversion could be 768 , > > the optimal constant for float conversion coul

Re: JDK 7u-dev review request 8024356: Double.parseDouble() is slow for long Strings

2013-09-12 Thread Dmitry Nadezhin
n Sep 12, 2013, at 11:10 AM, Dmitry Nadezhin wrote: > > Aleksey, I like your wording of the comment. Thank you very much. > > I would reformulate a little: > <<< > We can demonstrate () that decimal ulp should be less than 10^(-1075) > to guarantee correctness > === >

Re: JDK 7u-dev review request 8024356: Double.parseDouble() is slow for long Strings

2013-09-12 Thread Dmitry Nadezhin
d decimal ulp 10^(-53) is enough . On Thu, Sep 12, 2013 at 6:32 PM, Aleksey Shipilev < aleksey.shipi...@oracle.com> wrote: > On 09/12/2013 09:17 AM, Dmitry Nadezhin wrote: > > The patch is correct when decimal ULP of kept digits is pow(10,-1075) > > of less. pow(2,53) has

Re: JDK 7u-dev review request 8024356: Double.parseDouble() is slow for long Strings

2013-09-12 Thread Dmitry Nadezhin
ers of binary digits (1075) > and numbers of decimal digits (17), and therefore makes me a little > nervous, though I think 1100 is a conservative choice that, even if not > 100% correct, will be 99.(over 700 9s)% correct. > > David > > On 2013-09-12, at 1:17 AM, Dmitry Nadez

Re: JDK 7u-dev review request 8024356: Double.parseDouble() is slow for long Strings

2013-09-11 Thread Dmitry Nadezhin
The short answer: because it is a backport to JDK 7 of part of this JDK 8 change: http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-June/017958.html The long answer is the theory behind the change. Java conversion from decimal string to double is specified as if it happens in two steps: 1)

Re: Java 8 RFR 8010430: Math.round has surprising behavior for odd values of ulp 1

2013-08-28 Thread Dmitry Nadezhin
lter < brian.burkhal...@oracle.com> wrote: > On Aug 27, 2013, at 7:44 PM, Dmitry Nadezhin wrote: > > Is it reasonable to make specification clearer ? > > Either to return JLS 1 specification: > <<< > The result is rounded to an integer by adding , taking the

Re: Java 8 RFR 8010430: Math.round has surprising behavior for odd values of ulp 1

2013-08-27 Thread Dmitry Nadezhin
sitive infinity": <<< Returns the closest {@code int} to the argument, with ties rounding to positive infinity. >>> On Tue, Aug 27, 2013 at 3:19 AM, Brian Burkhalter < brian.burkhal...@oracle.com> wrote: > On Aug 26, 2013, at 7:52 AM, Guy Steele wrote: > > On

Re: Java 8 RFR 8010430: Math.round has surprising behavior for odd values of ulp 1

2013-08-23 Thread Dmitry Nadezhin
uld expect. For what it's worth, this is what appears to be > implemented in the C language (GCC 4.2.1). > > Brian > > On Aug 23, 2013, at 1:44 PM, Dmitry Nadezhin wrote: > > > I guess that the method java.lang.Math.round() should correspond to > > roundToInteg

Re: Java 8 RFR 8010430: Math.round has surprising behavior for odd values of ulp 1

2013-08-23 Thread Dmitry Nadezhin
= (int)a > > or > > a == (long)a > > so there really is no tie, unless I am missing something. The problem is > that in the current implementation the intermediate result > > a + 0.5 > > is rounded according to the IEEE standard so the conditions above are no > l

Re: Java 8 RFR 8010430: Math.round has surprising behavior for odd values of ulp 1

2013-08-23 Thread Dmitry Nadezhin
The specification of java.lang.Math.round() says * Returns the closest {@code int} to the argument, with ties * rounding up. It is not clarified what is "ties rounding up". I guess that it should correspond to the direction "roundTiesToAway" of IEEE 754-2008 and to the java.math.RoundingM

Re: RFR 8017540: Improve multi-threaded contention behavior of BigInteger.toString() radix conversion cache

2013-06-25 Thread Dmitry Nadezhin
teger[][] pc = Arrays.copyOf(powerCache); pc[radix] = cacheLine; powerCache = pc; // volatile write, publish } return cacheLine[exponent]; } On Wed, Jun 26, 2013 at 10:31 AM, Aleksey Shipilev < aleksey.shipi...@oracle.com> wrote: > On 26.06.2013, at 7:31, Dmitry Nadezhin wro

Re: RFR 8017540: Improve multi-threaded contention behavior of BigInteger.toString() radix conversion cache

2013-06-25 Thread Dmitry Nadezhin
, 2013 at 11:53 PM, Aleksey Shipilev < aleksey.shipi...@oracle.com> wrote: > On 06/25/2013 11:36 PM, Dmitry Nadezhin wrote: > > What about such code ? > > > > BigInteger getRadixConversionCache(int radix, int exponent) { > > BigInteger retVal = null; > &

Re: RFR 8017540: Improve multi-threaded contention behavior of BigInteger.toString() radix conversion cache

2013-06-25 Thread Dmitry Nadezhin
What about such code ? BigInteger getRadixConversionCache(int radix, int exponent) { BigInteger retVal = null; BigInteger[][] pc = powerCache; // volatile read BigInteger[] cacheLine = pc[radix]; int oldSize = cacheLine.length; if (exponent >= oldSize) { cacheLine = Arrays.copyOf(c

Re: What is the range of BigInteger values ?

2013-06-25 Thread Dmitry Nadezhin
, Dmitry Nadezhin wrote: > Primitive integer types have well-specified value ranges > byte [ -pow(2,7) , pow(2,7) ) > short [ -pow(2,15) , pow(2,15) ) > int [ -pow(2,31) , pow(2,31) ) > long [ -pow(2,63) , pow(2,63) ) . > > Primitive operations on these types wrap-aroun

What is the range of BigInteger values ?

2013-06-25 Thread Dmitry Nadezhin
Primitive integer types have well-specified value ranges byte [ -pow(2,7) , pow(2,7) ) short [ -pow(2,15) , pow(2,15) ) int [ -pow(2,31) , pow(2,31) ) long [ -pow(2,63) , pow(2,63) ) . Primitive operations on these types wrap-around in case of overflow, but there are methods which throws Arith

Re: RFR 4641897: Faster string conversion of large integers

2013-06-22 Thread Dmitry Nadezhin
pc[radix] = cacheLine; ! powerCache = pc; // publish by volatile write ! } else ! retVal = cacheLine[exponent]; return retVal; } /* zero[i] is a string of i consecutive zeros. */ On Sat, Jun 22, 2013 at 3:59 PM, Dmitry Nadezhin wr

Re: RFR 4641897: Faster string conversion of large integers

2013-06-22 Thread Dmitry Nadezhin
acle.com> wrote: > On 06/22/2013 02:50 PM, Aleksey Shipilev wrote: > > On 06/22/2013 08:06 AM, Dmitry Nadezhin wrote: > >> Alexey, > >> > >> Each possible radix has its cacheLine in the cache. > >> > >> Cache contents looks like > >> B

Re: RFR 4641897: Faster string conversion of large integers

2013-06-22 Thread Dmitry Nadezhin
System.out.println("bitLength=" + bi.bitLength() + ";\t" + (time1 - time0) / 1e9 + " sec\t" + (time2 - time1) / 1e9 + " sec"); } n *= 2; bi = bi.shiftLeft(n).add(bi); } } } On Sat, Jun 22,

Re: RFR 4641897: Faster string conversion of large integers

2013-06-21 Thread Dmitry Nadezhin
Brian, This patch significally enhances performance of string conversion for large numbers. I suggest to create also a fast path for power-of-two radices: 2, 4, 8, 16, 32 . It is a simple linear algorithm that is suitable both for large and small numbers. Can it be attached to this bug activity

Re: RFR 4641897: Faster string conversion of large integers

2013-06-21 Thread Dmitry Nadezhin
Alexey, Each possible radix has its cacheLine in the cache. Cache contents looks like BigInteger[][] powerCache = new BigInteger[37] { /*0*/ null, /*1*/ null, /*2*/ new BigInteger[] { 2, 4, 16, 256, 32768, ... }, /*3*/ new BigInteger[] { 3, 9, 81, ... }, /*4*/ new BigInteger[] { 4, 16, 256, ... }

Re: Review: 7032154 - Performance tuning of sun.misc.FloatingDecimal/FormattedFloatingDecimal

2013-03-08 Thread Dmitry Nadezhin
Alan, I guess that one of the reasons for all these classes (MutableBigInteger and SignedMutableBigInteger, FDBigInteger) is that they are mutable. The immutable class java.math.BigInteger will require more memory allocations. The efficient conversion from string to double has some aspects that a

Re: [PATCH] Sunbug 7131192: Optimize BigInteger.doubleValue(), floatValue()

2013-02-25 Thread Dmitry Nadezhin
Hi Brian, The reported benchmark results are impressive: http://bugs.sun.com/view_bug.do?bug_id=7032154 Where can we find the 7032154 patch to review it ? Dima On Tue, Feb 26, 2013 at 12:50 AM, Brian Burkhalter wrote: > Hi Dima, > > On Feb 25, 2013, at 1:14 AM, Dmitry Nadezhin wro

Re: [PATCH] Sunbug 7131192: Optimize BigInteger.doubleValue(), floatValue()

2013-02-25 Thread Dmitry Nadezhin
Hi Louis, I looked at your fix of sunbug=6358355 "Fix Float.parseFloat to round correctly and preserve monotonicity". https://bugs.openjdk.java.net/show_bug.cgi?id=100208 I like how you separate String->double and String->float conversions. They both become more clear. However I found two issues.

Re: Withdraw: Review: 4396272 - Parsing doubles fails to follow IEEE for largest decimal that should yield 0

2013-02-22 Thread Dmitry Nadezhin
uppose if a > clean build of the JDK does not complain then it is acceptable and correct. > > Thanks, > > Brian > > On Feb 22, 2013, at 9:41 AM, Dmitry Nadezhin wrote: > > So I think that the required change in FormattedFloatingDecimal is to > delete methods > doub

Re: Withdraw: Review: 4396272 - Parsing doubles fails to follow IEEE for largest decimal that should yield 0

2013-02-22 Thread Dmitry Nadezhin
gt; Thanks, > > Brian > > On Feb 21, 2013, at 7:27 PM, Dmitry Nadezhin wrote: > >> Do you want that I prepare this FloatingDecimal/FormattedFloatingDecimal >> patch ? >> >> -Dima >> >> On Fri, Feb 22, 2013 at 2:32 AM, Brian Burkhalter >> wro

Re: Withdraw: Review: 4396272 - Parsing doubles fails to follow IEEE for largest decimal that should yield 0

2013-02-21 Thread Dmitry Nadezhin
Do you want that I prepare this FloatingDecimal/FormattedFloatingDecimal patch ? -Dima On Fri, Feb 22, 2013 at 2:32 AM, Brian Burkhalter wrote: > I am withdrawing this patch for the time being as properly the changes should > also go into the fork sun.misc.FormattedFloatingDecimal. I'll post

Re: Fraction

2012-01-09 Thread Dmitry Nadezhin
Hello Joe, Thank you for the clarification. What do you think about using BigBinary to solve the problem of a calculation class with higher precision. BigBinary implements arbitrary precision binary floating-point numbers and arithmetic operations on them. Although it rounds, the precision and ro

Re: Code review request for 4900206 "Include worst-case rounding tests for Math library functions"

2011-08-11 Thread Dmitry Nadezhin
Your fix adds worst-case rounding tests for math functions. It may also be useful to include worst-case rounding tests for number conversions (string-to-double). I have explored string-to-double issues, including problems when the converted numbers are close to the breakpoints between doubles. T

Re: Need reviewer for forward port of 6815768 (File.getXXXSpace) and 6815768 (String.hashCode)

2010-02-27 Thread Dmitry Nadezhin
Ulf, I ran Caliper benchmarks on different variants of hashCode(). http://code.google.com/p/caliper/ The results and the Caliper code are below: -Dima - -d32 -clien 0% Scenario{vm=java -d32 -client, benchmark=HashCodeEmpty} 8,85ns; σ=0,06ns @ 3 trials 8% Scenario{vm=java -d32 -client

Re: Need reviewer for forward port of 6815768 (File.getXXXSpace) and 6815768 (String.hashCode)

2010-02-26 Thread Dmitry Nadezhin
On Fri, Feb 26, 2010 at 6:19 PM, Ulf Zibis wrote: > Am 26.02.2010 12:52, schrieb Dmitry Nadezhin: > > I found two alternatives in the link >> http://mail.openjdk.java.net/pipermail/coin-dev/2009-December/002618.html >> The first alternative >> int equalByHash

Re: Need reviewer for forward port of 6815768 (File.getXXXSpace) and 6815768 (String.hashCode)

2010-02-26 Thread Dmitry Nadezhin
I found two alternatives in the link http://mail.openjdk.java.net/pipermail/coin-dev/2009-December/002618.html The first alternative int equalByHashThreshold = 2; public boolean equals(Object anObject) { if (this == anObject) { return true; } if (anObject instanceof String) { Stri

Math project or subproject

2010-01-29 Thread Dmitry Nadezhin
In my previous post I discussed choice criteria for performance enhancements in math libraries. I guess that in production projects Jdk 1.6 and Jdk 1.7 the main choice criteria is stability. This explains why changes to math stuff in Java are almost impossible. Here is a pair of examples: 1) T

core-libs-dev@openjdk.java.net

2010-01-29 Thread Dmitry Nadezhin
Martin, Thank you for the answer. I found your benchmark in "jdk/test/java/util/ArrayList". Also I see an example of microbenchmark included in the post to core-libs-dev: http://mail.openjdk.java.net/pipermail/core-libs-dev/2009-November/003226.html . Its nice to keep such microbenchmarks in

core-libs-dev@openjdk.java.net

2010-01-24 Thread Dmitry Nadezhin
Joe, I'm interested in micro-benchmarking of math in OpenJDK . This includes a choice of proper framework, a choice of representative patterns (or testsuites). Will math micro-benchmarking be ever hosted by OpenJDK ? Or I should develop them elsewhere ? -Dima You might be interested in a rece

core-libs-dev@openjdk.java.net

2010-01-24 Thread Dmitry Nadezhin
Jeff, This is a really interesting link. However, I have doubts with licensing. The owner of this project is "omaamo". He marked FastMath.java with LGPL v3 or later. It seems to me that LGPL v3 is not compatible with OpenJDK's GPL v2. OpenJDK can't include fragments of LGPL v3 code without perm

core-libs-dev@openjdk.java.net

2010-01-22 Thread Dmitry Nadezhin
Jeff, I want to take a look at it, but I didn't find your post in this mailing list. Please give us a direct link to the FastMath sources. -Dima Jeff Hain wrote: PS : The ceil and floor I posted here are an extract of a FastMath class (I already see some people in this mailing list inv

core-libs-dev@openjdk.java.net

2010-01-20 Thread Dmitry Nadezhin
Jeff, Your"ceil" and "floor" seems correct for me. I benchmarked your code by attached benchmark program. It is faster on some test patterns and with some Jvm options and it is slower on some others. Joe, I'm curious how performance decisions are made in Jdk development process. Are there per

core-libs-dev@openjdk.java.net

2009-12-14 Thread Dmitry Nadezhin
f the returned result and monotonicity of the methods. Suppose that there is still a bug in fdlibm 5.3 and some fdlibm function fails to satisfy one ulp accuracy or monotonicity. What will be the specification of corresponding java.lang.StrictMath method in such a case ? Joseph D. Darcy wrote: Dm

core-libs-dev@openjdk.java.net

2009-12-14 Thread Dmitry Nadezhin
Joseph D. Darcy wrote: Yes, porting FDLIBM to Java has been an oft-delayed "nice to have" project of mine. It is not obvious from looking at my ceil/floor code, but it started with the FDLIBM versions of those algorithms. The tests are new and greatly outnumber the code changes, as it typica

Re: Request for sponsor: 4421494 infinite loop while parsing double literal

2009-11-15 Thread Dmitry Nadezhin
I put a combined changeset fixing bugs 4421494 and 4396272 as comment #2 and comment #3 to OpenJDK bugzilla report: https://bugs.openjdk.java.net/show_bug.cgi?id=100119 -Dima Joseph D. Darcy wrote: Dmitry Nadezhin wrote: Hello Joe, Thank you for the sponsorship of the bug 4421494. I can

Re: Request for sponsor: 4421494 infinite loop while parsing double literal

2009-11-10 Thread Dmitry Nadezhin
e JDK ? -Dima Dmitry Nadezhin wrote: http://bugs.sun.com/view_bug.do?bug_id=4421494 https://bugs.openjdk.java.net/show_bug.cgi?id=100119 Summary: This old bug report says that Double.parseDouble(s) hangs for decimal strings in range (Double.MIN_NORMAL-0.5*Double.MIN_VALUE,Double.MIN), and returns inco

Request for sponsor: 4421494 infinite loop while parsing double literal

2009-11-05 Thread Dmitry Nadezhin
http://bugs.sun.com/view_bug.do?bug_id=4421494 https://bugs.openjdk.java.net/show_bug.cgi?id=100119 Summary: This old bug report says that Double.parseDouble(s) hangs for decimal strings in range (Double.MIN_NORMAL-0.5*Double.MIN_VALUE,Double.MIN), and returns incorrect result for decimal string

Re: BigInteger.bitLength() can return negative result

2009-10-19 Thread Dmitry Nadezhin
I'm preparing a fix which restricts the range of BigInteger so that bitLength() always return correct result. I can't choose between two variants of range of valid BigInteger. A) Two's complement range [-2^Integer.MAX_VALUE, 2^Integer.MAX_VALUE-1] This is exactly those numbers with bitLength()

Re: Code review request for 6371401: java.math.BigInteger.shift(Integer.MIN_VALUE) throws StackOverflowError

2009-10-19 Thread Dmitry Nadezhin
I want to make comments to this change from point of view of the post "BigInteger.bitLength() can return negative results". Suppose that the range of valid BigInteger is restiricted either to [-2^Integer.MAX_VALUE , 2^Integer.MAX_VALUE-1] or to [-2^Integer.MAX_VALUE+1, 2^Integer.MAX_VALUE-1]. In

Re: BigInteger.bitLength() can return negative result

2009-10-15 Thread Dmitry Nadezhin
d) All BigInteger constructors ensure that the bit length is no larger than 2^31 - 1; d) is arguably the most correct approach to address the problem. However, I think the practical consequences of this flaw are low. Nevertheless, may I use this unimportant flaw as a lesson of Java bug fixi

BigInteger.bitLength() can return negative result

2009-10-15 Thread Dmitry Nadezhin
BigInteger is a class implementing arbitrary-precision integers. Of course, it is an idealization. Let's look at implementation limits of this type. The bits are stored in "int[] mag" array. This sets the maximum bit length 32*(2^31 - 1). The "BigInteger.magSerializedForm()" converts bits to