• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What's up with sinf()?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's up with sinf()?


  • Subject: Re: What's up with sinf()?
  • From: Peter Ammon <email@hidden>
  • Date: Tue, 20 Nov 2001 23:00:04 -0500

On Tuesday, November 20, 2001, at 04:00 PM, Nat! wrote:

On Dienstag, November 20, 2001, at 11:10 Uhr, John C. Randolph wrote:

Sorry if you see this twice. I sent it before, but haven't seen it hit
the list yet.

Something a bit wierd: I'm getting link errors when I try to use
sinf()
instead of sin(). They're both defined in <math.h>, and presumably in
the same library, aren't they? I'd just as soon use sinf(), since what
I'm doing doesn't require double precision.

What I'm doing BTW, is drawing gradients based on sinusoidal and
conic-section curves scaled to a 256x256 square. If someone could
point
me to code for a fixed-point sin function, I'd just as soon use that.
I'd rather not embed a sine table in the code, though ;-)

-jcr


I was looking for truncf, floorf but couldn't find them either. But
they are only defined in the man pages, not in /usr/include math.h.
sinf is neither (at least on my system)


When I've seen sinf implemented, it's usually done like this:

#define sinf(x) (float)(sin((float)(x)))

So you don't gain any speed by using sinf.

-Peter


References: 
 >Re: What's up with sinf()? (From: Nat! <email@hidden>)

  • Prev by Date: Re: Rects and points...
  • Next by Date: Re: Rects and points...
  • Previous by thread: Re: What's up with sinf()?
  • Next by thread: Mutability
  • Index(es):
    • Date
    • Thread