Tracker
 ASP PHP JavaScripts MySQL MS Access MSSQL VISUAL BASIC Subjects/Titles Post Text/Content
HOME    TRACKER    Visual Basic

Exponential Value (scientific Notation)

I'm trying to do digit counting in vb. I convert all my input numbers to single so that it retains the decimal points. I then convert the single to string type. This algorithm works great until at some point VB decided to drop the decimal points and use scientific notation. My question is how big of a number can VB retain before it converts it to exponential value. Moreover, is there a way to force VB to convert a number into scientific notation?150 --> 1.5e+2Any help would be appreciated.

See Related Forum Messages: Follow the Links Below to View Complete Thread
Scientific Notation
Is it possible to prevent visual basic (v.6.0) from automatically converting large numbers to scientific notation?

thanks

Scientific Notation
Just for curiosity sake might come in handy one day how would get this

Dim Number1 as double

Number1 = 100000 ^ 10000000

Label1.caption = number1

To show up in a format not in scientific notation but rather show most or all the #'s?

Scientific Notation
Hi!

Does anyone know how to stop VB from transforming your long number into a scientifically notated one?

Dim myBigNumber As Long: myBigNumber = 1024551063141712

When I type that in it changes it to 1.02455106314171E+15 and then throughs and error. "Runtime Error 6, overflow"

First off, I need it to stop notating the number. If it does that then it is rounding some of the numbers and I can't let it do that.

Fixing the first should fix the second so I don't think the RunTime error is a problem.

Thank you,

Scientific Notation
How to fix this:

Code:
Label1.Caption = CDbl(3 / 180)
'result is 1.66666666666667E-02
'how do i make it to be 0.01666666666666667
'without the scientific notation E

Scientific Notation
How can I conver from +7.38610000E+01 and 00000000.019 to +7.386 and 0.019 ??? Is there a function i VB or do I have to write my own?

How To Disable Scientific Notation?
I'd like to make a text box display a small number (e.g. 0.012345) after a calculation, but instead VB6 automatically converts it into scientific notation (i.e. 1.2345e-2). How can I stop this treatment or change that back to 0.012345? After all I don't want scientific notation to be displayed there.

Thanks.

IsNumeric And Scientific Notation
Hi. I've got a problem regarding IsNumeric and scientific notation. I found out that IsNumeric will actually return True for an expression formatted in scientific notation. For example, IsNumeric(123E456) or IsNumeric (112D91) will return True. The first example is actually considered as a Single data type and the second is considered as a Double. I think VB6 performs some sort of conversion on the expression, although technically it is a string expression because of the "E" and "D" contained within it.

Is there a way to force IsNumeric to accept the example as a pure string expression so that it returns False? Thanks.

Double To Scientific Notation
Is there an easy way to convert a decimal to scientific notation?

Eliminate Scientific Notation
I need to display the Double value 1.800000000000000123E+18 as the whole number 1800000000000000123 without the scientific notation. Does VB6 have anything that'll do this, or do I need to write my own?

Thanks

No Scientific Notation For Large Numbers
Is there a way to stop VB displaying large numbers in scientific notation (eg 1.2322343242E+15)?
I've got the caption of a label set to a value in an excel sheet which happens to be a 16 digit number.
How do i force it to show the full number normally?

Force A Number To Be Scientific Notation
x = 1.2e2
y = 1.4e2
z = x + y
label1.caption = z

260 is how it will display the answer. Is there anyway I can tell it to display the answer as 2.6e2 ?

Random Numbers And Scientific Notation
Hey all, another quirk that creates a problem for me . . . seeding random numbers.

Here's a bit of example code:

Code:
Dim iSeed\$

iSeed = "11111111111111111111111111"

Rnd -1
Randomize iSeed

MsgBox Rnd
The problem is, Randomize rounds off iSeed to 1.111111E+25, so that
Randomize iSeed
would do exactly the same as
Randomize (iSeed + 1)
Not good

Any way to fix or get around this?

Another thing (pales in importance to the above though), I've noticed that VB's semi-random numbers generated by Rnd -1 and Randomize iSeed repeat after about 12,287,057. This means that there will be only that many different seeds Is this a limitation of VB (probably), is there a way around it?

Thanks

Arigato,
Gamer X

Floating Point Scientific Notation
Hi,
I'm designing a function shich returns a floating point value "single". how can I forca Visualbasic to print it normally without converting to the scientific notation.

MNT

Formatting Scientific Notation Numbers
I have a couple of text box controls which can accommodate numbers up to 15 digits in size. When large numbers are entered into these fields and the data is saved, the numbers are displayed in scientific notation when the record is displayed at a later date. Is there an easy way to have the data display in normal format when populating the text boxes? I have tried setting the DataFormat property for the text box to use the Number format, but it doesn't seem to have any effect.

