mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-19 19:26:15 -06:00
[chore] update dependencies (#4188)
Update dependencies:
- github.com/gin-gonic/gin v1.10.0 -> v1.10.1
- github.com/gin-contrib/sessions v1.10.3 -> v1.10.4
- github.com/jackc/pgx/v5 v5.7.4 -> v5.7.5
- github.com/minio/minio-go/v7 v7.0.91 -> v7.0.92
- github.com/pquerna/otp v1.4.0 -> v1.5.0
- github.com/tdewolff/minify/v2 v2.23.5 -> v2.23.8
- github.com/yuin/goldmark v1.7.11 -> v1.7.12
- go.opentelemetry.io/otel{,/*} v1.35.0 -> v1.36.0
- modernc.org/sqlite v1.37.0 -> v1.37.1
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4188
Reviewed-by: Daenney <daenney@noreply.codeberg.org>
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
20aad9be0f
commit
b6ff55662e
214 changed files with 44839 additions and 32023 deletions
78
vendor/github.com/tdewolff/parse/v2/strconv/decimal.go
generated
vendored
78
vendor/github.com/tdewolff/parse/v2/strconv/decimal.go
generated
vendored
|
|
@ -69,3 +69,81 @@ func ParseDecimal(b []byte) (float64, int) {
|
|||
}
|
||||
return f * math.Pow10(exp), i
|
||||
}
|
||||
|
||||
// AppendDecimal appends a float to `b` with `dec` the maximum number of decimals.
|
||||
func AppendDecimal(b []byte, f float64, dec int) []byte {
|
||||
if math.IsNaN(float64(f)) || math.IsInf(float64(f), 0) {
|
||||
return b
|
||||
}
|
||||
|
||||
if dec < 0 || 17 < dec {
|
||||
dec = 17
|
||||
}
|
||||
f *= math.Pow10(dec)
|
||||
|
||||
// correct rounding
|
||||
if 0.0 <= f {
|
||||
f += 0.5
|
||||
} else {
|
||||
f -= 0.5
|
||||
}
|
||||
|
||||
// calculate mantissa and exponent
|
||||
num := int64(f)
|
||||
if num == 0 {
|
||||
return append(b, '0')
|
||||
}
|
||||
for 0 < dec && num%10 == 0 {
|
||||
num /= 10
|
||||
dec-- // remove trailing zeros
|
||||
}
|
||||
|
||||
i, n := len(b), LenInt(num)
|
||||
if 0 < dec {
|
||||
if n < dec {
|
||||
n = dec // number has zero after dot
|
||||
}
|
||||
n++ // dot
|
||||
if lim := int64pow10[dec]; 0 < num && num < lim || num < 0 && -lim < num {
|
||||
n++ // zero at beginning
|
||||
}
|
||||
}
|
||||
if cap(b) < i+n {
|
||||
b = append(b, make([]byte, n)...)
|
||||
} else {
|
||||
b = b[:i+n]
|
||||
}
|
||||
|
||||
// print sign
|
||||
if num < 0 {
|
||||
num = -num
|
||||
b[i] = '-'
|
||||
}
|
||||
i += n - 1
|
||||
|
||||
// print number
|
||||
if 0 < dec {
|
||||
b[i] = byte(num%10) + '0'
|
||||
num /= 10
|
||||
dec--
|
||||
i--
|
||||
for 0 < dec {
|
||||
b[i] = byte(num%10) + '0'
|
||||
num /= 10
|
||||
dec--
|
||||
i--
|
||||
}
|
||||
b[i] = '.'
|
||||
i--
|
||||
}
|
||||
if num == 0 {
|
||||
b[i] = '0'
|
||||
} else {
|
||||
for num != 0 {
|
||||
b[i] = byte(num%10) + '0'
|
||||
num /= 10
|
||||
i--
|
||||
}
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue