Click here to Skip to main content
15,888,521 members
Home / Discussions / C#
   

C#

 
GeneralRe: divide by zero Pin
George_George24-Apr-08 0:05
George_George24-Apr-08 0:05 
GeneralRe: divide by zero Pin
Simon P Stevens24-Apr-08 0:24
Simon P Stevens24-Apr-08 0:24 
GeneralRe: divide by zero Pin
George_George24-Apr-08 0:58
George_George24-Apr-08 0:58 
GeneralRe: divide by zero Pin
Pete O'Hanlon24-Apr-08 1:16
mvePete O'Hanlon24-Apr-08 1:16 
GeneralRe: divide by zero Pin
George_George24-Apr-08 1:23
George_George24-Apr-08 1:23 
GeneralRe: divide by zero Pin
George_George24-Apr-08 0:07
George_George24-Apr-08 0:07 
GeneralRe: divide by zero Pin
Guffa24-Apr-08 0:20
Guffa24-Apr-08 0:20 
QuestionRe: divide by zero [modified] Pin
Simon P Stevens24-Apr-08 0:27
Simon P Stevens24-Apr-08 0:27 
What reason is there to allow a floating point number to be infinite?

there is a float.MaxValue constant that I thought was the maximum value of a single prevision float. If a float has a pre defined maximum value, why allow it to also store infinity, without all of the number in between?

[EDIT]
Interestingly, if you cast infinity to an integer, you get -2147483648, which is int.MinValue;

static void Main(string[] args)
{
    try
    {
        float a = 100;
        float b = 0;
        float c = a / b;

        int d = (int)c;    // Here, d is int.MinValue;
    }
    catch (Exception ex)
    {
        Console.WriteLine("{0}", ex.ToString());
    }

    return;
}

[/EDIT]

Simon

modified on Thursday, April 24, 2008 6:34 AM

GeneralRe: divide by zero Pin
Simon P Stevens24-Apr-08 0:47
Simon P Stevens24-Apr-08 0:47 
GeneralRe: divide by zero Pin
George_George24-Apr-08 1:04
George_George24-Apr-08 1:04 
GeneralRe: divide by zero Pin
PIEBALDconsult24-Apr-08 6:05
mvePIEBALDconsult24-Apr-08 6:05 
GeneralRe: divide by zero Pin
Simon P Stevens24-Apr-08 9:54
Simon P Stevens24-Apr-08 9:54 
GeneralRe: divide by zero Pin
Pete O'Hanlon24-Apr-08 10:19
mvePete O'Hanlon24-Apr-08 10:19 
GeneralRe: divide by zero Pin
PIEBALDconsult24-Apr-08 13:09
mvePIEBALDconsult24-Apr-08 13:09 
GeneralRe: divide by zero Pin
George_George24-Apr-08 1:01
George_George24-Apr-08 1:01 
GeneralRe: divide by zero Pin
George_George24-Apr-08 0:59
George_George24-Apr-08 0:59 
GeneralChuck Norris Pin
Chris Maunder24-Apr-08 13:01
cofounderChris Maunder24-Apr-08 13:01 
GeneralRe: Chuck Norris Pin
Vikram A Punathambekar24-Apr-08 19:09
Vikram A Punathambekar24-Apr-08 19:09 
Questionproblem with DataBase path when uploading image Pin
avvaru.murali23-Apr-08 23:16
avvaru.murali23-Apr-08 23:16 
Questionhow to make function running in background by itself every 2 minutes? Pin
Mohammed F. Salem23-Apr-08 22:59
Mohammed F. Salem23-Apr-08 22:59 
AnswerRe: how to make function running in background by itself every 2 minutes? Pin
Simon P Stevens23-Apr-08 23:18
Simon P Stevens23-Apr-08 23:18 
GeneralRe: how to make function running in background by itself every 2 minutes? [modified] Pin
Mohammed F. Salem23-Apr-08 23:46
Mohammed F. Salem23-Apr-08 23:46 
QuestionSend... Click? Pin
Reelix23-Apr-08 22:59
Reelix23-Apr-08 22:59 
AnswerRe: Send... Click? Pin
phannon8623-Apr-08 23:02
professionalphannon8623-Apr-08 23:02 
GeneralRe: Send... Click? Pin
Reelix23-Apr-08 23:18
Reelix23-Apr-08 23:18 

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.