on 07-14-2014 7:50 PM
Hi
In ASE15.7, the function isnumeric('e') returns 1. Same thing for isnumeric('E').
The Sybase case 11516623 says it is an expected result as 'e' refers to exponent.
If it is expected why it is not indicated in the documentation:
It is very confusing. What do you think?
thanks,
Vincent
Thanks for all your comments!
That would be nice if the function isnumeric could make the difference between the letter 'e' and the exponent 'e1' or '1e1'.
Ideally a CR should be opened as this problem created a bug in our application (so could create problems with other customers) but I am too tired to "argue" again with the Support.... 😞
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"e" should refer to the constant IMO. e (mathematical constant) - Wikipedia, the free encyclopedia
IMO 'e' is first a letter. This letter was used later to refer to the Euler constant by the mathematicians.
If we start using e for the exponent, why not using all the other mathematician symbols such as 'i' to refer to the i used in complex numbers (i2 = -1), or 'g' for the gravitational force (9.80...)...
There are other fringe cases as well. These characters are considered numeric on their own: (my client charset , and server charset are "iso_1"):
"." - period
"," - comma
"$" - currency sign
"+" - plus sign
"-" minus sign, or "dash"
"e" and "E" - already mentioned
ascii character 163 - "currency symbol"
ascii character 164 - "currency symbol"
ascii character 165 - "currency symbol"
ascii characters 9 thru 15 - "mostly unprintable characters, but include linefeed, and carriage return"
ascii character 32 - "space"
For your entertainment, run this query on your ASE:
select ''''+char(number)+'''' as "Character"
, number as "AsciiCode"
, isnumeric(char(number)) as "IsNumeric?"
from master..spt_values
where type = 'P'
and number between 1 and 254
and isnumeric(char(number)) = 1
Message was edited by: Kevin Sherlock - eliminated discussion about "long" literals, was reading incorrect doc set
.....ooops spoke too quick:
select convert(numeric,'e') returns 0......ala 1.0e0 is the interpretation of 'e'.....weird as 'e' is float notation and convert(float,'e') throws an error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I agree it's confusing, because 'e' is not recognized as a numeric expression in its own right. I.e. the following fails:
1> select convert(float,'e')
2> go
Msg 249, Level 16, State 1
Server 'SYB157', Line 1
Syntax error during explicit conversion of VARCHAR value 'e' to a FLOAT field.
If this worked, then it would be logical that isnumeric('e') returns 1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.