MCPcopy Create free account
hub / github.com/dop251/goja / floatToIntClip

Function floatToIntClip

value.go:570–580  ·  view source on GitHub ↗
(n float64)

Source from the content-addressed store, hash-verified

568}
569
570func floatToIntClip(n float64) int64 {
571 switch {
572 case math.IsNaN(n):
573 return 0
574 case n >= math.MaxInt64:
575 return math.MaxInt64
576 case n <= math.MinInt64:
577 return math.MinInt64
578 }
579 return int64(n)
580}
581
582func (f valueFloat) ToInteger() int64 {
583 return floatToIntClip(float64(f))

Callers 1

ToIntegerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…