⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mapm5sin.c

📁 任意精度的数学库
💻 C
字号:
/*  *  M_APM  -  mapm5sin.c * *  Copyright (C) 1999   Michael C. Ring * *  Permission to use, copy, and distribute this software and its *  documentation for any purpose with or without fee is hereby granted,  *  provided that the above copyright notice appear in all copies and  *  that both that copyright notice and this permission notice appear  *  in supporting documentation. * *  Permission to modify the software is granted, but not the right to *  distribute the modified code.  Modifications are to be distributed  *  as patches to released version. *   *  This software is provided "as is" without express or implied warranty. *//* *      $Id: mapm5sin.c,v 1.6 1999/06/30 00:08:53 mike Exp $ * *      This file contains the functions that implement the sin (5x) *	and cos (4x) multiple angle relations * *      $Log: mapm5sin.c,v $ *      Revision 1.6  1999/06/30 00:08:53  mike *      pass more decimal places to raw functions * *      Revision 1.5  1999/06/20 23:41:32  mike *      changed COS to use 4x multiple angle identity instead of 5x * *      Revision 1.4  1999/06/20 19:42:26  mike *      tweak number of dec places passed to sub-functions * *      Revision 1.3  1999/06/20 19:03:56  mike *      changed local static variables to MAPM stack variables * *      Revision 1.2  1999/05/12 21:30:09  mike *      replace local 5.0 with global * *      Revision 1.1  1999/05/10 20:56:31  mike *      Initial revision */#include "m_apm_lc.h"/****************************************************************************/void	M_5x_sin(r,places,x)M_APM	r, x;int	places;{M_APM   tmp8, tmp9;tmp8 = M_get_stack_var();tmp9 = M_get_stack_var();m_apm_multiply(tmp9, x, MM_5x_008);M_raw_sin(tmp8, (places + 6), tmp9);M_5x_do_it(tmp9, (places + 4), tmp8);M_5x_do_it(tmp8, (places + 4), tmp9);M_5x_do_it(r, places, tmp8);M_restore_stack(2);}/****************************************************************************/void	M_4x_cos(r,places,x)M_APM	r, x;int	places;{M_APM   tmp8, tmp9;tmp8 = M_get_stack_var();tmp9 = M_get_stack_var();m_apm_multiply(tmp9, x, MM_5x_64R);M_raw_cos(tmp8, (places + 6), tmp9);M_4x_do_it(tmp9, (places + 4), tmp8);M_4x_do_it(tmp8, (places + 4), tmp9);M_4x_do_it(r, places, tmp8);M_restore_stack(2);}/****************************************************************************//* *     calculate the multiple angle identity for sin (5x) * *     sin (5x) == 16 * sin^5 (x)  -  20 * sin^3 (x)  +  5 * sin(x)   */void	M_5x_do_it(rr,places,xx)M_APM	rr, xx;int	places;{M_APM   tmp0, tmp1, t2, t3, t5;tmp0 = M_get_stack_var();tmp1 = M_get_stack_var();t2   = M_get_stack_var();t3   = M_get_stack_var();t5   = M_get_stack_var();m_apm_multiply(tmp1, xx, xx);m_apm_round(t2, (places + 4), tmp1);     /* x ^ 2 */m_apm_multiply(tmp1, t2, xx);m_apm_round(t3, (places + 4), tmp1);     /* x ^ 3 */m_apm_multiply(t5, t2, t3);              /* x ^ 5 */m_apm_multiply(tmp0, xx, MM_Five);m_apm_multiply(tmp1, t5, MM_5x_Sixteen);m_apm_add(t2, tmp0, tmp1);m_apm_multiply(tmp1, t3, MM_5x_Twenty);m_apm_subtract(tmp0, t2, tmp1);m_apm_round(rr, places, tmp0);M_restore_stack(5);}/****************************************************************************//* *     calculate the multiple angle identity for cos (4x) *  *     cos (4x) == 8 * [ cos^4 (x)  -  cos^2 (x) ]  +  1 */void	M_4x_do_it(rr,places,xx)M_APM	rr, xx;int	places;{M_APM   tmp0, tmp1, t2, t4;tmp0 = M_get_stack_var();tmp1 = M_get_stack_var();t2   = M_get_stack_var();t4   = M_get_stack_var();m_apm_multiply(tmp1, xx, xx);m_apm_round(t2, (places + 4), tmp1);     /* x ^ 2 */m_apm_multiply(t4, t2, t2);              /* x ^ 4 */m_apm_subtract(tmp0, t4, t2);m_apm_multiply(tmp1, tmp0, MM_5x_Eight);m_apm_add(tmp0, MM_One, tmp1);m_apm_round(rr, places, tmp0);M_restore_stack(4);}/****************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -