@@ -33,6 +33,13 @@ type Int[N any] interface {
3333 // Equals returns true if the two integers are equal.
3434 Equals (other N ) bool
3535
36+ // Gt returns true if the integer is greater than the other integer.
37+ Gt (other N ) bool
38+
39+ // Gte returns true if the integer is greater than or equal to the other
40+ // integer.
41+ Gte (other N ) bool
42+
3643 // ToFloat converts the integer to a float.
3744 ToFloat () float64
3845
@@ -121,6 +128,17 @@ func (b GoInt[T]) Equals(other GoInt[T]) bool {
121128 return b .value == other .value
122129}
123130
131+ // Gt returns true if the integer is greater than the other integer.
132+ func (b GoInt [T ]) Gt (other GoInt [T ]) bool {
133+ return b .value > other .value
134+ }
135+
136+ // Gte returns true if the integer is greater than or equal to the other
137+ // integer.
138+ func (b GoInt [T ]) Gte (other GoInt [T ]) bool {
139+ return b .value >= other .value
140+ }
141+
124142// A compile-time constraint to ensure that the GoInt type implements the Int
125143// interface.
126144var _ Int [GoInt [uint ]] = GoInt [uint ]{}
@@ -208,6 +226,17 @@ func (b BigInt) Equals(other BigInt) bool {
208226 return b .value .Cmp (other .value ) == 0
209227}
210228
229+ // Gt returns true if the integer is greater than the other integer.
230+ func (b BigInt ) Gt (other BigInt ) bool {
231+ return b .value .Cmp (other .value ) == 1
232+ }
233+
234+ // Gte returns true if the integer is greater than or equal to the other
235+ // integer.
236+ func (b BigInt ) Gte (other BigInt ) bool {
237+ return b .Equals (other ) || b .Gt (other )
238+ }
239+
211240// A compile-time constraint to ensure that the BigInt type implements the Int
212241// interface.
213242var _ Int [BigInt ] = BigInt {}
0 commit comments