Changeset 94336 in vbox
- Timestamp:
- Mar 23, 2022 1:59:05 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/strformatfloat.cpp
r94302 r94336 69 69 if (RTFLOAT32U_IS_ZERO(pr32Value)) 70 70 return fSign 71 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" +0"))72 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" -0"));71 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-0")) 72 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+0")); 73 73 if (RTFLOAT32U_IS_INF(pr32Value)) 74 74 return fSign 75 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" +Inf"))76 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" -Inf"));75 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-Inf")) 76 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+Inf")); 77 77 78 78 /* … … 151 151 if (RTFLOAT64U_IS_ZERO(pr64Value)) 152 152 return fSign 153 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" +0"))154 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" -0"));153 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-0")) 154 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+0")); 155 155 if (RTFLOAT64U_IS_INF(pr64Value)) 156 156 return fSign 157 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" +Inf"))158 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" -Inf"));157 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-Inf")) 158 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+Inf")); 159 159 160 160 /* … … 247 247 && !fInteger) 248 248 return fSign 249 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" +0"))250 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" -0"));249 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-0")) 250 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+0")); 251 251 fDenormal = true; 252 252 } … … 257 257 if (!uFraction) 258 258 return fSign 259 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" +PseudoInf"))260 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" -PseudoInf"));259 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-PseudoInf")) 260 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+PseudoInf")); 261 261 if (!(fFlags & RTSTR_F_SPECIAL)) 262 262 return fSign 263 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" +PseudoNan"))264 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" -PseudoNan"));263 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-PseudoNan")) 264 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+PseudoNan")); 265 265 pszTmp = (char *)memcpy(pszTmp, "PseudoNan[", 10) + 10; 266 266 } … … 269 269 if (!(uFraction & (RT_BIT_64(62) - 1))) 270 270 return fSign 271 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" +Inf"))272 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" -Inf"));271 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-Inf")) 272 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+Inf")); 273 273 if (!(fFlags & RTSTR_F_SPECIAL)) 274 274 return rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("SNan")); … … 279 279 if (!(uFraction & (RT_BIT_64(62) - 1))) 280 280 return fSign 281 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" +Ind"))282 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE(" -Ind"));281 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-Ind")) 282 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+Ind")); 283 283 if (!(fFlags & RTSTR_F_SPECIAL)) 284 284 return rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("QNan")); … … 302 302 pszTmp += RTStrFormatNumber(pszTmp, (int32_t)uExponent - RTFLOAT80U_EXP_BIAS, 10, 0, 0, 303 303 RTSTR_F_ZEROPAD | RTSTR_F_32BIT | RTSTR_F_VALSIGNED); 304 if (fDenormal && (fFlags & RTSTR_F_SPECIAL)) 305 { 306 if (fInteger) 307 pszTmp = (char *)memcpy(pszTmp, "[PDn]", 5) + 5; 308 else 309 pszTmp = (char *)memcpy(pszTmp, "[Den]", 5) + 5; 304 if (fFlags & RTSTR_F_SPECIAL) 305 { 306 if (fDenormal) 307 { 308 if (fInteger) 309 pszTmp = (char *)memcpy(pszTmp, "[PDn]", 5) + 5; 310 else 311 pszTmp = (char *)memcpy(pszTmp, "[Den]", 5) + 5; 312 } 313 else if (!fInteger) 314 pszTmp = (char *)memcpy(pszTmp, "[Unn]", 5) + 5; 310 315 } 311 316 return rtStrFormatCopyOutStr(pszBuf, cbBuf, szTmp, pszTmp - &szTmp[0]);
Note:
See TracChangeset
for help on using the changeset viewer.