Scientific Notation

  • Thread starter Thread starter Luis Ferrao
  • Start date Start date
L

Luis Ferrao

Hi,

I would like to prevent Visual Studio .Net from automatically converting
1e3 to 1000 in my source code.

Is there a way to do this without turning off any other automatic
formating features?

Thanks in advance,

Luis
 
Luis Ferrao said:
I would like to prevent Visual Studio .Net from automatically converting
1e3 to 1000 in my source code.

Is there a way to do this without turning off any other automatic
formating features?

AFAIK there is no way to turn off this particular feature without turning
off other valuable features of the IDE too.
 
Luis said:
Hi,

I would like to prevent Visual Studio .Net from automatically converting
1e3 to 1000 in my source code.

Is there a way to do this without turning off any other automatic
formating features?

Thanks in advance,

Luis
Could you not use the format command to specify the number of trailing
digits?
 
Daniel said:
I would like to prevent Visual Studio .Net from automatically converting
1e3 to 1000 in my source code.

Is there a way to do this without turning off any other automatic
formating features?
[...]
Could you not use the format command to specify the number of trailing
digits?

I assume that the OP is referring to numeric literals placed directly in the
source code.
 
Yes i'm talking about the numbers as i type them in visual studio's text
editor.

In C# if i type 1e3 it stays that way but in VB 1e3 turns into 1000.0

Isn't there a way to configure the formating rules?
 
Yes i'm talking about the numbers as i type them in visual studio's text
editor.

In C# if i type 1e3 it stays that way but in VB 1e3 turns into 1000.0

Isn't there a way to configure the formating rules?
Tools / Options / Text Editor / Basic / VB Specific
Unselect "Pretty listing (reformatting) of code"

You will lose the other functions of pretty listing:
* Align your code to the correct tab position
* Recase keywords, variables, and objects to the correct case
* Add a missing Then to an If...Then statement
* Add parenthesis to function calls
* Add missing end quotes to strings
* Reformat exponential notation
* Reformat dates

And if you ever type control-K control-D to force it to reformat, it will
change 1e3 to 1000.0 at that time too.

You could always do something like this:

Dim N as Single = "1e3"

and let the implicit CSng() happen. I believe when compiled it would
optimize the same. Even if not, it's a pretty small penalty.
 

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