Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.

Commit

Permalink
Added comment indicating the source of rounding code
Browse files Browse the repository at this point in the history
  • Loading branch information
sroebert committed Jun 15, 2017
1 parent 377e1e1 commit 408600c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/PostgreSQL/Bind/BinaryUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ struct BinaryUtils {
return String(repeating: "0", count: Numeric.decDigits - stringDigits.characters.count) + stringDigits
}

/// Function for rounding numeric values.
/// The code is based on https://github.com/postgres/postgres/blob/3a0d473192b2045cbaf997df8437e7762d34f3ba/src/backend/utils/adt/numeric.c#L8594
mutating func roundIfNeeded() {
// Decimal digits wanted
var totalDigits = (weight + 1) * Numeric.decDigits + dscale
Expand Down

0 comments on commit 408600c

Please sign in to comment.