NormalizeIntsAndFloats normalizes all int and float types to int64 and float64, respectively.
(v any)
| 321 | d := apd.NewWithBigInt(coeff, v.Exp) |
| 322 | d.Reduce(d) |
| 323 | return d |
| 324 | } |
| 325 | |
| 326 | // NormalizeIntsAndFloats normalizes all int and float types |
| 327 | // to int64 and float64, respectively. |
| 328 | func NormalizeIntsAndFloats(v any) any { |
| 329 | switch val := v.(type) { |
| 330 | case int: |
| 331 | return int64(val) |
| 332 | case int8: |
| 333 | return int64(val) |
| 334 | case int16: |
| 335 | return int64(val) |
| 336 | case int32: |
| 337 | return int64(val) |
| 338 | case uint: |
| 339 | return int64(val) |
| 340 | case uint8: |
| 341 | return int64(val) |
| 342 | case uint16: |
| 343 | return int64(val) |
| 344 | case uint32: |
| 345 | return int64(val) |
| 346 | case uint64: |
| 347 | // PostgreSQL does not support an uint64 type, so we can always convert this to an int64 safely. |
| 348 | return int64(val) |
| 349 | // case float32: |
| 350 | // return float64(val) |
| 351 | default: |
| 352 | return val |
no outgoing calls
no test coverage detected