Any help would be appreciated.

Prevent Conversion To Scientific Notation
Hello,
I have function that excepts a double as the passed in parameter.
When I call this procedure and pass in a number great that 14 digits, the number is rounded and set in scientific notation. Ex:

Set rtn_Value = FunctionA(10000000002162501)

After moving the cursor to the next line, my call changes to

Set rtn_Value = FunctionA(1.00000000021625E+16)

Is there a way to stop this rounding and conversion from taking place? I'm dealing with numbers typically E20 in length.

Thanks,
Ted

[Solved] UPDATE And Scientific Notation
VB and MS Access here.

Ok I have a Update sequence that was failing sometimes and I've found out what the problem is but dunno how to solve it.

The Update statement updates a numeric field in the DB, problem is that with high values VB formats them as 2,324173E+07 f. ex. and the "UPDATE Table1 SET field1=2.324173E+07" sentence I send to execute obviously fails. (Field in DB is Single Type so that's not the problem)

Should I format the number before adding it to the UPDATE statement or are there simpler solutions?

Ty guys in advance

Edited by - jpp1jpp1 on 7/26/2005 7:21:22 AM

MSChart Y-Axis Values In Scientific Notation
I'm developing a program for water systems that allows them to graph their water production and usage. However, once the y-axis value in MSChart reaches 1million it turns to scientific notation.
Does anyone have any work arounds for this? Any help would be appreciated!

Thanks,

Trey

RESOLVED : Display A Number Without Scientific Notation
I have some numbers that I'm tracking through code and after running some formula's, I display the results to the user in a checkbox. Because these values can get large, I'm using a data type of Single for the variable. However, when I goto display the value in the textbox, it formats it to scientific notation. Is there anyway to avoid this. Its probably something simple but I cant figure it out.

Thanks for your help.

Bruce

"If at first you don't succeed, try, try again. Then quit. No use being a damn fool about it." --W.C. Fields

Saba

Edited by - bruha on 1/18/2006 6:56:44 AM

Exponential Overflow
I am taking my 1st course involving VB & am utterly clueless.

while writting a program that outputs the product of exponential equations, I receive overflow errors at higher values. What do I dim my variables as to prevent this?

Also, my code looks pathetic, I have been told there are programs to help tidy the code, but have been entirely unsuccesfull in locating any of them.

Any help w/ either of these scenarios is greatly appreciated.

Chio.

Exponential Values
I have a program that retrieves values from an excel spread sheet. My problem is when I get the values from my recordset 'myValue = oRS.Fields(i).value', I need to know how to get the actual value! In this case, Excel shows 8383838383838383, but my variable (which is a string) obtains 8.38383838383838E+15. Any ideas how I can fix this? Thanks

Exponential Problem (I Think)
Hey

I am using this equasion in my program and it is giving me an error if the value of Y is less than the value of Best_H0

Code:
X = Best_A * (Y - Best_H0) ^ Best_B

For example:

Best_A = 22.16
Best_B = 2.842
Best_H0 = 1.00816

Does anyone have any ideas on how to get around this???

Thanks

Exponential Looping
Got a problem in my loop and I'm not certain how to code it.

I am not supposed to use x ^ y and I have to use multiplication in a loop to
do this.

Here's what I have...

If rdoExp.Checked = True Then

If num2 = 0 Then

lblResult2.Text = "Cannot Raise to the power of Zero!"

Else

Dim x As Integer

Dim old_ans As Double

' Loop the Multiplication x Times

If Val(txtNum2.Text) = 2 Then

lblResult2.Text = Str(num1) + " ^" + Str(num2) + " =" + Str(num1 *
num1)

Else

For x = 1 To num2

result = (result * num2) + old_ans

Next

'Dump The Result into the Result Area of the Form

lblResult2.Text = Str(num1) + " ^" + Str(num2) + " =" + Str(result)

End If

'Reset result amount

result = 0

old_ans = 0

End If

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.576 / Virus Database: 365 - Release Date: 1/30/2004

.Find For The Exponential Number
Hi All,

I am trying to work with the cell containing the minimum value from a range. I have the code working fine except for when I try to deal with transendental numbers (such as pi), which it cant register exactly (Stupid floating points!)

I've got a way around it with the code below, but just wondering if someone can astound me yet again with a better method!

Code:
Sub FindCell()
'Other Code Here

MinNum = Application.WorksheetFunction.Min(rngUse)

Set rngMin = rngUse.Find(what:=MinNum, lookat:=xlWhole)

If rngMin Is Nothing Then
Set rngMin = ClosestCell(MinNum, rngUse)
End If

'Other Code Here
End Sub

Function ClosestCell(MinNum As Double, rngTot As Range) As Range
Dim rng As Range
Dim Min As Double
Dim Diff As Double

Min = 1
For Each rng In rngTot
Diff = Abs(rng.Value - MinNum)
If Diff < Min Then
Min = Diff
Set ClosestCell = rng
End If
Next rng
End Function

Any help greatly appreciated!

Cheers,
Dangles

Number To String Without Exponential
Hi all

I'm trying to display very small numbers on screen wihout using the exponential form (1x10e-7 etc) Unfortunatly as it converts the number to a string it converts the exponential format with it

Code:
Dim longTime as Long
Dim strTime as String

longTime = 0.001
strTime = Str\$(longTime)

Msgbox(strTime)

The messagebox will display '1x10e-3' instead of '0.001' which I want

Any ideas how I can get around this? I can write a messy function to convert the string I get into the string I want, but I'm sure there is a more elegant solution out there!

Thanks

303

How To Draw Exponential Gradient Between Two Colours ?
Hi,

I would like to draw an exponential (as opposed to linear)
gradient between two colours, on a form or picturebox.
I tried adapting the line-drawing code given at
http://www.freevbcode.com/ShowCode.asp?ID=3748

But couldn't achieve the result. Any suggestions on how to
do it ?

Thanks

(new Angle) MsChart Y Axis Exponential Problem
VB6 SP5

A recent post and a few past ones have try to find a way to over come the MsChart control where once the Y axis is 1,000,000 or more it reverts to an exponential i.e 1,000,000 becomes 1e+006.

This is an annoying problem when your users are not scientifically minded.

In most cases you would want MsChart to automatically assign the minimum and maximum value ranges of the chart.

Is it possible to loop through the auto assigned Y Axis values and force changes were required.

All the best

Values In Y-axis R Shown In Exponential If It Exceeds 10,00,000
Hi Friends,

I am using chartype graph as "tchcharttype2darea"
on my x-axis i have dates and ob Y-axis i have amount.

i am using "ChartData" to plot my graph.

My graph is working fine if amount on y-axis is less than 10,00,000 if it exceed million mschart automatically converts it to exponential format.

I don't want my values to be in expnential format, if its million i want it to be shown in million. Pls help.

Thanking u.

Ramsys

Write To File; Number In Exponential Format
What format mask will write a number in exponential format?

For example if dblNumber is 23.4432E+34

sStringToFile = format(dblNumber, "??????")

Thanks in advance for any help.

Reading Cartesian Coordinates In Exponential Form....
Hallo all!

Here i am again, with a different problem this time. Any input would be highly appreciated... Please bear with me, first time with visual basic...

Ok my problem is thus, I have to read a STEP file (which is a data exchange format in CAD) and make sense of it all.

The problem I am facing is like thus... the file has the following format
#3=CARTESIAN_POINT('',(0.E0,0.E0,0.E0));
#4=LINE('',#3,#2);
#6=DIRECTION('',(0.E0,0.E0,-1.E0));

Now somehow I have to make the program understand that 0.E0 and etc stands for 0 x 10 power 0, or 0 or -1.E0 standing for
-1x10^0 or 1.E2 standing for 100 ie 1x10^2. Is there a way to do this? I am stymied again, my knowledge of VB is really nto that deep at all... I would appreciate any feedback on how it can be done...

Thanks all
Pete

NumberFormat Scientific
Hi All!

What is the syntax for NumberFormat property to make the column have "Scientific" format?

Thanks a lot!

Elena

Scientific Calculator
Does anyone have any examples of a scientific calculator. I don't have any specific questions yet, but if anyone has made one before, I would like an example to get some ideas and a good starting point. Thanks!

Scientific Format
What is the correct format for scientific notation

X = Format(X, "scientific" ) does not do it
nor does
X = Format(X, scientific )
Thanks!!!

Can I Don't Want To Use Scientific Number?
I would like to use a number which is more than 30 digits, but VB gives me scientific number, so it make me can't get the exactly calculation which I expected. So , it that any ways for me to skip this scientific numbers?

Scientific Functions
Hi all,

I am looking for a library or a class in which some scientifical function such as derived and integral, properties would be implemented.

Thanks,

Guy

Not Scientific Format
I have a variable of double type. I would like to display its contents in regular format, let's say its value is presented by 20 digits, so I would like to display it (in message box, text box) as 12345678900987654321 rather than as 1.23456789001236E+18. How can I do that?
Thank you.

Big Oh Notation
Sorry if this is in the wrong section. You guys don't have a general Computer Science forum, and since this has some VB code, I thought this would be a good place to put it
___

I have the following VB code:

____

For k = 1 To 4*n Step 2
iSum = iSum +1
Next k
For i = 1 To 2*n
For j = 1 To 3*n Step 3
iSum = iSum +1
Next j
iSum = iSum + 1
For m = 1 To 2*n
iSum = iSum + 1
iSum = iSum + 1
Next m
Next i

____

What is the complexity of this code in terms of Big Oh notation? I'm getting confused on what to look at. Is the notation going to be:
O(n^2)?
O(n^4)?

Why?

Thanks

Campbell Scientific CR10
I need to establish a connection with a CR10 datalogger. Does anyone ever attempt to do a similar thing.

I'am able to connect with the datalogger, but 25 seconds or so arfter the connection the link breaks. There's probably a connection timeout on the datalogger.

Any ideas on the subject are welcome

Thanks

Array For A Scientific Problem-Help Please !
Hi everyone,
I am a newbie and writing a simulation programme for a scientif problem. The simulation generates number of data versus time. If time is X then Y1,Y2,Y3,Y4 is generated.I do around 3000 iteration(but sometime more..a dynamic array?). For each iteration I wanna store the generated data and at the end of the calculations I would like to access X-Y1, X-Y2 ...so on.. pairs for graphical display.(or X versus Y1,Y2,Y3,Y4). So the question is how can I keep/save all the calculated values without writing to a file ? Can I keep them in the memory ? What is the easiest way to do this? Sorry if this is a simple question.
(I am using VB 6.0)
Thank you very much,
Hudai

Scientific Caculator Chars To Hex
ok i know im getting old now when i forget the basics :-(
I want to convert special chars to hex
useing the caculator.. but i forget how to do it.
can some one walk me thru the steps real quick.
i used to do this all the time.. i cannot belive i forget how to do it now.
I want to teach my son , so he doesnt have to rely on a chart that may or may not be avialble when he needs it. ( like his dad obviously does now :/ )
thnx guys -n- gals

Reading In Scientific Numbers
What would be the best way to get a scientific number that is currently a string read into a variable that can be used as a number?

ie:
1.0000000000e+000
1.0000000000e-012

Scientific Number Format
i have the follwing subroutine which formats a number into a scientific format:

Public Function Sci(number, DP) As String
Sci = Left\$(Trim(Str(number)), 1) & "." & Mid\$(Replace(Trim(Str(number)), ".", ""), 2, DP) & " E" & Str(InStr(1, Trim(Str(number)), ".") - 2)
End Function

However the ouput is 8.6100 E 5

i would like it to appear as 8.6100E+05

how do i do this, and ideas??? Also i thought that i could set the number format property of a text box to how i desire, as i tried to set the scientific number format here, but this did not appear to work!

James

XLL Addin For GSL (Scientific Library)
XLL Addin for GSL (Scientific Library) ...?

Very Basic VB-notation
This is my problem:

I want to create a form in Access with a combo-box that looks up values in a table. When I select a value in that combo-box, I want some text boxes to show some values from the table discussed above as well as corresponding values from another table. The value in the combo-box can be found in both the tables.

For example, if I select a product called XX in the combobox, then I want to see the product's releasedates from the table#2 as well as how much hours are put into the product from table#1 for that specific product.

How do I write the code?

Date Notation In Vba D-mm-yy
Hello again,

Code:
Private Sub CommandButton5_Click()
Dim waarnaartoe
Dim mydate

mydate = Date

klantexport = klantnaam.Value
gemeenteexport = Gemeente.Value

waarnaartoe = "c:PotierOffertes" & klantexport & ", " & gemeenteexport & " " & mydate & ".xls"

Windows("Prijsberekening.xls").Activate
Sheets("Offerte").Select
Sheets("Offerte").Copy
ActiveWorkbook.SaveAs Filename:=waarnaartoe, _
ActiveWindow.Close

End Sub

I would like to save everything made by vba as name, city date.xls

little problem: date is now 18/08/03 (so excel thinks it's a path)
it should be 18-08-03

Can it be done and how???

Thx

In VB you specify a hexadecimal number with the prefix "&H" and upper case letters for the digits above 9, so "&H15A8" for example.

What then are the numbers that I see specified in the form "0x12be3"? Is this simply a different notation style for hexadecimal numbers? Couldn't find the answer in the help files.

[] Enum Notation
What does the square bracket [...] notation mean?

For example:
VB Code:
Private Enum Things    [Thing] = 0    AnotherThing = 5
I've only seen it in enums.

Format To Notation
How can I format a number INTO notation?

I am working with very small numbers like 0.0000013
It would be a lot easier to be able to use natation, 1.3E-6.

Is there such a function? Can the format function do this somehow?

#Date# Notation
What am I doing wrong? This condition doesn't evaluate to true.
VB Code:
If Now >= #9:30:00 AM# And Now <= #4:00:00 PM# Then

If I change "Now" to "Time" it doesn't make a difference.

Postfix Notation Anyone
does any one know about Postfix Notation and how it can be made into a vb program for like adding numbers and subtracting, multipling, dividing etc...