Class FpDivHardToNRoundIterator
- java.lang.Object
-
- ru.ispras.testbase.knowledge.floating.div.FpDivHardToNRoundIterator
-
- All Implemented Interfaces:
Iterator<GeneratorResult<FpNumber>>
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:
- D. Matula, L. McFearin. Number Theoretic Foundations of Binary Floating Point Division with Rounding. Real Numbers and Computers, 2000.
- D. Matula, L. McFearin. Generation and Analysis of Hard to Round Cases for Binary Floating Point Division. Symposium on Computer Arithmetic, 2001.
- D. Matula, L. McFearin. Selecting a Well Distributed Hard Case Test Suite for IEEE Standard Floating Point Division. International Conference on Computer Design, 2001.
- D. Matula, L. McFearin. A p x p Bit Fraction Model of Binary Floating Point Division and Extremal Rounding Cases. Theoretical Computer Science, 2003.
- D. Matula, L. McFearin. A Formal Model and Efficient Traversal Algorithm for Generating Testbenches for Verification of IEEE Standard Floating Point Division. Conference on Design, Automation and Test in Europe, 2006.
- D. Matula, L. McFearin. Generating a Benchmark Set of Extremal Rounding Boundary Instances for IEEE Standard Floating Point Division. (link)
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 Summary
Constructors Constructor Description FpDivHardToNRoundIterator(FpFormat format)
Constructs a division hard-to-round iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FpDivHardToNRoundIterator
clone()
Creates 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.
-
-
-
Constructor Detail
-
FpDivHardToNRoundIterator
public FpDivHardToNRoundIterator(FpFormat format)
Constructs a division hard-to-round iterator.- Parameters:
format
- the format.
-
-
Method Detail
-
init
public void init()
Description copied from interface:Iterator
Initializes the iterator.- Specified by:
init
in interfaceIterator<GeneratorResult<FpNumber>>
-
hasValue
public boolean hasValue()
Description copied from interface:Iterator
Checks if the iterator is not exhausted (a value is available).- Specified by:
hasValue
in interfaceIterator<GeneratorResult<FpNumber>>
- Returns:
true
if the iterator is not exhausted;false
otherwise.
-
value
public GeneratorResult<FpNumber> value()
Description copied from interface:Iterator
Returns the current value of the iterator.- Specified by:
value
in interfaceIterator<GeneratorResult<FpNumber>>
- Returns:
- the current value of the iterator.
-
next
public void next()
Description copied from interface:Iterator
Makes an iteration.- Specified by:
next
in interfaceIterator<GeneratorResult<FpNumber>>
-
stop
public void stop()
Description copied from interface:Iterator
Stops the iterator.- Specified by:
stop
in interfaceIterator<GeneratorResult<FpNumber>>
-
clone
public FpDivHardToNRoundIterator clone()
Description copied from interface:Iterator
Creates a copy of the iterator.- Specified by:
clone
in interfaceIterator<GeneratorResult<FpNumber>>
- Overrides:
clone
in classjava.lang.Object
- Returns:
- A copy of the iterator.
-
-