Re: [Seed7-users] Seed7 Compilation Errors
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
From: Thomas M. <tho...@gm...> - 2021-02-06 17:53:57
|
Hi Zachary, thank you very much for your bug report. In order to compute trunc() and round() Seed7 relies on the cast operation of C (assuming that this operation is fast). Because in C a cast of a double to an integer could return wrong results Seed7 does additional checks for the minimum and maximum allowed argument of trunc() and round(). These values are determined by chkccomp.c and stored in version.h. The file version.h that you sent contains the following line #define MAXIMUM_TRUNC_ARGUMENT 9223372036854775807 that means that the maximum result of trunc() and round() is 9223372036854775807. E.g.: trunc(9223372036854776832.0) -> 9223372036854775807 trunc(9223372036854776833.0) -> RANGE_ERROR On my x64 Linux computer version.h contains: #define MAXIMUM_TRUNC_ARGUMENT 9223372036854775295 this means that trunc() and round() never return 9223372036854775807. E.g.: trunc(9223372036854775295.0) -> 9223372036854774784 trunc(9223372036854775296.0) -> RANGE_ERROR The tests in chkflt.sd7 of release 2021-01-30 do not take into account, that MAXIMUM_TRUNC_ARGUMENT might have the value 9223372036854775807. Recently I compiled Seed7 under Android and there is the same problem. I adjusted the tests in chkflt.sd7 to allow that either the correct value of 9223372036854775807 is returned or RANGE_ERROR is raised. These changes are already checked in at GitHub (https://github.com/ThomasMertes/seed7 ). The next release of Seed7 at Sourceforge will also contain these fixes. Regards Thomas |