473,480 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to display the part of an infinity value?

Hello,
I have an aritmetic calculation like this:

First note that: i need a "timer" to get the value for value3.
(however removing "timer" didn't differ)

Dim value1 As Long
Dim value2 As String
Dim value3 As String
value3 = (value2 * 8) / value1
Label1.Text = value3

which returns result (label1.text) as an "infinity" value. If the
result is not infinity no problem.

Here's a problem that i want to display first 3 chars of the infinity
value?
(eg: if the infinity value is 180,5654568456845684.... i want
label1.text to display "180"

How can i do this?

Thanks...
Dec 10 '07 #1
13 2293
"kimiraikkonen" <ki*************@gmail.comschrieb
Hello,
I have an aritmetic calculation like this:

First note that: i need a "timer" to get the value for value3.
(however removing "timer" didn't differ)
Why do you mention a timer? Does it have any influence?
Dim value1 As Long
Dim value2 As String
Dim value3 As String
value3 = (value2 * 8) / value1
Label1.Text = value3
Always use Option Strict On. I can not even test your code.
which returns result (label1.text) as an "infinity" value. If the
result is not infinity no problem.

Here's a problem that i want to display first 3 chars of the
infinity value?
(eg: if the infinity value is 180,5654568456845684.... i want
label1.text to display "180"
Infinitiy is never 180,5.... Infinity is infinity and displayed by
"infinity".
How can i do this?
Don't divide by 0 and you wont' get "infinity".
Armin

Dec 10 '07 #2
"kimiraikkonen" <ki*************@gmail.comschrieb
Hello,
I have an aritmetic calculation like this:

First note that: i need a "timer" to get the value for value3.
(however removing "timer" didn't differ)
Why do you mention a timer? Does it have any influence?
Dim value1 As Long
Dim value2 As String
Dim value3 As String
value3 = (value2 * 8) / value1
Label1.Text = value3
Always use Option Strict On. I can not even test your code.
which returns result (label1.text) as an "infinity" value. If the
result is not infinity no problem.

Here's a problem that i want to display first 3 chars of the
infinity value?
(eg: if the infinity value is 180,5654568456845684.... i want
label1.text to display "180"
Infinitiy is never 180,5.... Infinity is infinity and displayed by
"infinity".
How can i do this?
Don't divide by 0 and you wont' get "infinity".
Armin

Dec 10 '07 #3
"Armin Zingler" <az*******@freenet.deschrieb
Here's a problem that i want to display first 3 chars of the
infinity value?
(eg: if the infinity value is 180,5654568456845684.... i want
label1.text to display "180"

Infinitiy is never 180,5.... Infinity is infinity and displayed by
"infinity".
Ah, you mean a finite number of decimal places....

Pass the correct format to the number's ToString function. If you had used
Option Strict, you would have been forced to think about this conversion.
Armin

Dec 10 '07 #4
"Armin Zingler" <az*******@freenet.deschrieb
Here's a problem that i want to display first 3 chars of the
infinity value?
(eg: if the infinity value is 180,5654568456845684.... i want
label1.text to display "180"

Infinitiy is never 180,5.... Infinity is infinity and displayed by
"infinity".
Ah, you mean a finite number of decimal places....

Pass the correct format to the number's ToString function. If you had used
Option Strict, you would have been forced to think about this conversion.

Or, if you really want the first 3 characters, use the String's SubString
function.
Armin

Dec 10 '07 #5
On Dec 10, 4:48 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"Armin Zingler" <az.nos...@freenet.deschrieb
Here's a problem that i want to display first 3 chars of the
infinity value?
(eg: if the infinity value is 180,5654568456845684.... i want
label1.text to display "180"
Infinitiy is never 180,5.... Infinity is infinity and displayed by
"infinity".

Ah, you mean a finite number of decimal places....

Pass the correct format to the number's ToString function. If you had used
Option Strict, you would have been forced to think about this conversion.

Armin
Yes, the problem occurs because of assigning zero to value3 field, but
after 0,5-1 seconds later value3 gets updated to a normal number like
250 (value3 as long, only integral part is shown, here's no problem)
due to my code configuration.

So, i need to calculate value1 after 1-2 seconds pass, thus value3
becomes normal and infinity will not be displayed how can i do that?
Dec 10 '07 #6
On Dec 10, 5:01 pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Dec 10, 4:48 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"Armin Zingler" <az.nos...@freenet.deschrieb
Here's a problem that i want to display first 3 chars of the
infinity value?
(eg: if the infinity value is 180,5654568456845684.... i want
label1.text to display "180"
Infinitiy is never 180,5.... Infinity is infinity and displayed by
"infinity".
Ah, you mean a finite number of decimal places....
Pass the correct format to the number's ToString function. If you had used
Option Strict, you would have been forced to think about this conversion.
Armin

Yes, the problem occurs because of assigning zero to value3 field, but
after 0,5-1 seconds later value3 gets updated to a normal number like
250 (value3 as long, only integral part is shown, here's no problem)
due to my code configuration.
Correcting previous post, problem was occuring due to assigning zero
to value1 field. Forget the rest of this paragraph.
So, i need to calculate value1 after 1-2 seconds pass, thus value3
becomes normal and infinity will not be displayed how can i do that?
OK, however i managed to make the code by adding this code block in a
timer (it queries value situation)
if not value1 = "0" then
'calculate value3
value3 = (value2 * 8) / value1
label1.text = value3

Now that the problem is i want to display first 3 chars(left to right
reading) of the value3. How can i trim or filter(throw away) the rest
of numberic part of value3?
Dec 10 '07 #7
On Dec 10, 5:01 pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Dec 10, 4:48 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"Armin Zingler" <az.nos...@freenet.deschrieb
Here's a problem that i want to display first 3 chars of the
infinity value?
(eg: if the infinity value is 180,5654568456845684.... i want
label1.text to display "180"
Infinitiy is never 180,5.... Infinity is infinity and displayed by
"infinity".
Ah, you mean a finite number of decimal places....
Pass the correct format to the number's ToString function. If you had used
Option Strict, you would have been forced to think about this conversion.
Armin

Yes, the problem occurs because of assigning zero to value3 field, but
after 0,5-1 seconds later value3 gets updated to a normal number like
250 (value3 as long, only integral part is shown, here's no problem)
due to my code configuration.

So, i need to calculate value1 after 1-2 seconds pass, thus value3
becomes normal and infinity will not be displayed how can i do that?
Correcting previous post, problem was occuring due to assigning zero
to value1 field. Forget the rest of this paragraph.
So, i need to calculate value1 after 1-2 seconds pass, thus value3
becomes normal and infinity will not be displayed how can i do that?
OK, however i managed to make the code by adding this code block in a
timer (it queries value situation)
if not value1 = "0" then
'calculate value3
value3 = (value2 * 8) / value1
label1.text = value3

Now that the problem is i want to display the integral part of the
value3. How can i trim or filter(throw away) the rest
of numberic part of value3? For ex: value3 = 185,986431654874984987498
= i want it as "185". (declared as string)
Dec 10 '07 #8
"kimiraikkonen" <ki*************@gmail.comschrieb
Now that the problem is i want to display first 3 chars(left to
right reading) of the value3. How can i trim or filter(throw away)
the rest of numberic part of value3?
185,986431654874984987498 = i want it as "185". (declared as string)
Int
Armin
Dec 10 '07 #9
"kimiraikkonen" <ki*************@gmail.comschrieb
Now that the problem is i want to display the integral part of the
value3. How can i trim or filter(throw away) the rest
of numberic part of value3? For ex: value3 =
185,986431654874984987498 = i want it as "185". (declared as string)
Int
Armin
Dec 10 '07 #10
"kimiraikkonen" <ki*************@gmail.comschrieb
>
Correcting previous post, problem was occuring due to assigning zero
to value1 field. Forget the rest of this paragraph.
Could you please stop sending your text again and again? If you want to
correct something then only post the correction, not the whole post. Do you
expect us to compare all your postings to find out what you have changed?
Armin

Dec 10 '07 #11
On Dec 10, 5:43 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"kimiraikkonen" <kimiraikkone...@gmail.comschrieb
Correcting previous post, problem was occuring due to assigning zero
to value1 field. Forget the rest of this paragraph.

Could you please stop sending your text again and again? If you want to
correct something then only post the correction, not the whole post. Do you
expect us to compare all your postings to find out what you have changed?

Armin
Sorry, i'll try to categorize them and review better before post,
however you have some double posts, probably accidently.They're OK for
me, one of them that maybe you want to know.

http://img443.imageshack.us/img443/7357/dphp0.gif

Thanks.
Dec 10 '07 #12
"kimiraikkonen" <ki*************@gmail.comschrieb
Sorry, i'll try to categorize them and review better before post,
Don't get me wrong, it's not a problem at all that you correct yourself, you
only shouldn't post /everything/ again but only the correction. Thanks!
however you have some double posts,
Surprise!
Armin

Dec 10 '07 #13
On Dec 10, 6:05 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"kimiraikkonen" <kimiraikkone...@gmail.comschrieb
Sorry, i'll try to categorize them and review better before post,

Don't get me wrong, it's not a problem at all that you correct yourself, you
only shouldn't post /everything/ again but only the correction. Thanks!
however you have some double posts,

Surprise!

Armin
No, problem, however i managed to solve the problem, the key was that
you pointed "infinity" warning occured because of trying to divide
value by zero, i added an "if" statement against division by zero,
however it's OK now.

Thanks.
Dec 10 '07 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
2641
by: Grant Edwards | last post by:
I finally figured out why one of my apps sometimes fails under Win32 when it always works fine under Linux: Under Win32, the pickle module only works with a subset of floating point values. In...
108
6290
by: Bryan Olson | last post by:
The Python slice type has one method 'indices', and reportedly: This method takes a single integer argument /length/ and computes information about the extended slice that the slice object would...
2
4324
by: Russell Smith | last post by:
Timestamps support infinity. However if appears dates do not. When timestamps are cast to dates, there is no output. Is this an acceptable option or not? Below are a number of examples...
5
4162
by: Peter Hansen | last post by:
I'm investigating a puzzling problem involving an attempt to generate a constant containing an (IEEE 754) "infinity" value. (I understand that special float values are a "platform-dependent...
2
1887
by: Pierre Rouleau | last post by:
Hi all, When using Python 2.4.x on a Win32 box, marshal.loads(marshal.dumps(1e66666)) returns 1.0 instead of infinity as it should and does under Python 2.5 (also running on Win32 ). This...
5
9767
by: westhood | last post by:
In my program I must have some variables which values are infinity. It means the variable must be bigger than any integer. And if we add some to it, its value should still be infinity. I try...
37
16172
by: The87Boy | last post by:
Hey all I have a problem with float I should write a program, where you are getting some numbers from the command-line and try to find the maximum and minimum-values of these numbers. I need...
14
5505
by: Jim Langston | last post by:
The output of the following program is: 1.#INF 1 But: 1.#INF 1.#INF was expected and desired. How can I read a value of infinity from a stream?
0
7049
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6912
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7052
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
6981
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5348
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3000
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
188
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.