added Pow method
This commit is contained in:
		
							
								
								
									
										7
									
								
								math.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								math.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					package gmath
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "math"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func Pow[N Number](x, y N) N {
 | 
				
			||||||
 | 
						return N(math.Pow(float64(x), float64(y)))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,5 +1,9 @@
 | 
				
			|||||||
package gmath
 | 
					package gmath
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Number interface {
 | 
					type Number interface {
 | 
				
			||||||
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64
 | 
						Integer | ~float32 | ~float64
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type Integer interface {
 | 
				
			||||||
 | 
						~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user