*Synopsis*: typeset -X x ; print $x # does not print sufficient digits to
restore value
Due to a change requested by <User 1-1SURPB>,
<User 1-7MTUEB> is now the responsible engineer for:
CR 6855875 changed on Sep 18 2009 by <User 1-1SURPB>
=== Field ============ === New Value ============= === Old Value =============
Hook 5 <email address omitted>
Keyword oss-sponsor
Keyword oss-request
Responsible Engineer <User 1-7MTUEB> <User 1-1SURPB>
====================== =========================== ===========================
*Change Request ID*: 6855875
*Synopsis*: typeset -X x ; print $x # does not print sufficient digits to
restore value
Product: solaris
Category: shell
Subcategory: korn93
Type: RFE
Subtype:
Status: 6-Fix Understood
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
solaris/shell (Solaris Utilities/Commands)
Sub-Category
korn93
Description
$ typeset -X varname # was added to ksh93 to get a reliable way
(using the C99 "hexfloat" format (see printf(3c)'s "%a" format)) to
serialise a IEEE754-2008 floating-point value to a string and later feed
it back into a application _without_ loosing any precision (normal
base10 floating-point values (e.g. used by $ typeset -E/-F-G #) cause
rounding errors since IEEE754-2008 |long double| uses base2).
However $ typeset -l -X x ; ... ; print $x # currently does not print
sufficient number of digits to restore the full |long double| value as
expected, instead some digits are missing, resulting in an unwanted
rounding.
Example:
-- snip --
$ ksh93 -c 'typeset -l -X y y_ascii; (( y=sin(90) )) ; y_ascii=$y ; (( y
== y_ascii )) || print "no match,\n\t$(printf "%a\n" y)\n!=\n\t$(printf
"%a\n" y_ascii)"'
no match,
0x1.c9b9ee41cb8665c7890a136ace6bp-01
!=
0x1.c9b9ee41cc000000000000000000p-01
-- snip --
Frequency
Always
Regression
No
Steps to Reproduce
[See description]
Expected Result
[See description]
Actual Result
[See description]
Error Message(s)
-
Test Case
typeset -l -X y y_ascii
(( y=sin(90) ))
y_ascii=$y # convert y to string and store it in "y_ascii"
if (( y == y_ascii )) ; then
print "no match,\n\t$(printf "%a\n" y)\n!=\n\t$(printf "%a\n"
y_ascii)"
fi
Workaround
1. Manually increase the number of digits via typeset
-X<numdigits>
OR
2. Use $ printf "%a" varname #
Additional configuration information
Solaris 11/B110
*** (#1 of 1): 2009-06-29 18:38:47 GMT+00:00 <User 1-F4SZV>
=== *Public Comments* ========================================================
=== *Workaround* =============================================================
=== *Additional Details* =====================================================
Targeted Release: solaris_nevada
Commit To Fix In Build:
Fixed In Build:
Integrated In Build:
Verified In Build:
See Also: 6793763, 6855879
Duplicate of:
Hooks:
Hook1:
Hook2:
Hook3:
Hook4:
Hook5: <email address omitted>
Hook6: <email address omitted>
Program Management:
Root Cause: Inadequate Design
Fix Affects Documentation: No
Fix Affects Localization: No
=== *History* ================================================================
Date Submitted: 2009-06-29 18:38:46 GMT+00:00
Submitted By: <User 1-F4SZV>
Status Changed Date Updated Updated By
3-Accepted 2009-08-03 15:00:57 GMT+00:00 <User 1-1SURPB>
6-Fix Understood 2009-08-13 08:58:42 GMT+00:00 <User 1-1SURPB>
=== *Service Request* ========================================================
Impact: Significant
Functionality: Secondary
Severity: 3
Product Name: solaris
Product Release: solaris_nevada
Product Build: snv_110
Operating System: solaris_nevada
Hardware: generic
Submitted Date: 2009-06-29 18:38:47 GMT+00:00
=== *Service Request* ========================================================
Impact: Significant
Functionality: Secondary
Severity: 3
Product Name: solaris
Product Release: solaris_nevada
Product Build: snv_110
Operating System: solaris_nevada
Hardware: generic
Submitted Date: 2009-06-29 18:40:17 GMT+00:00
=== *Multiple Release (MR) Cluster* - 0 ======================================