Re: [AD] al_get_opengl_version design flaw? |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On November 28, 2010, Thomas Fjellstrom wrote:
> On November 28, 2010, Peter Wang wrote:
> > Quick, what does this program print:
> > #include <stdio.h>
> > int main(void)
> > {
> >
> > float x = 1.4;
> > printf("%d\n", (x>=1.4));
> > return 0;
> >
> > }
> >
> > Is it worth doing something about al_get_opengl_version?
> > I have added a warning to the documentation for now.
>
> I have this little helper in my little pet Canva5 lib:
>
> inline bool nearlyEqual(double a, double b, double epsilon = 0.00001)
> {
> double absA = fabs(a);
> double absB = fabs(b);
> double diff = fabs(a - b);
>
> if (a * b == 0) { // a or b or both are zero
> // relative error is not meaningful here
> return diff < (epsilon * epsilon);
> } else { // use relative error
> return diff / (absA + absB) < epsilon;
> }
> }
>
> might be useful for cases like this.
Or just return the version in two or three parts.
> > Peter
> >
> > -------------------------------------------------------------------------
> > -- --- Increase Visibility of Your 3D Game App & Earn a Chance To Win
> > $500! Tap into the largest installed PC base & get more eyes on your
> > game by optimizing for Intel(R) Graphics Technology. Get started today
> > with the Intel(R) Software Partner Program. Five $500 cash prizes are up
> > for grabs. http://p.sf.net/sfu/intelisp-dev2dev
--
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx