LibreOffice Help states that "Double variables can take positive or negative values ranging from 1.79769313486232 x 10E308 to 4.94065645841247 x 10E-324." Attempting to assign the minimum value to a double variable results in error "Inadmissible value or data type. Overflow." sub main dim varD As Double varD = 4.94065645841247E-324 end sub
Either these lines in helpcontent are wrong in: source/text/sbasic/shared/01020100.xhp:140:<paragraph id="par_id3150953" role="paragraph" xml-lang="en-US">Double variables can take positive or negative values ranging from 1.79769313486232 x 10E308 to 4.94065645841247 x 10E-324. Double variables are floating-point variables, in which the decimal precision decreases as the non-decimal part of the number increases. Double variables are suitable for precise calculations. Calculations require more time than for Single variables. A Double variable requires 8 bytes of memory. The type-declaration character is "#".</paragraph> source/text/sbasic/shared/03102100.xhp:72:<paragraph id="par_id3148405" role="paragraph" xml-lang="en-US"> <emph>Double:</emph> Double-precision floating-point variable (1,79769313486232 x 10E308 - 4,94065645841247 x 10E-324)</paragraph> or there's a pb here: 373 if (errno == ERANGE) 374 { 375 // Check for the dreaded rounded to 15 digits max value 376 // 1.79769313486232e+308 for 1.7976931348623157e+308 we wrote 377 // everywhere, accept with or without plus sign in exponent. 378 const char* b = buf; 379 if (b[0] == '-') 380 ++b; 381 if (((pCharParseEnd - b == 21) || (pCharParseEnd - b == 20)) 382 && !strncmp(b, "1.79769313486232", 16) && (b[16] == 'e' || b[16] == 'E') 383 && (((pCharParseEnd - b == 21) && !strncmp(b + 17, "+308", 4)) 384 || ((pCharParseEnd - b == 20) && !strncmp(b + 17, "308", 3)))) 385 { 386 fVal = (buf < b) ? -DBL_MAX : DBL_MAX; 387 } 388 else 389 { 390 eStatus = rtl_math_ConversionStatus_OutOfRange; 391 } 392 } See https://opengrok.libreoffice.org/xref/core/sal/rtl/math.cxx?r=e7b352e023110876f2e47c2b12319c3683f12b1d#373 Eike: noticing ee2cc952eeb5385ee37485c822d7ad7abd8fb989 "Related: tdf#136272 accept 1.79769313486232e+308 as DBL_MAX" thought you might have some opinion here.
Since I reproduced this on Linux, let's put All for hardware.
see https://ask.libreoffice.org/t/basic-what-is-the-minimum-value-that-a-double-variable-can-hold/126717
for reference commit caecf6102f5042908c915afe89834ab7d3a4a4cb by the way Why is minExp -323 and not -324? https://opengrok.libreoffice.org/xref/core/sal/rtl/math.cxx?r=e7b352e023110876f2e47c2b12319c3683f12b1d#40
https://gerrit.libreoffice.org/c/core/+/191071
(In reply to Julien Nabet from comment #1) > Either these lines in helpcontent are wrong in: > source/text/sbasic/shared/01020100.xhp:140:<paragraph id="par_id3150953" > role="paragraph" xml-lang="en-US">Double variables can take positive or > negative values ranging from 1.79769313486232 x 10E308 to 4.94065645841247 x > 10E-324. Even though their meaning is correct (and we must allow the mentioned value), the text has an error (here and elsewhere in the page), using the odd notation like > 1.79769313486232 x 10E308 mixing the notations: it should either be > 1.79769313486232E308 or > 1.79769313486232 x 10^308
(In reply to Julien Nabet from comment #1) and thank you Julien, that was the correct place in code that needed a fix. (In reply to Saburo from comment #4) > by the way > Why is minExp -323 and not -324? Because there is no literal like 1E-324 (it would be an underflow). And the use of that array is for rounding, which is impossible for the subnormals in the range of 10^-324.
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/a3aaa11db039675252fe9d5bc4a9d43be34940e8 tdf#168423: Allow subnormals from strtod It will be available in 26.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-25-8": https://git.libreoffice.org/core/commit/72dbdf4f967770e790ab31cb1b22b70686c61993 tdf#168423: Allow subnormals from strtod It will be available in 25.8.2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
The fix seems to work. Tested with: Version: 25.8.2.0.0+ (X86_64) / LibreOffice Community Build ID: cb8bf48260a43895cbb5b1c51e13ce9cdf53e69b CPU threads: 8; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster; VCL: win Locale: fr-FR (fr_FR); UI: fr-FR Calc: threaded and Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 9ee57c6ac279cf3ea25f1598de6deab6e2d6735a CPU threads: 8; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster; VCL: win Locale: fr-FR (fr_FR); UI: fr-FR Calc: threaded