Type | Bug | Status | submitted | Date | 27-Feb-2013 20:41 |
---|---|---|---|---|---|
Version | r3 master | Category | Math | Submitted by | Sunanda |
Platform | Windows | Severity | minor | Priority | normal |
Summary | DIVIDE broken with TUPLE |
---|---|
Description |
One of these DIVIDEs is not like the others: 1.0 / .1 == 10.0 ;; good - divide decimal! 1 / .1 == 10.0 ;; good - divide integer! 1x1 / .1 == 10x10 ;; good - divide pair! 1.1.1 / .1 == 9.9.9 ;; strange - divide tuple! (R2 gets it right) |
Example code |
>> 1.1.1 / .1 == 9.9.9 ; expected 10.10.10 |
Assigned to | n/a | Fixed in | - | Last Update | 18-Feb-2014 00:48 |
---|
Comments | |
---|---|
(0003632)
MarcS 13-Mar-2013 21:48 |
Proposed fix: https://github.com/rebol/r3/pull/104 |
(0003633)
BrianH 13-Mar-2013 21:54 |
Before we accept this fix, we need to make sure that there aren't any cross-platform issues (not saying you didn't Marc, just that it needs more eyes applied to the task). The fact that this ticket still has Windows as the platform without any verification that this only affects Windows is a clue, especially for a problem that doesn't necessarily have to do with platform-specific APIs. For instance, is it the case on both GCC and MSVC builds on Windows? |
(0003634)
MarcS 13-Mar-2013 22:12 |
Agreed. I believe Andreas is planning to test this on Windows later today. |
(0003635)
MarcS 13-Mar-2013 22:17 |
Incidentally, I should add that I can recreate the issue on my Linux machine.
The cause of the problem there is (a) representational imprecision in the FPU, hence (b) truncation that occurs when casting to a REBINT without a rounding strategy. |
(0003640)
abolka 13-Mar-2013 23:19 |
A few results _without_ MarcS's proposed fix:
R3 2.100.111.4.4 (RT A111 on Linux): 9.9.9 R3 2.101.0.4.2 (RS mainline build, Linux, GCC 4.3.2): 9.9.9 R3 2.101.0.4.4 (custom mainline build, Linux, GCC 4.7.2): 10.10.10 R3 2.100.111.2.5 (RT A111 on OSX): 10.10.10 R3 2.101.0.2.5 (RS mainline build, OSX, GCC 4.2.1): 10.10.10 R3 2.101.0.2.5 (custom mainline build, OSX, GCC 4.7.2): 10.10.10 R3 2.100.111.3.1 (RT A111 on Win32): 10.10.10 R3 2.101.0.3.1 (RS mainline build, Win32, GCC 4.7.2): 9.9.9 R3 2.101.0.3.1 (custom mainline-2, Win32, MSVC 17.00.51106 / VS2012): 10.10.10 |
(0003642)
abolka 14-Mar-2013 00:11 |
_With_ MarcS's proposed fix:
Win32, GCC 4.7.2: 10.10.10 Win32, MSVC 17.00.51106: 10.10.10 Linux, GCC 4.3.2: 10.10.10 Linux, GCC 4.7.2: 10.10.10 OSX, GCC 4.3.2: 10.10.10 OSX, GCC 4.7.2: 10.10.10 |
(0003644)
abolka 14-Mar-2013 01:18 |
In the core-tests suite. |
(0003842)
Ladislav 22-Apr-2013 17:31 |
Before accepting such a fix we have to decide:
what should the result of 1.1.1 / 0.625 be? what should the result of 1.1.1 / 1.953125E-3 be? what should the result of 1.1.1 / -1.0 be? what should 1.1.1 * 2147483648.0 be? what should 1.1.1 / 4.656612873077393e-10 be? Also, the proposed fix does not use the proper way to specify the flags argument, I think |
(0003848)
abolka 23-Apr-2013 02:29 |
Preferences (model in mind: "decimal arithmetic, truncation to integer values, clipping to the 0..255 range"):
1.1.1 / 0.625 == 1.1.1 1.1.1 / 1.953125E-3 == 255.255.255 1.1.1 / -1.0 == 0.0.0 1.1.1 * 2147483648.0 = 255.255.255 1.1.1 / 4.656612873077393e-10 == 255.255.255 |
(0004243)
BrianH 18-Feb-2014 00:09 |
https://github.com/rebol/r3/pull/104 was merged into master. Do we consider this bug fixed yet? |
(0004244)
abolka 18-Feb-2014 00:48 |
I wouldn't mark it fixed, no. Carl remarked in the merge commit message: "This submission fixes the main problem, but there could be a few edge case issues remaining as pointed out by Ladislav." |
Date | User | Field | Action | Change |
---|---|---|---|---|
18-Feb-2014 00:48 | abolka | Comment : 0004244 | Added | - |
18-Feb-2014 00:09 | BrianH | Comment : 0004243 | Added | - |
23-Apr-2013 02:43 | abolka | Comment : 0003848 | Modified | - |
23-Apr-2013 02:42 | abolka | Comment : 0003848 | Modified | - |
23-Apr-2013 02:37 | abolka | Comment : 0003848 | Modified | - |
23-Apr-2013 02:29 | abolka | Comment : 0003848 | Added | - |
22-Apr-2013 18:18 | Ladislav | Comment : 0003842 | Modified | - |
22-Apr-2013 17:47 | Ladislav | Comment : 0003842 | Modified | - |
22-Apr-2013 17:42 | Ladislav | Comment : 0003842 | Modified | - |
22-Apr-2013 17:36 | Ladislav | Comment : 0003842 | Modified | - |
22-Apr-2013 17:31 | Ladislav | Comment : 0003842 | Added | - |
14-Mar-2013 01:18 | abolka | Comment : 0003644 | Added | - |
14-Mar-2013 00:11 | abolka | Comment : 0003642 | Added | - |
13-Mar-2013 23:19 | abolka | Comment : 0003640 | Added | - |
13-Mar-2013 22:17 | marcs | Comment : 0003635 | Added | - |
13-Mar-2013 22:12 | marcs | Comment : 0003634 | Added | - |
13-Mar-2013 21:54 | BrianH | Comment : 0003633 | Added | - |
13-Mar-2013 21:48 | marcs | Comment : 0003632 | Added | - |
27-Feb-2013 22:16 | BrianH | Code | Modified | - |
27-Feb-2013 22:16 | BrianH | Description | Modified | - |
27-Feb-2013 20:41 | sunanda | Ticket | Added | - |