Unable to set value to FmtBCDField because of wrong Min/Max value check
<h3><details><summary>Original Reporter info from Mantis: <small>zgabrovski</small></summary><small> - **Reporter name:** Zdravko Gabrovski </small></details></h3> ## Description: A simple TBufdataset component with one field "f1" with type "TFmtBCDField". Size=6, Precision=18.<br/> Although MinValue=0 and MaxValue=0, when I try to add a new value '1' to the field with code BufDataset1.FieldByName('F1').AsFloat:=1; I received: Field "f1" error: 1.00 is not between 0.00 and 0.00. Press OK to ignore and risk data corruption.<br/> Press Abort to kill the program. The problem comes from method TFMTBCDField.CheckRange in fields.inc: ``` pascal Function TFMTBCDField.CheckRange(AValue: TBCD) : Boolean; begin If (FMinValue<>0) or (FMaxValue<>0) then <--------- This check failed Result:=(AValue>=FMinValue) and (AValue<=FMaxValue) else Result:=True; end; ``` SomeHow TBCD FMinValue and FMaxValue are <> than '0' if I modify like this: ``` pascal Function TFMTBCDField.CheckRange(AValue: TBCD) : Boolean; var Z : TBcd begin Z := 0; If (FMinValue<>Z)) or (FMaxValue<>Z) then Result:=(AValue>=FMinValue) and (AValue<=FMaxValue) else Result:=True; end; ``` It works fine. ## Steps to reproduce: just open attached sample lazarus project and click MakeTest button. ## Mantis conversion info: - **Mantis ID:** 39261 - **OS:** All - **OS Build:** all - **Build:** trunk - **Platform:** all - **Version:** 3.3.1 - **Fixed in version:** 3.3.1 - **Fixed in revision:** 49623 (#573917706fb5a5cffd76239e90ef62fdee041f68) - **Target version:** 4.0.0
issue