*Synopsis*: [ku1] ksh93 does not differ between -0 and +0
CR 6805795 changed on Oct 28 2009 by <User 1-5HNZ8F>
=== Field ============ === New Value ============= === Old Value =============
Commit to Fix in Build snv_128 snv_127
Fixed in Build snv_128
Status 8-Fix Available 7-Fix in Progress
====================== =========================== ===========================
*Change Request ID*: 6805795
*Synopsis*: [ku1] ksh93 does not differ between -0 and +0
Product: solaris
Category: shell
Subcategory: korn93
Type: Defect
Subtype:
Status: 8-Fix Available
Substatus:
Priority: 3-Medium
Introduced In Release: solaris_nevada
Introduced In Build: snv_72
Responsible Engineer: <User 1-7MTUEB>
Keywords: opensolaris, oss-request, oss-sponsor
=== *Description* ============================================================
Category
shell
Sub-Category
korn
Description
Original bug report was:
---------------- snip ----------------
Is there a reason why ksh93 does not display the negative sign for the
value zero ? For example if I have use the C99 function "copysign"
(copies absolute value of operant a and sign of operant b) I get this
for { a=5, b=-0 }:
-- snip --
$ ksh93 -c 'float x; (( x=copysign(5, -0) )) ; printf "%f\n"
x'
-5.000000
-- snip --
Now if I swap operands a and b I get this result:
-- snip --
$ ksh93 -c 'float x; (( x=copysign(0, -5) )) ; printf "%f\n" x'
0.000000
-- snip --
AFAIK this result should be "-0.000000" ... or not ?
BTW: Parsing of "-0" doesn't seem to work either, e.g.
-- snip --
$ ksh93 -c 'float x a=-1 b=-0; (( x=copysign(a, b) )) ; printf "%f\n"
x'
1.000000
-- snip --
... while AFAIK it should be "-1.000000" since the 2nd operand of
"copysign" defines the sign of the result.
---------------- snip ----------------
Frequency
Always
Regression
No
Steps to Reproduce
Enter the following command which uses the C99 math function "copysign" to
copy the sign of the 2nd operant to the absolute value of the first operand:
$ ksh93 -c 'float x; (( x=copysign(0, -5) )) ; printf "%f\n" x'
Expected Result
-0.000000
Actual Result
0.000000
Error Message(s)
None.
Test Case
See above.
Workaround
None.
Additional configuration information
Solaris 11/B106
*** (#1 of 1): 2009-02-16 03:13:39 GMT+00:00 <User 1-F4SZV>
=== *Public Comments* ========================================================
=== *Workaround* =============================================================
=== *Additional Details* =====================================================
Targeted Release: solaris_nevada
Commit To Fix In Build: snv_128
Fixed In Build: snv_128
Integrated In Build:
Verified In Build:
See Also: 6437624, 6793763
Duplicate of:
Hooks:
Hook1:
Hook2:
Hook3:
Hook4:
Hook5: <email address omitted>
Hook6: <email address omitted>
Program Management:
Root Cause: Inadequate Algorithm
Fix Affects Documentation: No
Fix Affects Localization: No
=== *History* ================================================================
Date Submitted: 2009-02-16 03:13:39 GMT+00:00
Submitted By: <User 1-F4SZV>
Status Changed Date Updated Updated By
3-Accepted 2009-02-24 14:02:10 GMT+00:00 <User 1-1SURPB>
6-Fix Understood 2009-06-16 15:27:33 GMT+00:00 <User 1-1SURPB>
7-Fix in Progress 2009-10-23 18:12:34 GMT+00:00 <User 1-7MTUEB>
8-Fix Available 2009-10-28 18:23:34 GMT+00:00 <User 1-5HNZ8F>
=== *Service Request* ========================================================
Impact: Significant
Functionality: Secondary
Severity: 3
Product Name: solaris
Product Release: solaris_nevada
Product Build: snv_106
Operating System: solaris_nevada
Hardware: generic
Submitted Date: 2009-02-16 03:13:39 GMT+00:00
=== *Multiple Release (MR) Cluster* - 0 ======================================