(s string, d *apd.Decimal)
| 1035 | } |
| 1036 | |
| 1037 | func setDecimalString(s string, d *apd.Decimal) error { |
| 1038 | // ExactCtx should be able to handle any decimal, but if there is any rounding |
| 1039 | // or other inexact conversion, it will result in an error. |
| 1040 | // _, res, err := HighPrecisionCtx.SetString(&d.Decimal, s) |
| 1041 | _, res, err := ExactCtx.SetString(d, s) |
| 1042 | if res != 0 || err != nil { |
| 1043 | return MakeParseError(s, types.Decimal, err) |
| 1044 | } |
| 1045 | switch d.Form { |
| 1046 | case apd.NaNSignaling: |
| 1047 | d.Form = apd.NaN |
| 1048 | d.Negative = false |
| 1049 | case apd.NaN: |
| 1050 | d.Negative = false |
| 1051 | case apd.Finite: |
| 1052 | if d.IsZero() && d.Negative { |
| 1053 | d.Negative = false |
| 1054 | } |
| 1055 | } |
| 1056 | return nil |
| 1057 | } |
| 1058 | |
| 1059 | // ResolvedType implements the TypedExpr interface. |
| 1060 | func (*DDecimal) ResolvedType() *types.T { |
no test coverage detected
searching dependent graphs…