You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been using RealIntervals for some test code. I was looking at AbstractRealInterval and have a question about two of the constructors.
The AbstractRealInterval(RealInterval other) constructor seems to incorrectly initialize min and max to 0's rather than the min and max of the other interval.
The AbstractRealInterval(double[] dimensions) constructor subtracts one from each dimension when setting min and max. This makes sense for an long[] dimension input but not for a double[] input. It has the paradoxical result that creating a real dim of width 5 reports realMin as 0 and realMax as 4 and an effective width of 4.
Can someone (Steffi you wrote this I think) review these and comment? Thanks.
The text was updated successfully, but these errors were encountered:
Thanks for pointing these out, Barry! Both are clearly bugs. I just pushed the fix.
I fixed the copy constructor and removed the AbstractRealInterval(double[] dimensions) constructor.
The way we defined it, min and max are inclusive. So for (integer) Interval with min=0, dimensions=max+1.
Because every Interval is also a RealInterval, we decided that RealInterval has no dimensions() method (exactly because the dimensions=max+1 makes no sense here). Therefore the (double[] dimensions) constructor also makes no sense.
The alternative would have been to define min as inclusive and max as exclusive. Maybe we should have done that, now it would be a lot of work to change it (but not impossible)
I have been using RealIntervals for some test code. I was looking at AbstractRealInterval and have a question about two of the constructors.
The AbstractRealInterval(RealInterval other) constructor seems to incorrectly initialize min and max to 0's rather than the min and max of the other interval.
The AbstractRealInterval(double[] dimensions) constructor subtracts one from each dimension when setting min and max. This makes sense for an long[] dimension input but not for a double[] input. It has the paradoxical result that creating a real dim of width 5 reports realMin as 0 and realMax as 4 and an effective width of 4.
Can someone (Steffi you wrote this I think) review these and comment? Thanks.
The text was updated successfully, but these errors were encountered: