Click here to Skip to main content
15,911,139 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Reading javascript modified value from a readOnly TextBox Pin
Not Active25-Jan-09 8:08
mentorNot Active25-Jan-09 8:08 
QuestionHow to create an array of buttons then access attributes in event handler Pin
scjsb24-Jan-09 7:48
scjsb24-Jan-09 7:48 
AnswerRe: How to create an array of buttons then access attributes in event handler Pin
sudhanvag25-Jan-09 7:41
sudhanvag25-Jan-09 7:41 
Questioncan't get to display image in gridview Pin
Meax24-Jan-09 5:58
Meax24-Jan-09 5:58 
AnswerRe: can't get to display image in gridview Pin
CooperWu25-Jan-09 2:28
CooperWu25-Jan-09 2:28 
QuestionHelp! ASP.NET cannot do simple arithmetic... Pin
Ben Jern24-Jan-09 5:02
Ben Jern24-Jan-09 5:02 
AnswerRe: Help! ASP.NET cannot do simple arithmetic... Pin
Ben Jern24-Jan-09 5:38
Ben Jern24-Jan-09 5:38 
AnswerRe: Help! ASP.NET cannot do simple arithmetic... Pin
Colin Angus Mackay24-Jan-09 7:25
Colin Angus Mackay24-Jan-09 7:25 
Ben Jern wrote:
ASP.NET cannot do simple arithmetic


Just to clear up a misconception you have. ASP.NET is a framework for writing web applications. It never has and never will "do simple arithmetic". The .NET Framework does have a Math class for some complex mathematical functions. Simple arithmetic is built into the language (VB or C# for example).


Ben Jern wrote:
Problem is, it keeps giving me - 7.105427357601E-15

What in the world am I missing?


Although you have found an answer by yourself that returns the result that you expected, do you know why? (I'm presuming you've never done a formal course in computer science or software engineering becuase this would have been answered by a 1st year class on floating point maths)

So, what happens is that a Double is represented by 64 bits of memory. Because certaiun numbers cannot accurately be represented rounding errors occur. It is like if I ask you to represent the fraction one-third in decimal digits. The best you can give me is 0.33333333333.... In fact, the series of threes is infinite in this case. If I gave you 64 digits to represent this number, eventually you'd run out of digits to represent the value, yet it still wouldn't actually represent one-third, just a close approximation of it.

In computing terms values that are powers of 2 are represented most easily and other values are less easily represented leading to situations where you end up with a close approximation. Once you start performing mathematical operations on these close approximations you may get some very slight rounding errors creeping in to the results.

The result you got was 0.000000000000000710542935760 which, as you can see, is very close to zero.

The reason you get your answer in decimal is because that datatype is designed for very precise mathematical operations where rounding errors are less acceptable. It does come with some limitations. The processing power required is greater for decimals. The range of values is smaller with decimals. Decimals take more memory to store.

* Developer Day Scotland 2 - Free community conference
* The Blog of Colin Angus Mackay


Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.

GeneralRe: Help! ASP.NET cannot do simple arithmetic... Pin
Ben Jern24-Jan-09 14:26
Ben Jern24-Jan-09 14:26 
QuestionRestricting session sharing between multiple tabs in a browser. Pin
Praveen_S24-Jan-09 2:53
Praveen_S24-Jan-09 2:53 
AnswerRe: Restricting session sharing between multiple tabs in a browser. Pin
CooperWu24-Jan-09 4:16
CooperWu24-Jan-09 4:16 
Questionhow to add feature of changing color of text giving wide range of color to user in softare template creator using asp .net Pin
teju gadekar24-Jan-09 1:35
teju gadekar24-Jan-09 1:35 
GeneralRe: how to add feature of changing color of text giving wide range of color to user in softare template creator using asp .net Pin
CooperWu24-Jan-09 4:19
CooperWu24-Jan-09 4:19 
QuestionAjax and Asp.net Pin
ahawari0924-Jan-09 1:34
ahawari0924-Jan-09 1:34 
AnswerRe: Ajax and Asp.net Pin
Colin Angus Mackay24-Jan-09 2:49
Colin Angus Mackay24-Jan-09 2:49 
QuestionViewing aspx pages Pin
Ha ha ha ha ha ha ha ha24-Jan-09 1:09
Ha ha ha ha ha ha ha ha24-Jan-09 1:09 
AnswerRe: Viewing aspx pages Pin
Colin Angus Mackay24-Jan-09 1:13
Colin Angus Mackay24-Jan-09 1:13 
GeneralRe: Viewing aspx pages Pin
Ha ha ha ha ha ha ha ha24-Jan-09 1:24
Ha ha ha ha ha ha ha ha24-Jan-09 1:24 
GeneralRe: Viewing aspx pages Pin
Colin Angus Mackay24-Jan-09 1:50
Colin Angus Mackay24-Jan-09 1:50 
AnswerRe: Viewing aspx pages Pin
Abhijit Jana24-Jan-09 2:10
professionalAbhijit Jana24-Jan-09 2:10 
QuestionUnable to display data using Nested gridview with LinqDatasource control Pin
Member 129942624-Jan-09 0:53
Member 129942624-Jan-09 0:53 
QuestionDisable cookieless sessions Pin
AlexeiXX323-Jan-09 20:27
AlexeiXX323-Jan-09 20:27 
AnswerRe: Disable cookieless sessions Pin
DevCubed24-Jan-09 20:07
DevCubed24-Jan-09 20:07 
Question"asp:fileupload" control is not working Pin
Anand Desai23-Jan-09 20:06
Anand Desai23-Jan-09 20:06 
AnswerRe: "asp:fileupload" control is not working Pin
N a v a n e e t h23-Jan-09 23:21
N a v a n e e t h23-Jan-09 23:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.