*Synopsis*: typeset -X x ; print $x # does not print sufficient digits to 
restore value

CR 6855875 changed on Jun 29 2009 by <User 1-5Q-187>

=== Field ============ === New Value ============= === Old Value =============

See Also               6855879                                                
SR 1-549672209
 Functionality         Secondary                                              
 Hardware              generic                                                
 Impact                Significant                                            
 Operating System      solaris_nevada                                         
 Product Build         snv_110                                                
 Product Name          solaris                                                
 Product Release       solaris_nevada                                         
 Severity              3                                                      
====================== =========================== ===========================

     
*Change Request ID*: 6855875

*Synopsis*: typeset -X x ; print $x # does not print sufficient digits to 
restore value

  Product: solaris
  Category: opensolaris
  Subcategory: triage-queue
  Type: RFE
  Subtype: 
  Status: 1-Dispatched
  Substatus: 
  Priority: 3-Medium
  Introduced In Release: 
  Introduced In Build: 
  Responsible Engineer: 
  Keywords: opensolaris

=== *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: 
        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: 
        Hook6: <email address omitted>
  Program Management: 
  Root Cause: 
  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


=== *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 ======================================


Reply via email to