Dude, use the C++ sincos() function to compute the sines and cosines! You may as ...
13 years, 1 month ago
(2010-02-08 23:18:07 UTC)
#2
Dude, use the C++ sincos() function to compute the sines and cosines! You may
as well make the underlying implementation faster in the same way.
Other than that, LGTM.
PS. I'll take care of editing the spec to add this function. On Feb 8, ...
13 years, 1 month ago
(2010-02-08 23:20:32 UTC)
#3
PS. I'll take care of editing the spec to add this function.
On Feb 8, 2010, at 3:18 PM, larrygritz@gmail.com wrote:
> Dude, use the C++ sincos() function to compute the sines and cosines!
> You may as well make the underlying implementation faster in the same
> way.
>
> Other than that, LGTM.
>
>
> http://codereview.appspot.com/205045/show
--
Larry Gritz
lg@larrygritz.com
On 2010/02/08 23:18:07, larrygritz wrote: > Dude, use the C++ sincos() function to compute the ...
13 years, 1 month ago
(2010-02-08 23:22:43 UTC)
#4
On 2010/02/08 23:18:07, larrygritz wrote:
> Dude, use the C++ sincos() function to compute the sines and cosines! You may
> as well make the underlying implementation faster in the same way.
>
> Other than that, LGTM.
This is a GNU extension, it isn't part of any standard to my knowledge. Can you
think of a cross platform way of detecting it?
I would put in fmath.h: #ifndef __GNUC__ ... define it in terms of sin and ...
13 years, 1 month ago
(2010-02-08 23:25:37 UTC)
#5
I would put in fmath.h:
#ifndef __GNUC__
... define it in terms of sin and cos...
#endif
On Feb 8, 2010, at 3:22 PM, <ckulla@gmail.com> wrote:
> On 2010/02/08 23:18:07, larrygritz wrote:
>> Dude, use the C++ sincos() function to compute the sines and cosines!
> You may
>> as well make the underlying implementation faster in the same way.
>
>> Other than that, LGTM.
>
> This is a GNU extension, it isn't part of any standard to my knowledge.
> Can you think of a cross platform way of detecting it?
>
> http://codereview.appspot.com/205045/show
>
--
Larry Gritz
lg@imageworks.com
Its more complicated than that. The symbol doesn't show up by default. You need to ...
13 years, 1 month ago
(2010-02-08 23:31:22 UTC)
#6
Its more complicated than that. The symbol doesn't show up by default. You need
to do:
#define _GNU_SOURCE
#include <math.h>
And of course, its hard to know where math.h (or cmath) is first included (this
can change depending on the order of inclusion of the headers).
This only works on linux by the way, os x does not support this extension as far
as I can tell.
Of course, please substitute whatever compiler or version checks *correctly* discern whether sincos is available. ...
13 years, 1 month ago
(2010-02-08 23:32:32 UTC)
#7
Of course, please substitute whatever compiler or version checks *correctly*
discern whether sincos is available.
On Feb 8, 2010, at 3:25 PM, Larry Gritz wrote:
> I would put in fmath.h:
>
> #ifndef __GNUC__
> ... define it in terms of sin and cos...
> #endif
>
>
>
> On Feb 8, 2010, at 3:22 PM, <ckulla@gmail.com> wrote:
>
>> On 2010/02/08 23:18:07, larrygritz wrote:
>>> Dude, use the C++ sincos() function to compute the sines and cosines!
>> You may
>>> as well make the underlying implementation faster in the same way.
>>
>>> Other than that, LGTM.
>>
>> This is a GNU extension, it isn't part of any standard to my knowledge.
>> Can you think of a cross platform way of detecting it?
>>
>> http://codereview.appspot.com/205045/show
>>
>
> --
> Larry Gritz
> lg@imageworks.com
>
>
>
--
Larry Gritz
lg@imageworks.com
1. At the top of fmath.h, before #include <cmath>: #ifndef __MATH_H__ #define _GNU_SOURCE #endif 2. ...
13 years, 1 month ago
(2010-02-08 23:48:06 UTC)
#8
1. At the top of fmath.h, before #include <cmath>:
#ifndef __MATH_H__
#define _GNU_SOURCE
#endif
2. In fmath.h, define sincos
#if !defined(_GNU_SOURCE) || !defined(__GNUC__) || !defined(__linux__)
inline void sincos (...) {...}
#endif
3. Tough luck for users who #include <math.h> BEFORE fmath.h and don't define
_GNU_SOURCE, they'll get the backup definition, that calls sin and cos
separately.
This will work for everybody and never be slower than using sin and cos
separately. But users who care enough to do the right #defines and #includes
will get something faster.
On Feb 8, 2010, at 3:31 PM, <ckulla@gmail.com> wrote:
> Its more complicated than that. The symbol doesn't show up by default.
> You need to do:
>
> #define _GNU_SOURCE
> #include <math.h>
>
> And of course, its hard to know where math.h (or cmath) is first
> included (this can change depending on the order of inclusion of the
> headers).
>
> This only works on linux by the way, os x does not support this
> extension as far as I can tell.
>
>
> http://codereview.appspot.com/205045/show
>
> --
> You received this message because you are subscribed to the Google Groups "OSL
Developers" group.
> To post to this group, send email to osl-dev@googlegroups.com.
> To unsubscribe from this group, send email to
osl-dev+unsubscribe@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/osl-dev?hl=en.
>
>
--
Larry Gritz
lg@imageworks.com
Solaris provides sincos as part of math.h. Given that OSL is now an open-source project, ...
13 years, 1 month ago
(2010-02-09 01:35:15 UTC)
#12
Solaris provides sincos as part of math.h.
Given that OSL is now an open-source project, probably at some point
it'll need to grow a configure based solution to find functions.
If configure was used, then it would build a config.h that would define
or not define HAVE_SINCOS and then the code could just rely upon that,
instead of trusting a developer to include headers in the correct order
or checking if it was a particular platform.
Regards,
Blair
On 02/08/2010 03:48 PM, Larry Gritz wrote:
> 1. At the top of fmath.h, before #include<cmath>:
>
> #ifndef __MATH_H__
> #define _GNU_SOURCE
> #endif
>
>
> 2. In fmath.h, define sincos
>
> #if !defined(_GNU_SOURCE) || !defined(__GNUC__) || !defined(__linux__)
> inline void sincos (...) {...}
> #endif
>
> 3. Tough luck for users who #include<math.h> BEFORE fmath.h and don't define
_GNU_SOURCE, they'll get the backup definition, that calls sin and cos
separately.
>
> This will work for everybody and never be slower than using sin and cos
separately. But users who care enough to do the right #defines and #includes
will get something faster.
>
>
> On Feb 8, 2010, at 3:31 PM,<ckulla@gmail.com> wrote:
>
>> Its more complicated than that. The symbol doesn't show up by default.
>> You need to do:
>>
>> #define _GNU_SOURCE
>> #include<math.h>
>>
>> And of course, its hard to know where math.h (or cmath) is first
>> included (this can change depending on the order of inclusion of the
>> headers).
>>
>> This only works on linux by the way, os x does not support this
>> extension as far as I can tell.
>>
>>
>> http://codereview.appspot.com/205045/show
gcc documentation suggests that it can (macro TARGET_HAS_SINCOS) - but our version doesn't seem to ...
13 years, 1 month ago
(2010-02-09 19:21:10 UTC)
#15
gcc documentation suggests that it can (macro TARGET_HAS_SINCOS) - but our
version doesn't seem to do it automatically.
In theory its true that it would be nice to just let the compiler take care of
this.
Issue 205045: sincos opcode
(Closed)
Created 13 years, 1 month ago by ckulla
Modified 13 years, 1 month ago
Reviewers: dev-osl_imageworks.com, osl-dev_googlegroups.com, larrygritz
Base URL: http://openshadinglanguage.googlecode.com/svn/trunk/
Comments: 0