Java Valhalla and Maths support, Floating point
poweruserm at live.com.au
Thu Mar 8 06:30:20 UTC 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.
Is Valhalla aiming to rectify the following kinds of shortfalls? It does strike me that
the former code calls in already built software could remain compatible with some further
I have attempted to, and have more carefully described these problems, via the java bugs database:
-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 setting up BigDecimals can be and is presently 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.
There is also a trigonometric and numerics shortfall when it comes to BigDecimal.
Java could, fiarly directly, produce a StrictMath equivalent for BigDecimal,
to return a PI BigDecimal, specified by a BigInteger number of decimal places.
The same thing can be done for e, Euler's constant. However, the square root,
Nth root and powers need to be specified upon a BigDecimal, by means of another BigDecimal.
BigInteger can just be left, in a way.
This Oracle lecture seems to suggest such is possible:
Can someone please reply to me on these things?
Does Valhalla aim to eliminate floating point overflow and underflow somehow?
Could there be some more operator usage included on just the two BigInteger and BigDecimal classes?
If anyone here knows, could overflow and underflow be changed in SE Java where it stands?
More information about the valhalla-dev