've made a program to compute the discriminant in pascal ,and so,when calculating x1 and x2, gives the error:runtime Error: Value was either unacceptably low or unacceptably small for an Int32.

I understand that a larger range of numbers and int32 not fit. How to solve it?

I understand that a larger range of numbers and int32 not fit. How to solve it?

asked July 4th 19 at 23:34

4 answers

answered on

Solution

answered on July 4th 19 at 23:38

And why to round intermediate values? Round the final result, or do not increase it, and already output in the desired format.

answered on July 4th 19 at 23:40

The function signature look.

`function Round(X: real): longint;`

answered on July 4th 19 at 23:42

Usually in the works (and not even in training — it works as Excel) are not rounded, and the output of rounding.

Some advanced tools rounding is that rounding a fractional number to the i-th sign I see.

In addition, you suggested, what kind of Pascal you are dealing with, I uploaded it, and repeated a past mistake — this error occurs exactly because of rounding NaN.

```
writeln(x1:0:3);
writeln(x2:0:3);
```

Some advanced tools rounding is that rounding a fractional number to the i-th sign I see.

In addition, you suggested, what kind of Pascal you are dealing with, I uploaded it, and repeated a past mistake — this error occurs exactly because of rounding NaN.

Find more questions by tags DebuggingPascalProgramming