[ 
https://issues.apache.org/jira/browse/NUMBERS-203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759132#comment-17759132
 ] 

Alex Herbert commented on NUMBERS-203:
--------------------------------------

The purpose of FP64 is because Double does not implement the NativeOperators 
interface, so cannot reuse the AbstractField template class. Wrapping DD makes 
no sense since it can be used by the AbstractField class directly like 
FractionField or BigFractionField.

The AbstractField template seems to only be for convenience. IIUC FP64Field 
could have directly wrapped a Double class. All the implementation from FP64 
could have been put into FP64Field. But the FP64Field -> FP64 -> double has the 
same amount of object indirection as DoubleField -> Double -> double in order 
to get the actual primitive value to operate on. And this way the actual Field 
implementations are all very simple due to the AbstractField boiler plate.

With the other implementations the object indirection is only one layer as they 
wrap an object that is the field element, e.g. FractionField -> Fraction.
h2. FP128

FP128Field is not correct here.

Note that a DD is not a [IEEE 754 quadruple-precision binary floating-point 
format|https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format].
 That would have a 113-bit significand, 15-bit exponent and a sign bit. The 
double-double has approximately a 106-bit significand, the 11-bit exponent of a 
double, and a sign bit. There are caveats on the significand as the mantissa is 
split into two parts: (a) the number can represent more than 106-bits if the 
lower part is more than a power of 2 smaller than the ULP of the upper part but 
it can only represent a subset of numbers with an >106-bits of significand; (b) 
the mantissa can also be truncated if the high part is within 2^53 of the 
minimum normal double.

The DD is therefore simpler to consider as a standard IEEE754 double with an 
additional +/- 0.5 ULP.

> Add a field for the DD number
> -----------------------------
>
>                 Key: NUMBERS-203
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-203
>             Project: Commons Numbers
>          Issue Type: New Feature
>          Components: field
>            Reporter: Alex Herbert
>            Priority: Minor
>
> The field module can add a DDField class to allow using the double-double 
> number as a field.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to