|
|
Up |
|
|
  |
Author: Pietro GagliardiPietro Gagliardi Date: Aug 5, 2008 12:10
Hello. Is there an alternative to the macros in this header? My
program uses some of them (DBL_MIN, DBL_MAX, DBL_EPSILON), and
including yields name clashes. Thanks.
|
| |
|
| | 10 Comments |
|
  |
Author: Russ CoxRuss Cox Date: Aug 5, 2008 16:46
> Hello. Is there an alternative to the macros in this header? My
> program uses some of them (DBL_MIN, DBL_MAX, DBL_EPSILON), and
> including yields name clashes. Thanks.
Why not change your program not to use
standard names for its own purposes?
Russ
|
| |
|
| | 9 Comments |
|
  |
Author: Pietro GagliardiPietro Gagliardi Date: Aug 5, 2008 19:55
On Aug 5, 2008, at 7:43 PM, Russ Cox wrote:
>> Hello. Is there an alternative to the macros in this header? My
>> program uses some of them (DBL_MIN, DBL_MAX, DBL_EPSILON), and
>> including yields name clashes. Thanks.
>
> Why not change your program not to use
> standard names for its own purposes?
>
> Russ
>
>
In this case, "its own purposes" == "allowing the user to choose that
as a parameter to an expression."
|
| |
| 8 Comments |
|
  |
Author: ron minnichron minnich Date: Aug 5, 2008 20:17
I'm so confused. Why don't you just show the code.
ron
|
| |
| 7 Comments |
|
  |
Author: Pietro GagliardiPietro Gagliardi Date: Aug 5, 2008 20:25
On Aug 5, 2008, at 11:14 PM, ron minnich wrote:
> I'm so confused. Why don't you just show the code.
>
> ron
>
#include
...
#include
...
static struct{
char *name;
double value;
}constants[] = {
...
"MIN", DBL_MIN,
"MAX", DBL_MAX,
"EPSILON", DBL_EPSILON,
...
};
|
| Show full article (0.47Kb) |
| 3 Comments |
|
  |
Author: Charles ForsythCharles Forsyth Date: Aug 6, 2008 01:07
>My program uses some of them (DBL_MIN, DBL_MAX, DBL_EPSILON), and
>including yields name clashes. Thanks.
> #include
> ...
> #include
it's surprisingly important not to leave out important information, such as
what important things were in the "..." (other include files) and, most importantly, the particular "name clashes".
i'd noticed you were using not which i'd thought curious
(were you mixing APE and Plan 9 include files?) but like most others i'd initially
assumed the "name clashes" had to do with the DBL_ names. odd.
guessing that the "..." contained "#include " and trying a little test,
I find that probably the "name clashes" were (was?) probably singular:
/386/include/ape/float.h:43 yy.c:3 redeclare tag: FPdbleword
so now we know the problem, what to do about it?
i know an unpleasant way but perhaps someone else can think of a good way to get those
values outside the APE include files. libc.h doesn't define equivalents.
perhaps the values aren't actually all that useful (i'm not sure how i'd use
them myself in a calculator, for instance).
|
| |
| 2 Comments |
|
  |
Author: Pietro GagliardiPietro Gagliardi Date: Aug 6, 2008 05:47
On Aug 6, 2008, at 4:06 AM, Charles Forsyth wrote:
>> My program uses some of them (DBL_MIN, DBL_MAX, DBL_EPSILON), and
>> including yields name clashes. Thanks.
>
>> #include
>> ...
>> #include
>
> it's surprisingly important not to leave out important information,
> such as
> what important things were in the "..." (other include files) and,
> most importantly, the particular "name clashes".
>
> i'd noticed you were using not which i'd
> thought curious
> (were you mixing APE and Plan 9 include files?) but like most others
> i'd initially
> assumed the "name clashes" had to do with the DBL_ names. odd.
>
|
| Show full article (1.50Kb) |
| 1 Comment |
|
  |
Author: erik quanstromerik quanstrom Date: Aug 6, 2008 06:03
> If your unpleasant way is to copy float.h, it won't work; you'll need
> one for each $objtype. I found an algorithm to get epsilon, but not
> min or max.
>
as far as i know, all plan 9 compilers use IEEE 754-compatable semantics
(at least insomuch as allowed by hardware). thus the minima and maxima,
ε, and underflow properties depend on IEEE 754, not the processor.
/sys/doc/port.ps has the most complete information, but i would imagine
that the powerpc and arm information is slightly out-of-date.
- erik
|
| |
| no comments |
|
  |
Author: Greg ComeauGreg Comeau Date: Aug 6, 2008 09:29
In article mac.com>,
Pietro Gagliardi mac.com> wrote:
>On Aug 5, 2008, at 11:14 PM, ron minnich wrote:
>
>> I'm so confused. Why don't you just show the code.
>>
>> ron
>>
>
>#include
>...
>#include
>...
>
>static struct{
> char *name;
> double value;
>}constants[] = {
> ...
> "MIN", DBL_MIN, ...
|
| Show full article (0.92Kb) |
| 2 Comments |
|
  |
|
|
  |
Author: Pietro GagliardiPietro Gagliardi Date: Aug 7, 2008 11:28
On Aug 6, 2008, at 12:29 PM, Greg Comeau wrote:
> Does it help any to initialize constants[] in a source file
> by itself?
I don't know, but your idea gave me something that did:
%% cat mach.c
#include
double dblmin = DBL_MIN;
double dblmax = DBL_MAX;
double dbleps = DBL_EPS;
%% cat builtins.c
...
extern double dblmin, dblmax, dbleps;
...
install(s_copy("MIN"), CONSTANT, dblmin);
install(s_copy("MAX"), CONSTANT, dblmax);
install(s_copy("EPSILON"), CONSTANT, dbleps);
...
|
| |
| 1 Comment |
|
|
|
|