hi
please any one can help me for this code
when i run thes code
Dim x As Double
Dim y As Double
x = Console.ReadLine()
y = Console.ReadLine()
y = y * x
Console.WriteLine(y)
when I input x and y
big number for example
x= 123123123123
y= 123123123123
the resoult will be 1,51593034475614E+22
and when i has correct the code to
Dim x As Double
Dim y As Double
x = Console.ReadLine()
y = Console.ReadLine()
y = y * x
Console.WriteLine(y.ToString("n10"))
the resault was not correct also it was 15,159,303,447,561,400,000,000.0000000000
but the correct resaulrt is 15159303447561417273129
please can any one help me for this code to be correct ?
problem to multiplication complex number
Started by aimmh, Oct 02 2010 09:59 AM
1 reply to this topic
#1
Posted 02 October 2010 - 09:59 AM
|
|
|
#2
Posted 02 October 2010 - 12:46 PM
The sad truth is that vb won't handle more numbers so the result won't be exact. However you could do walkarounds to this problem with special made structures/classes. I haven't tried it myself but it seems that there's a built in structure for this called BigInteger: BigInteger Structure (System.Numerics)


Sign In
Create Account

Back to top









