Re: isnumeric function
Thank you Dennis for this explanation. This is an answer to my original question. To know what is recognized as a number, someone should specify the grammar for such constants, and then there's something to QA against. From what I see the grammar includes 'D' as a valid exponent marker, as type conversion functions recognize 'D' as an exponent. Thus nothing to QA on the side of 'isnumeric'. However, after the tests I ran I discovered the following, which on my opinion should be considered as bugs : - CDbl("123E456") and CDbl("123D456") which enter an infinite loop, - CDec("123E456") and CDec("123D456") which should raise an overflow instead of returning 0 yours faithfully, Lucien Le 23/06/22 à 18:57, dennis.hamil...@acm.org a écrit : Lucien asked, " Is that a relic from prehistoric ages ?" Yes. E was the original exponent marker for what we would now call float values. D was added to distinguish double from (single-precision) float. This had nothing to do with (Visual) Basic (for Applications) originally. To know what is recognized as a number, someone should specify the grammar for such constants, and then there's something to QA against. - Dennis -Original Message- From: Lucien Mathay Sent: Thursday, June 23, 2022 08:12 To:qa@openoffice.apache.org Subject: Re: isnumeric function Le 23/06/22 à 16:23, Dave a écrit : Like Pedro, I can replicate your issue, but cannot explain it, other than to say it might be that the function is seeing 123D456 as a Hex value, which equates to Decimal 19.125.334. Dave, the problem then is that 'A', 'B', 'C' and 'F' are not accepted Only 'D' and 'E' are accepted : - 'E' probably stands for Exponent, thus is should be valid character in the numeric string - 'D' : something like "Decimal" ? [orcmid] [ ... ] - I note that msgbox ("123D-456") also returns True : 'D' seems thus to behave like an exponent. Power of 10 maybe ? - lets test msgbox("123D3") : it prints out 123000 ; it seems thus perfectly equivalent to "123E3" Note that msgbox CDbl("123D3") does not loop but prints out 123000 Is that a relic from prehistoric ages ? Lucien. - To unsubscribe, e-mail:qa-unsubscr...@openoffice.apache.org For additional commands, e-mail:qa-h...@openoffice.apache.org - To unsubscribe, e-mail:qa-unsubscr...@openoffice.apache.org For additional commands, e-mail:qa-h...@openoffice.apache.org
RE: isnumeric function
Lucien asked, " Is that a relic from prehistoric ages ?" Yes. E was the original exponent marker for what we would now call float values. D was added to distinguish double from (single-precision) float. This had nothing to do with (Visual) Basic (for Applications) originally. To know what is recognized as a number, someone should specify the grammar for such constants, and then there's something to QA against. - Dennis -Original Message- From: Lucien Mathay Sent: Thursday, June 23, 2022 08:12 To: qa@openoffice.apache.org Subject: Re: isnumeric function Le 23/06/22 à 16:23, Dave a écrit : > Like Pedro, I can replicate your issue, but cannot explain it, other > than to say it might be that the function is seeing 123D456 as a Hex > value, which equates to Decimal 19.125.334. > Dave, the problem then is that 'A', 'B', 'C' and 'F' are not accepted Only 'D' and 'E' are accepted : - 'E' probably stands for Exponent, thus is should be valid character in the numeric string - 'D' : something like "Decimal" ? [orcmid] [ ... ] - I note that msgbox ("123D-456") also returns True : 'D' seems thus to behave like an exponent. Power of 10 maybe ? - lets test msgbox("123D3") : it prints out 123000 ; it seems thus perfectly equivalent to "123E3" Note that msgbox CDbl("123D3") does not loop but prints out 123000 Is that a relic from prehistoric ages ? Lucien. - To unsubscribe, e-mail: qa-unsubscr...@openoffice.apache.org For additional commands, e-mail: qa-h...@openoffice.apache.org - To unsubscribe, e-mail: qa-unsubscr...@openoffice.apache.org For additional commands, e-mail: qa-h...@openoffice.apache.org
Re: isnumeric function
Le 23/06/22 à 16:23, Dave a écrit : Like Pedro, I can replicate your issue, but cannot explain it, other than to say it might be that the function is seeing 123D456 as a Hex value, which equates to Decimal 19.125.334. Dave, the problem then is that 'A', 'B', 'C' and 'F' are not accepted Only 'D' and 'E' are accepted : - 'E' probably stands for Exponent, thus is should be valid character in the numeric string - 'D' : something like "Decimal" ? - in fact, as Basic states it is a number, I tried to print it out : -> msgbox CLng("123D456") : raises an error stating an overflow -> msgbox CDbl("123D456") : enters an infinite loop and you must terminate the program to exit from this loop -> msgbox CDec("123D456") : prints the value zero (0) - I note that msgbox ("123D-456") also returns True : 'D' seems thus to behave like an exponent. Power of 10 maybe ? - lets test msgbox("123D3") : it prints out 123000 ; it seems thus perfectly equivalent to "123E3" Note that msgbox CDbl("123D3") does not loop but prints out 123000 Is that a relic from prehistoric ages ? Lucien. - To unsubscribe, e-mail: qa-unsubscr...@openoffice.apache.org For additional commands, e-mail: qa-h...@openoffice.apache.org
Re: isnumeric function
HI all, Just a poorly educated guess: In the source code, isNumeric() http://openoffice-vm1-he-de.apache.org/xref/trunk/main/basic/source/runtime/methods.cxx?r=710acb7f#2472 leads to ImpScan() http://openoffice-vm1-he-de.apache.org/xref/trunk/main/basic/source/sbx/sbxscan.cxx?r=323c3501#70 See the description given in lines 63-65 http://openoffice-vm1-he-de.apache.org/xref/trunk/main/basic/source/sbx/sbxscan.cxx?r=323c3501#63 and the code in line `153-154 http://openoffice-vm1-he-de.apache.org/xref/trunk/main/basic/source/sbx/sbxscan.cxx?r=323c3501#152 Best regards, Czesław Le jeu. 23 juin 2022 à 16:23, Dave a écrit : > > > On 23/06/2022 14:26, Lucien Mathay wrote: > > > > Le 23/06/22 à 14:53, Dave a écrit : > >> Try =ISNUMBER("123D456") instead of =ISNUMERIC("123D456") > > Thank you and sorry, Dave, I forgot to specify that the question was > > related to Basic. ( msgbox ISNUMBER("123C456") sends "Basic error - > > function not defined" ) > > > > In Basic thus, msgbox isnumeric("123D456") returns True, although it > > should return False, if I am not wrong ? > > > > Lucien > > Ah! Star Basic > > IsNumeric is very picky about what it accepts. > Print IsNumeric(" 123”) 'True > Print IsNuneric(" 12 3”) 'False > Print lsNumeric(1.23) 'True > Print IsNumeric("123abc") 'False > Print IsNuneric(True) 'False > Print IsNumeric(Now) 'False > > See "Openoffice.Org Macros Explained by Andrew Pitonyak" > https://www.pitonyak.org/book/ page 221 > Like Pedro, I can replicate your issue, but cannot explain it, other > than to say it might be that the function is seeing 123D456 as a Hex > value, which equates to Decimal 19.125.334. > > > - > To unsubscribe, e-mail: qa-unsubscr...@openoffice.apache.org > For additional commands, e-mail: qa-h...@openoffice.apache.org > >
Re: isnumeric function
On 23/06/2022 14:26, Lucien Mathay wrote: > > Le 23/06/22 à 14:53, Dave a écrit : >> Try =ISNUMBER("123D456") instead of =ISNUMERIC("123D456") > Thank you and sorry, Dave, I forgot to specify that the question was > related to Basic. ( msgbox ISNUMBER("123C456") sends "Basic error - > function not defined" ) > > In Basic thus, msgbox isnumeric("123D456") returns True, although it > should return False, if I am not wrong ? > > Lucien Ah! Star Basic IsNumeric is very picky about what it accepts. Print IsNumeric(" 123”) 'True Print IsNuneric(" 12 3”) 'False Print lsNumeric(1.23) 'True Print IsNumeric("123abc") 'False Print IsNuneric(True) 'False Print IsNumeric(Now) 'False See "Openoffice.Org Macros Explained by Andrew Pitonyak" https://www.pitonyak.org/book/ page 221 Like Pedro, I can replicate your issue, but cannot explain it, other than to say it might be that the function is seeing 123D456 as a Hex value, which equates to Decimal 19.125.334. - To unsubscribe, e-mail: qa-unsubscr...@openoffice.apache.org For additional commands, e-mail: qa-h...@openoffice.apache.org
Re: isnumeric function
It is clearly an odd bug isnumeric("123E456") is also True but isnumeric("123DE456") is False... Maybe there is a confusion with Hexadecimal numbers? But A,B,C and F is also False... Anyone has a clue? Regards, Pedro On Thursday 23 June 2022 14:26:33 (+01:00), Lucien Mathay wrote: > > Le 23/06/22 à 14:53, Dave a écrit : > > Try =ISNUMBER("123D456") instead of =ISNUMERIC("123D456") > Thank you and sorry, Dave, I forgot to specify that the question was related > to Basic. ( msgbox ISNUMBER("123C456") sends "Basic error - function not > defined" ) > > In Basic thus, msgbox isnumeric("123D456") returns True, although it > should return False, if I am not wrong ? > > Lucien > > - > To unsubscribe, e-mail: qa-unsubscr...@openoffice.apache.org > For additional commands, e-mail: qa-h...@openoffice.apache.org > > -- Sent with Vivaldi Mail. Download Vivaldi for free at vivaldi.com - To unsubscribe, e-mail: qa-unsubscr...@openoffice.apache.org For additional commands, e-mail: qa-h...@openoffice.apache.org
Re: isnumeric function
Le 23/06/22 à 14:53, Dave a écrit : Try =ISNUMBER("123D456") instead of =ISNUMERIC("123D456") Thank you and sorry, Dave, I forgot to specify that the question was related to Basic. ( msgbox ISNUMBER("123C456") sends "Basic error - function not defined" ) In Basic thus, msgbox isnumeric("123D456") returns True, although it should return False, if I am not wrong ? Lucien - To unsubscribe, e-mail: qa-unsubscr...@openoffice.apache.org For additional commands, e-mail: qa-h...@openoffice.apache.org
Re: isnumeric function
On 23/06/2022 13:39, Lucien Mathay wrote: > Hi again, > > can anybody explain me why isnumeric("123D456") returns True ? > (notice well the "D") > > To me it looks strange ... but maybe I miss something > > Thanks, > Lucien. Try =ISNUMBER("123D456") instead of =ISNUMERIC("123D456") Same meaning, different terminology, - To unsubscribe, e-mail: qa-unsubscr...@openoffice.apache.org For additional commands, e-mail: qa-h...@openoffice.apache.org