| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 3: Basic Library Functions Oracle Solaris 11 Information Library |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- convert floating-point value to decimal record
#include <floatingpoint.h>voidsingle_to_decimal(single *px,decimal_mode *pm,decimal_record *pd,fp_exception_field_type *ps);
voiddouble_to_decimal(double *px,decimal_mode *pm,decimal_record *pd,fp_exception_field_type *ps);
voidextended_to_decimal(extended *px,decimal_mode *pm,decimal_record *pd,fp_exception_field_type *ps);
voidquadruple_to_decimal(quadruple *px,decimal_mode *pm,decimal_record *pd,fp_exception_field_type *ps);
Thefloating_to_decimal functions convert the floating-point value at*px into a decimalrecord at *pd, observing the modes specified in *pm and setting exceptionsin *ps. If there are no IEEE exceptions, *ps will be zero.
If *px is zero, infinity, or NaN, then onlypd->sign andpd->fpclassare set. Otherwisepd->exponent andpd->ds are also set so that
(sig)*(pd->ds)*10**(pd->exponent)
is a correctly rounded approximation to *px, wheresig is +1 or-1, depending upon whetherpd->sign is 0 or -1.pd->ds has atleast one and no more thanDECIMAL_STRING_LENGTH–1 significant digits because one characteris used to terminate the string with a null.
pd->ds is correctly rounded according to the IEEE rounding modes inpm->rd.*ps hasfp_inexact set if the result was inexact, and hasfp_overflow setif the string result does not fit inpd->ds because of thelimitationDECIMAL_STRING_LENGTH.
Ifpm->df ==floating_form, thenpd->ds always containspm->ndigits significant digits. Thus if*px == 12.34 andpm->ndigits == 8, thenpd->ds will contain 12340000andpd->exponent will contain -6.
Ifpm->df ==fixed_form andpm->ndigits >= 0, then the decimal valueis rounded atpm->ndigits digits to the right of the decimal point. Forexample, if *px == 12.34 andpm->ndigits == 1, thenpd->ds willcontain 123 andpd->exponent will be set to -1.
Ifpm->df ==fixed_form andpm->ndigits< 0, then the decimal value isrounded at -pm->ndigits digits to the left of the decimal point, andpd->dsis padded with trailing zeros up to the decimal point. For example,if *px == 12.34 andpm->n digits == -1, thenpd->ds will contain10 andpd->exponent will be set to 0.
Whenpm->df ==fixed_form and the value to be converted is largeenough that the resulting string would contain more thanDECIMAL_STRING_LENGTH-1 digits,then the string placed inpd->ds is limited to exactlyDECIMAL_STRING_LENGTH-1 digits (bymoving the place at which the value is rounded further left ifneed be),pd->exponent is adjusted accordingly and the overflow flag is set in*ps.
pd->more is not used.
Theeconvert(3C),fconvert(3C),gconvert(3C),printf(3C), andsprintf(3C) functions all usedouble_to_decimal().
Seeattributes(5) for descriptions of the following attributes:
|
econvert(3C),fconvert(3C),gconvert(3C),printf(3C),sprintf(3C),attributes(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |