Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Big Issue with float, double, Java Floating Point.

3639778Mar 1 2018 — edited Mar 7 2018

I have found that double and float types in java are heirs to arithmetic underflow and overflow at any use.

I have found that presently, floating point is an arithmetic approximation.  My problem is that

the java language needs to be changed here, so that one may have arithmetic accuracy with

floats and doubles.

There is also a trigonometric shortfall when it comes to BigDecimal.

I have attempted to, and have more carefully described these problems, via the java bugs database:

JDK-8190947

JDK-8197995

JDK-8190991

JDK-8190946

-These types, as things are, must be computationally discarded, used only in terms of push and pull,

and be programmed around using BigDecimal, which will be a waste of memory,

program execution speed, and a total confusion due to the lack of any operator

usage options on BigDecimals.

-It is the case that set, get methods, constructors and mutability methods are all based

around float and double, not BigDecimal, which is part of the previous problem.

-It is the case that setting up BigDecimals can be and is a circumstantial waste of memory

with very many tasks, combined with the fact that the fact that having to use BigDecimal

method calls is nowhere near as efficient or legible to developers or mathematics and enginner

programmers (and useful with their time) as 

+, -, *, /, %, +=,-+,*=,/=,%=, ++, --

.This is a syntax argument largely, but also an instruction argument

since BigDecimals have to be set up or used with an extra, thereby second, call.

-It is the case that every other major language includes both floating point and accuracy mode

options with these two types and or Objects, either as a source code instruction or as a

compiler switch option.  These languages at least provide both options for floating

point and mathematical accuracy mode.

-It is so that the present arithmetic underflow and underflow are total disadvantages,

that need only be altered in place, for preconditions, postconditions and in place.

This is in regard to programs that have been compiled and built already.

-My Oracle Support technical reviews seem not to recognise these real problems in

technical analysis, or only interpret matters in terms of the

Java Language Specification on these issues, which of itself possesses inadequecies in these places.

Can someone please reply to me on these things? 

Can Oracle update the Java SE language?

Comments

Frank Kulash

Hi, @newuser11
Whenever you have a question, please post a little sample data in a usable form (such as CREATE TABLE and INSERT statements), so the people who want to help you car re-create the problem and test their ideas. Also post the exact results you want from the given data, and an explanation (in general terms) of how you get those results from that data.
Always say which version of Oracle you're using (e.g. 12.2.0.1.0).
least(7-to_char(FORECASTED_START_DATE,'DAY','NLS_DATE_LANGUAGE=''numeric date language''')+1,2)
+greatest (to_char (ACTUAL_COMPLETION_DATE,'DAY','NLS_DATE_LANGUAGE=''numeric date language''')-5,0)
+ ((trunc(ACTUAL_COMPLETION_DATE,'IW')-trunc(FORECASTED_START_DATE,'IW'))/7-1)*2 as Weekend_Count
That looks like you might calculate how many weekend days are in a range without using a calendar table. Since you do have a calendar table, it's simpler just to use it, especially since you have to use the calendar table anyway, to get the holiday information.

mathguy

What is a "type 2 table"?
Anyway - why are you trying to calculate total days, then holiday days and weekend days separately, and then holidays that fall on a weekend, and play with those numbers to get the result?
Why not simply select count(*) from the calendar table, where the dates are between the job start date and the job end date and both flags (for "holiday" and "weekend") are 'N' ? Isn't that a trivial computation? Or do you not "see" this trivial solution?

1 - 2

Post Details

Added on Mar 1 2018
5 comments
1,043 views