github.com/devwanda/aphelion-staking@v0.33.9/libs/math/fraction.go (about)

     1  package math
     2  
     3  import "fmt"
     4  
     5  // Fraction defined in terms of a numerator divided by a denominator in int64
     6  // format.
     7  type Fraction struct {
     8  	// The portion of the denominator in the faction, e.g. 2 in 2/3.
     9  	Numerator int64 `json:"numerator"`
    10  	// The value by which the numerator is divided, e.g. 3 in 2/3. Must be
    11  	// positive.
    12  	Denominator int64 `json:"denominator"`
    13  }
    14  
    15  func (fr Fraction) String() string {
    16  	return fmt.Sprintf("%d/%d", fr.Numerator, fr.Denominator)
    17  }