suite

package
v2.0.0-...-db694ce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2017 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package suite provides a simple API for parsing and using IBM Labs' "Floating-Point Test-Suite for IEEE"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Case

type Case struct {
	Prefix string
	Prec   int
	Op     Op
	Mode   big.RoundingMode
	Trap   Exception
	Inputs []Data
	Output Data
	Excep  Exception
}

Case represents a specific test case.

Here's a nice ascii diagram:

 prec   trap             excep
 |      |                |
 |\     |                |
 vv     v                v
d64+ =0 i 100 200 -> 300 i
^  ^ ^^   ^^^ ^^^  ^ ^^^
|  | \|   \|/ \|/  | \|/
|  |  |    |   |   |  |
|  |  mode  \ /    |  output
|  op        |     output delim
prefix       inputs

func ParseCases

func ParseCases(r io.Reader) (cases []Case, err error)

ParseCases returns a slice of test cases in .fptest form read from r.

func (Case) String

func (c Case) String() string

type Data

type Data string

Data is input or output from a test case.

const NoData Data = "#"

NoData is output when the operation throws some sort of exception and does not "return" any data.

func (Data) IsInf

func (i Data) IsInf() (int, bool)

IsInf returns a boolean indicating whether the data is an Infinity and an int indicating the signedness of the Infinity.

func (Data) IsNaN

func (i Data) IsNaN() (nan, signal bool)

IsNaN returns two booleans indicating whether the data is a NaN value and whether it's signaling or not.

type Exception

type Exception uint8

Exception is a type of exception.

const (
	None    Exception = 0
	Inexact Exception = 1 << iota
	Underflow
	Overflow
	DivByZero
	Invalid
)

These values are a bitmask corresponding to specific exceptions. For example, an Exception is allowed to be both Inexact and an Overflow.

func (Exception) String

func (e Exception) String() string

type Op

type Op uint8

Op is a specific operation the test case must perform.

const (
	Add         Op = iota // add
	Sub                   // subtract
	Mul                   // multiply
	Div                   // divide
	FMA                   // fused multiply-add
	Sqrt                  // square root
	Rem                   // remainder
	RFI                   // round float to int
	CFF                   // convert between floating point formats
	CFI                   // convert float to integer
	CIF                   // convert integer to float
	CFD                   // convert to string
	CDF                   // convert string to float
	QuietCmp              // quiet comparison
	SigCmp                // signaling comparison
	Copy                  // copy
	Neg                   // negate
	Abs                   // absolute value
	CopySign              // copy sign
	Scalb                 // scalb
	Logb                  // logb
	NextAfter             // next after
	Class                 // class
	IsSigned              // is signed
	IsNormal              // is norm
	IsInf                 // is inf
	IsZero                // is zero
	IsSubNormal           // is subnormal
	IsNaN                 // is nan
	IsSignaling           // is signaling
	IsFinite              // is finite
	MinNum                // minnum
	MaxNum                // maxnum
	MinNumMag             // minnummag
	MaxNumMag             // maxnummag
	SameQuantum           // same quantum
	Quantize              // quantize
	NextUp                // next up
	NextDown              // next down
	Equiv                 // equivalent
)

func (Op) String

func (i Op) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL