Is there a wap version of your site?
help:sine function(no usage of math.h)
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > C/C++ Programming > help:sine function(no usage of math.h) 18 March 2008 17:15:38

  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

help:sine function(no usage of math.h)

Rakesh V. 18 March 2008 17:15:38
 hi,can anyone help in correcting this function asap:-
double mysin(double x)
{
int i=0;
float term=x;
float sinx=0;
for(i=0;i<=10;i=i+2­)
{
sinx=sinx+term;
term=term*((-x*x)/(­i+2)*(i+3));
}
return sinx;
}

-------------------­--------------------­--------------------­----------

Do you Yahoo!?
Yahoo! Mail [http://us.rd.yahoo.­com/mail_us/taglines­/50x/*http://promoti­ons.yahoo.com/new_ma­il/static/efficiency­.html]
- 50x more storage than other providers!

To unsubscribe, send a blank message to
<mailto:c-prog-unsu­bscribe-hHKSG33Tihhb­jbujkaE4pw@public.gm­ane.org>.


Yahoo! Groups Sponsor

ADVERTISEMENT
click here [http://us.ard.yahoo­.com/SIG=129mn7cf4/M­=295196.4901138.6071­305.3001176/D=groups­/S=1705006788:HM/EXP­=1096480269/A=212821­5/R=0/SIG=10se96mf6/­*http://companion.ya­hoo.com]


-------------------­--------------------­--------------------­----------

Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo­.com/group/c-prog/ [http://groups.yahoo­.com/group/c-prog/]

* To unsubscribe from this group, send an email to:
c-prog-unsubscribe-­hHKSG33TihhbjbujkaE4­pw@public.gmane.org [mailto:c-prog-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org?subject=Unsubscribe]

* Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service [http://docs.yahoo.c­om/info/terms/].

Add comment
Peternilsson42 29 September 2004 03:03:37 permanent link ]
 
"rakesh v." <hi2385@y...> wrote:> hi,> can anyone help in correcting this function asap:-

Asking for help 'asap' often has the opposite effect.
double mysin(double x)> {> int i=0;> float term=x;> float sinx=0;

Given that the function takes and returns a double, why are you using
(likely) less precise floats?
for(i=0;i<=10;i=i+2­)

A do/while loop would remove a redundant calculation of 'term'.
{> sinx=sinx+term;> term=term*((-x*x)/(­i+2)*(i+3));

Hint: a/b*c is parsed as (a/b)*c not a/(b*c)
}> return sinx;> }

--
Peter



-------------------­----- Yahoo! Groups Sponsor -------------------­-~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yah­oo.com/L5YrjA/eSIIAA­/yQLSAA/EbFolB/TM
-------------------­--------------------­--------------------­---------~->

Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > C/C++ Programming > help:sine function(no usage of math.h) 18 March 2008 17:15:38

see also:
More errors Re: errors in security…
Canvas
Forms API Quickstart Guide
пройди тесты:
see also:
LIFE TOOK ME A LITTLE FAR AWAY. MY ONLY…
THE TIME MY SISTER STARTED HIDIN SOME…
I knew my sister was acting strange...

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .