math.h and lib for BoostC?

Status
Not open for further replies.
futz said:
I keep needing things like abs().

Never tried BoostC but from what I find with Google (mostly old forum posts) it looks like it might be a roll-your-own situation. Or maybe you could copy some of the headers and libs from libc (do you have Linux?).

Code:
int abs(int n) {
    return n > 0 ? n : -n;
}

Torben

[Edit: You can browse the libc code here: **broken link removed** ]
 
Last edited:
Torben said:
Never tried BoostC but from what I find with Google (mostly old forum posts) it looks like it might be a roll-your-own situation.
I was starting to get that idea anyway, judging by the posts on SourceBoost's forums. Shouldn't be that hard to write one anyway.

It's been many many years since I built my own libs for C. I'll have to refresh my foggy old memory.

Or maybe you could copy some of the headers and libs from libc (do you have Linux?).
Good idea. I have almost nothing but Linux. There's windoze on only a few of my too many computers.
 
Last edited:
Torben said:
Code:
int abs(int n) {
    return n > 0 ? n : -n;
}
Thank you Torben for the abs()! I should have known it would be that simple. My Bresenham line routine now works perfect. Building some nice demos for the site.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…