Send MinGW-Notify mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.osdn.me/mailman/listinfo/mingw-notify
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of MinGW-Notify digest..."
Please do not reply to this notification; the sender address is unable to
accept incoming e-mail. If you wish to unsubscribe you can do so at
https://lists.osdn.me/mailman/listinfo/mingw-notify.
Today's Topics:
1. [mingw] #41597: std::remquo does not yield the proper result
for the quotient (MinGW Notification List)
----------------------------------------------------------------------
Message: 1
Date: Fri, 26 Feb 2021 10:09:39 +0100
From: MinGW Notification List <[email protected]>
To: OSDN Ticket System <[email protected]>
Subject: [MinGW-Notify] [mingw] #41597: std::remquo does not yield the
proper result for the quotient
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8
#41597: std::remquo does not yield the proper result for the quotient
Open Date: 2021-02-17 22:25
Last Update: 2021-02-26 10:09
URL for this Ticket:
https://osdn.net//projects/mingw/ticket/41597
RSS feed for this Ticket:
https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=41597
---------------------------------------------------------------------
Last Changes/Comment on this Ticket:
2021-02-26 10:09 Updated by: avhaecke
Comment:
Reply To keith
Reply To avhaecke
I performed the full upgrade to GCC 9.2.0 and replaced the libmingwex.a with
the one you provided.
It did correct the unexpected behavior I had encountered and my specific
problem i.e. quo gets the correct value after the call std::remquo(x, y, quo)
when x and y are of double type.
However, I had a test program for remquo that also tested the case when x and y
were "long double" rather than double and it continues to yield unexpected
result with the library you provided.
[...code snipped...]
and I get as a result (with the new library) :
{{{
nan -2147483648
}}}
I do not know if this behavior is expected as the correction may be a partial
patch but I wanted to bring it to your attention.
Thanks, Alex.
Ouch! GIGO. That behaviour definitely wasn't expected, but I'd made a
copy-and-paste error ... copied the remquof() preamble to remquol() but
neglected to change the argument type references from DWORD to TBYTE, so the
FPU was attempting to load REAL4 arguments from stack offsets within a single
REAL10 value, yielding obviously invalid input.
I've fixed it, and refreshed the attached libmingwex.a. It appears to work
correctly now, for me, when I change the data types from double to long double,
where appropriate in my test program, (and substitute std::strtold() for
std::strtod()), but I'd appreciate if you'd like to test as well. I'll update
the patch, to reflect the correction, shortly.
BTW, please wrap example code in formatted text block markup, to preserve
layout. The OSDN site documentation tells you how, or you can see how I've
modified your posts, if you select the "edit" option.
Thank you for your answer.
I've tested your new library and indeed it works for my test cases.
Everything seems fine as far as I can tell.
Many thanks for your time !
Alex
PS : and sorry for all the mistakes I made in the posts !
---------------------------------------------------------------------
Ticket Status:
Reporter: avhaecke
Owner: keith
Type: Issues
Status: Open [Owner assigned]
Priority: 5 - Medium
MileStone: (None)
Component: WSL
Severity: 5 - Medium
Resolution: None
---------------------------------------------------------------------
Ticket details:
Context :
This problem was encountered with gcc on MinGW in the following version :
gcc.exe (MinGW.org GCC-6.3.0-1) 6.3.0
Description :
The following code :
double numer = 90.1 ; double denom = 90 .0 ; int quot ; double result =
std::remquo(numer, denom, ") ; std::cout << "result " << result <<
std::endl ; std::cout << "quot " << quot << std::endl;should yield :
result 0.1
quot 1
As is expected from std::remquo, quot has a magnitude which should be congruent
(modulo 2 to the nth) to the magnitude of the integral quotient of x/y, n being
greater or equal than 3.
However with gcc 6.3.0, on MinGW, the above instructions yield :
result 0.1
quot 0
On another version of gcc (gcc 4.9.1 2014), the expected behavior is
encountered.
--
Ticket information of MinGW - Minimalist GNU for Windows project
MinGW - Minimalist GNU for Windows Project is hosted on OSDN
Project URL: https://osdn.net/projects/mingw/
OSDN: https://osdn.net
URL for this Ticket:
https://osdn.net/projects/mingw/ticket/41597
RSS feed for this Ticket:
https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=41597
------------------------------
Subject: Digest Footer
_______________________________________________
MinGW-Notify mailing list
[email protected]
https://lists.osdn.me/mailman/listinfo/mingw-notify
------------------------------
End of MinGW-Notify Digest, Vol 41, Issue 17
********************************************