question

  • Thread starter Thread starter a
  • Start date Start date
a said:
is there any way to find out if the number is in scientific format

Numbers inside the computer (i.e., values of "float" or "double" variables)
are not "in" any written format. They are stored in binary. So:

x = 1.2e1;

x = 12.0;

x = 12.0000;

store the same value in x. The computer does not remember which way you
wrote it.

"Decimal" variables remember where you placed the decimal point, so that
12.0 and 12.00 are stored differently.

Was that the question, and did I answer it?
 
Like Michael Covington, I am not sure what you are asking. However, here is
an alternative answer. If you are talking about trying to determine if a
user has entered a number into a text field using scientific notation, you
can use a regular expression to test the format.

RegExLib has several good expressions:
http://regexlib.com/Search.aspx?k=scientific notation

This article shows how to use regular expressions to identify different
number types. You would use the same pattern, but use one of the regex
patterns for a scientific notation number.

http://www.c-sharpcorner.com/UploadFile/prasad_1/RegExpPSD12062005021717AM/RegExpPSD.aspx

--BJ
 
thank's

i will try that.

thing is that i hava a textbox in whitch is programmicly
written a number.
I want to find out if the number(string) in textbox is written in
scientific format
 
Regex on the Text, perhaps? Something like (depending on your
meaning):

^[-]?[0-9]\.[0-9]*([eE][+-]?[0-9]+)$

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top