You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2006/06/28 20:27:29 UTC
[jira] Created: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
__rw::__rw_new_capacity() uses floating point math
--------------------------------------------------
Key: STDCXX-226
URL: http://issues.apache.org/jira/browse/STDCXX-226
Project: C++ Standard Library
Type: Improvement
Components: 23. Containers
Versions: 4.1.2, 4.1.3
Environment: all
Reporter: Martin Sebor
Moved from the Rogue Wave bug tracking database:
****Created By: sebor @ May 09, 2002 11:15:41 AM****
The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Assigned: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov reassigned STDCXX-226:
------------------------------------
Assignee: Farid Zaripov
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12553368 ]
Farid Zaripov commented on STDCXX-226:
--------------------------------------
In the committed patch the _RWSTD_NEW_CAPACITY_RATIO and _RWSTD_STRING_CAPACITY_RATIO floating point values replaced to integer (multiplied with _RWSTD_RATIO_DIVIDER == 1000).
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3, 4.2.0
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: benchmark-stdcxx-226.c, new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543151 ]
Martin Sebor commented on STDCXX-226:
-------------------------------------
I'm concerned about the performance implications of replacing a single floating point multiplication with three integer divisions, two multiplications, and an addition. Isn't there a way to compute the same (or similar) result using a less expensive formula (ideally using just multiplication and shift).
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Attachments: new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551006 ]
Farid Zaripov commented on STDCXX-226:
--------------------------------------
In my testing the algorithm in My patch is more accurate :)
--------------------------
unsigned long f2 (unsigned long x)
{
unsigned long z = (x >> 10) * 1000 + (((x & 0x3ff) * 1000) >> 10);
return z;
}
--------------------------
Here instead of "1000" should be "ratio * 1024" == 1,618L * 1024 == 1656.
Also in My algorithm the 1.618 ratio is present explicitly and can be changed to any other value when it's needed.
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3, 4.2.0
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: benchmark-stdcxx-226.c, new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov resolved STDCXX-226.
----------------------------------
Resolution: Fixed
Resolved thus: http://svn.apache.org/viewvc?rev=605548&view=rev
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3, 4.2.0
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: benchmark-stdcxx-226.c, new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov updated STDCXX-226:
---------------------------------
Attachment: new_capacity.patch
The patch is attached.
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Attachments: new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543588 ]
Farid Zaripov commented on STDCXX-226:
--------------------------------------
We can replace _RWSTD_RATIO_DIVIDER == 1000 to 1024 and then replace division to shift.
I've attached the second patch.
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Attachments: new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551189 ]
Martin Sebor commented on STDCXX-226:
-------------------------------------
You're right, I must have been looking at the wrong column. Mea culpa!
I suspect the problem with the shift/add algorithm is in the carry as Douglas cautions in his paper. To fix it we'd probably have to drop down a level to the assembly, which I'm sure we don't want to do given that your algorithm is faster to begin with.
All right then, let's go with your version.
One question though: I don't see where you're changing _RWSTD_NEW_CAPACITY_RATIO to an integer. Are you?
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3, 4.2.0
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: benchmark-stdcxx-226.c, new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542908 ]
Travis Vitek commented on STDCXX-226:
-------------------------------------
I noticed that basic_stringbuf<>::_C_grow was changed, but it sill uses floating point arithmetic. Is there a reason that this wasn't updated to use fixed point?
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Attachments: new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550775 ]
Martin Sebor commented on STDCXX-226:
-------------------------------------
We still need to benchmark this before making any changes...
Currently, we get the new capacity by multiplying the current value by an approximation of the Golden Ratio (http://en.wikipedia.org/wiki/Golden_ratio), or 1.618:
z = x * 1.618
I suspect that the closest we'll be able to come to this value using integer operations without incurring a significant performance penalty is by multiplying the current value by 16 and dividing the result by 10. We can avoid the expensive division by 10 by approximating the operations using reciprocal multiplication as described below. I.e., like so:
z = x << 4;
z = ((z >> 1) + z) >> 1;
z = ((z >> 4) + z);
z = ((z >> 8) + z);
z = ((z >> 16) + z) >> 3;
http://www.cs.uiowa.edu/~jones/bcd/divide.html
I put together a simple benchmark to compare the performance of the original algorithm to that of the new one. I also included the approach I describe here because it seems to produce results that are closer to the original. The benchmark shows that eliminating the FP operations yields a dramatic improvement (an order of magnitude or more) on all architectures (x86, IA64, PA-RISC, PowerPC, or SPARC) regardless of which of the two approaches we go with. The algorithm in your patch performs slightly better than the alternative here (between 10% and up to twice as fast, depending on the hardware architecture) but yields results that are considerably less accurate than the alternative (I haven't measured by how much). So unless you think the performance gain is more important, I think we should go with the alternative I presented here.
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3, 4.2.0
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543070 ]
Farid Zaripov commented on STDCXX-226:
--------------------------------------
I'm just thinking why the grow algorithm in basic_stringbuf<>::_C_grow is differ from algorithm in __rw_new_capacity<basic_string>()?
And what would be better: just replace floating point arithmetic to integer, or implement specialized __rw_new_capacity<basic_stringbuf>()?
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Attachments: new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov updated STDCXX-226:
---------------------------------
Attachment: (was: new_capacity.patch)
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Attachments: new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov updated STDCXX-226:
---------------------------------
Severity: Inefficiency
Patch Info: [Patch Available]
Affects Version/s: 4.2.0
Fix Version/s: 4.2.1
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3, 4.2.0
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551505 ]
Farid Zaripov commented on STDCXX-226:
--------------------------------------
In my patch _RWSTD_NEW_CAPACITY_RATIO still double, and it's converted to an integer in __rw_new_capacity:
-----------
const _RWSizeT __ratio = _RWSizeT (_RWSTD_NEW_CAPACITY_RATIO * 1024);
-----------
Since here _RWSTD_NEW_CAPACITY_RATIO and 1024 are constants, the compiler should calculate __ratio in compile time.
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3, 4.2.0
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: benchmark-stdcxx-226.c, new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Sebor updated STDCXX-226:
--------------------------------
Attachment: benchmark-stdcxx-226.c
Attached simple benchmark program to compare the runtime performance of the three approaches discussed in the issue. Compiled with any C compiler, run as follows:
$ time ./a.out [ 0 | 1 | 2 ] N
0 for the original algorithm
1 for the algorithm implemented in the attached patch
2 for the reciprocal multiplication approach
N the number of iterations (unsigned long)
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3, 4.2.0
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: benchmark-stdcxx-226.c, new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551553 ]
Martin Sebor commented on STDCXX-226:
-------------------------------------
I'm not 100% sure it can do that. The floating point environment (such as the rounding mode) during compilation might be different from runtime. Let's check the assembly on a few platforms first.
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3, 4.2.0
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: benchmark-stdcxx-226.c, new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (STDCXX-226) __rw::__rw_new_capacity() uses
floating point math
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov updated STDCXX-226:
---------------------------------
Attachment: new_capacity.patch
> __rw::__rw_new_capacity() uses floating point math
> --------------------------------------------------
>
> Key: STDCXX-226
> URL: https://issues.apache.org/jira/browse/STDCXX-226
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: 23. Containers
> Affects Versions: 4.1.2, 4.1.3
> Environment: all
> Reporter: Martin Sebor
> Assignee: Farid Zaripov
> Attachments: new_capacity.patch
>
>
> Moved from the Rogue Wave bug tracking database:
> ****Created By: sebor @ May 09, 2002 11:15:41 AM****
> The template __rw_new_capacity() uses floating point arithmetic which may be less efficient than integer arithmetic on some architectures. Need to change to integer arithmetic and correctly handle integer overflow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.