MCPcopy Create free account
hub / github.com/dolthub/doltgresql / NumericCompare

Function NumericCompare

server/types/numeric.go:187–199  ·  view source on GitHub ↗

NumericCompare compares two *apd.Decimal values handling NaN separately.

(ab, bb *apd.Decimal)

Source from the content-addressed store, hash-verified

185
186// NumericCompare compares two *apd.Decimal values handling NaN separately.
187func NumericCompare(ab, bb *apd.Decimal) int {
188 if (ab.Form == apd.NaN && bb.Form == apd.NaN) ||
189 (ab.Form == apd.Infinite && bb.Form == apd.Infinite && ab.Negative == bb.Negative) {
190 return 0
191 }
192 if ab.Form == apd.NaN {
193 return 1
194 }
195 if bb.Form == apd.NaN {
196 return -1
197 }
198 return ab.Cmp(bb)
199}

Callers 1

CompareMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected