![]() |
|
|
|
#1 |
|
Hi,
I know that to get the maximum floating point value we can use DBL_MAX. To get the maximum negative value is it permissible (and portable) to use (-DBL_MAX). If it is not, how does one get the maximum negative representable value in a portable way? Thanks, John John |
|
|
|
|
#2 |
|
Posts: n/a
|
John wrote:
> Hi, > > I know that to get the maximum floating point value we can use DBL_MAX. > To get the maximum negative value is it permissible (and portable) to > use (-DBL_MAX). If it is not, how does one get the maximum negative > representable value in a portable way? Using -DBL_MAX is permissible and portable. You can also use '-std::numeric_limits<double>::max', which is a bit convoluted way of getting essentially the same value, except if you need to repackage your code in a template (parameterized on the FP type, for example). V -- Please remove capital 'A's when replying by e-mail I do not respond to top-posted replies, please don't ask Victor Bazarov |
|
|
|
#3 |
|
Posts: n/a
|
On Nov 2, 6:29*am, Victor Bazarov <v.Abaza...@comAcast.net> wrote:
> John wrote: > > Hi, > > > I know that to get the maximum floating point value we can use DBL_MAX. > > *To get the maximum negative value is it permissible (and portable) to > > use (-DBL_MAX). *If it is not, how does one get the maximum negative > > representable value in a portable way? > > Using -DBL_MAX is permissible and portable. > > You can also use '-std::numeric_limits<double>::max', which is a bit > convoluted way of getting essentially the same value, except if you need > to repackage your code in a template (parameterized on the FP type, for > example). > Victor, isn't std::numeric_limits<T>::max a function? e.g.: std::numeric_limits<double>::max() red floyd |
|
|
|
#4 |
|
Posts: n/a
|
>
> Using -DBL_MAX is permissible and portable. > > You can also use '-std::numeric_limits<double>::max', which is a bit > convoluted way of getting essentially the same value, except if you need > to repackage your code in a template (parameterized on the FP type, for > example). Thanks Victor. John John |
|