1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 21:02:27 +08:00

refactor(mathutil): round related method support generics (#195)

This commit is contained in:
Cannian
2024-03-01 16:04:23 +08:00
committed by GitHub
parent 81d13c2f1a
commit c02c4f813b
4 changed files with 24 additions and 18 deletions

View File

@@ -392,7 +392,7 @@ func main() {
<b>函数签名:</b>
```go
func RoundToFloat(x float64, n int) float64
func RoundToFloat[T constraints.Float | constraints.Integer](x T, n int) float64
```
<b>示例:<span style="float:right;display:inline-block;">[运行](https://go.dev/play/p/ghyb528JRJL)</span></b>
@@ -428,7 +428,7 @@ func main() {
<b>函数签名:</b>
```go
func RoundToString(x float64, n int) string
func RoundToString[T constraints.Float | constraints.Integer](x T, n int) string
```
<b>示例:<span style="float:right;display:inline-block;">[运行](https://go.dev/play/p/kZwpBRAcllO)</span></b>
@@ -464,7 +464,7 @@ func main() {
<b>函数签名:</b>
```go
func TruncRound(x float64, n int) float64
func TruncRound[T constraints.Float | constraints.Integer](x T, n int) T
```
<b>示例:<span style="float:right;display:inline-block;">[运行](https://go.dev/play/p/aumarSHIGzP)</span></b>

View File

@@ -392,7 +392,7 @@ func main() {
<b>Signature:</b>
```go
func RoundToFloat(x float64, n int) float64
func RoundToFloat[T constraints.Float | constraints.Integer](x T, n int) float64
```
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/ghyb528JRJL)</span></b>
@@ -428,7 +428,7 @@ func main() {
<b>Signature:</b>
```go
func RoundToString(x float64, n int) string
func RoundToString[T constraints.Float | constraints.Integer](x T, n int) string
```
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/kZwpBRAcllO)</span></b>
@@ -464,7 +464,7 @@ func main() {
<b>Signature:</b>
```go
func TruncRound(x float64, n int) float64
func TruncRound[T constraints.Float | constraints.Integer](x T, n int) T
```
<b>Example:<span style="float:right;display:inline-block;">[Run](https://go.dev/play/p/aumarSHIGzP)</span></b>