public final class FpDivHardToNRoundIterator extends java.lang.Object implements Iterator<GeneratorResult<FpNumber>>
FpDivHardToNRoundIterator
implements an iterator of hard-to-round test cases for the
division operation operating in the round-to-nearest mode.
The implementation is based on the following works of David Matula and Lee McFearin:
The algorithm is as follows (2003):
odd = 2i-1;
num_s / den_s = simplest_parent( (2^p - odd)/odd );
if (num_s is odd)
num_i = 2^p - odd + num_s
else
num_i = 2(2^p - odd) - num_s
print ( (num_i) / (2^p - odd) )
Constructor and Description |
---|
FpDivHardToNRoundIterator(FpFormat format)
Constructs a division hard-to-round iterator.
|
Modifier and Type | Method and Description |
---|---|
FpDivHardToNRoundIterator |
clone()
Returns a copy of the iterator.
|
boolean |
hasValue()
Checks if the iterator is not exhausted (a value is available).
|
void |
init()
Initializes the iterator.
|
void |
next()
Makes an iteration.
|
void |
stop()
Stops the iterator.
|
GeneratorResult<FpNumber> |
value()
Returns the current value of the iterator.
|
public FpDivHardToNRoundIterator(FpFormat format)
format
- the format.public void init()
Iterator
init
in interface Iterator<GeneratorResult<FpNumber>>
public boolean hasValue()
Iterator
hasValue
in interface Iterator<GeneratorResult<FpNumber>>
true
if the iterator is not exhausted; false
otherwise.public GeneratorResult<FpNumber> value()
Iterator
value
in interface Iterator<GeneratorResult<FpNumber>>
public void next()
Iterator
next
in interface Iterator<GeneratorResult<FpNumber>>
public void stop()
Iterator
stop
in interface Iterator<GeneratorResult<FpNumber>>
public FpDivHardToNRoundIterator clone()
Iterator
clone
in interface Iterator<GeneratorResult<FpNumber>>
clone
in class java.lang.Object