C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

+- infini

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French)
View previous topic :: View next topic  
Author Message
Aurélien Barbier-Accary
Guest





PostPosted: Sat Oct 08, 2005 7:17 am    Post subject: +- infini Reply with quote



Bonjour,

j'ai besoin de définir la classe suivante :
class ScalaireBorné // sans accent bien sûr
{
protected:
double xmin, x, xmax; // xmin <= x <= xmax
public:
ScalaireBorne(const double& x, const double& xmin=???, const double& xmax=???);
//...
};

Ma question est donc comment donner les bornes par défaut -inf et +inf ?
Il me semble que ces bornes sont 2^-1075 et 2^1024 mais comment les définir
proprement ?
Existe-t-il une bibliothèque qui les défini où faut-il utiliser quelque chose du
type 1>>1075 et 1<<1024 ?
Je sais que gcc (que j'utilise) déclare des fonctions isNaN(), isinf() et
finite(), mais je n'ai rien trouvé pour les valeurs -inf et +inf :-(

Aurélien.
Back to top
Arnaud Debaene
Guest





PostPosted: Sat Oct 08, 2005 8:30 am    Post subject: Re: +- infini Reply with quote



Aurélien Barbier-Accary wrote:
Quote:
Bonjour,

j'ai besoin de définir la classe suivante :
class ScalaireBorné // sans accent bien sûr
{
protected:
double xmin, x, xmax; // xmin <= x <= xmax
public:
ScalaireBorne(const double& x, const double& xmin=???, const
double& xmax=???); //...
};

Ma question est donc comment donner les bornes par défaut -inf et
+inf ?

std::numeric_limits
Arnaud



Back to top
Aurélien Barbier-Accary
Guest





PostPosted: Sat Oct 08, 2005 10:19 am    Post subject: Re: +- infini Reply with quote



Arnaud Debaene a écrit :
Quote:
Aurélien Barbier-Accary wrote:
Ma question est donc comment donner les bornes par défaut -inf et +inf ?


std::numeric_limits<double>::infinity()

Arnaud


nickel, merci !

Finalement j'utilise donc numeric_limits<double>::min() et
numeric_limits<double>::max().

Aurélien.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.