From f98b79043298644979df8dc0cfdd95e1754b671f Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 12 Jun 2007 22:09:40 +0000 Subject: [PATCH] Set MIME types and end-of-line styles globally [SVN r7018] --- doc/equations/ellint.xml | Bin 47010 -> 47010 bytes doc/equations/gamma_ratio.xml | Bin 3100 -> 3100 bytes doc/equations/lgamma.xml | Bin 22966 -> 22966 bytes example/negative_binomial_example1.cpp | 564 +- .../detail/t_distribution_inv.hpp | 1004 +- .../tools/detail/polynomial_horner1_10.hpp | 168 +- .../tools/detail/polynomial_horner1_11.hpp | 180 +- .../tools/detail/polynomial_horner1_12.hpp | 192 +- .../tools/detail/polynomial_horner1_13.hpp | 204 +- .../tools/detail/polynomial_horner1_14.hpp | 216 +- .../tools/detail/polynomial_horner1_15.hpp | 228 +- .../tools/detail/polynomial_horner1_16.hpp | 240 +- .../tools/detail/polynomial_horner1_17.hpp | 252 +- .../tools/detail/polynomial_horner1_18.hpp | 264 +- .../tools/detail/polynomial_horner1_19.hpp | 276 +- .../tools/detail/polynomial_horner1_2.hpp | 72 +- .../tools/detail/polynomial_horner1_20.hpp | 288 +- .../tools/detail/polynomial_horner1_3.hpp | 84 +- .../tools/detail/polynomial_horner1_4.hpp | 96 +- .../tools/detail/polynomial_horner1_5.hpp | 108 +- .../tools/detail/polynomial_horner1_6.hpp | 120 +- .../tools/detail/polynomial_horner1_7.hpp | 132 +- .../tools/detail/polynomial_horner1_8.hpp | 144 +- .../tools/detail/polynomial_horner1_9.hpp | 156 +- .../tools/detail/polynomial_horner2_10.hpp | 180 +- .../tools/detail/polynomial_horner2_11.hpp | 194 +- .../tools/detail/polynomial_horner2_12.hpp | 208 +- .../tools/detail/polynomial_horner2_13.hpp | 222 +- .../tools/detail/polynomial_horner2_14.hpp | 236 +- .../tools/detail/polynomial_horner2_15.hpp | 250 +- .../tools/detail/polynomial_horner2_16.hpp | 264 +- .../tools/detail/polynomial_horner2_17.hpp | 278 +- .../tools/detail/polynomial_horner2_18.hpp | 292 +- .../tools/detail/polynomial_horner2_19.hpp | 306 +- .../tools/detail/polynomial_horner2_2.hpp | 96 +- .../tools/detail/polynomial_horner2_20.hpp | 320 +- .../tools/detail/polynomial_horner2_3.hpp | 96 +- .../tools/detail/polynomial_horner2_4.hpp | 96 +- .../tools/detail/polynomial_horner2_5.hpp | 110 +- .../tools/detail/polynomial_horner2_6.hpp | 124 +- .../tools/detail/polynomial_horner2_7.hpp | 138 +- .../tools/detail/polynomial_horner2_8.hpp | 152 +- .../tools/detail/polynomial_horner2_9.hpp | 166 +- .../tools/detail/polynomial_horner3_10.hpp | 312 +- .../tools/detail/polynomial_horner3_11.hpp | 362 +- .../tools/detail/polynomial_horner3_12.hpp | 416 +- .../tools/detail/polynomial_horner3_13.hpp | 474 +- .../tools/detail/polynomial_horner3_14.hpp | 536 +- .../tools/detail/polynomial_horner3_15.hpp | 602 +- .../tools/detail/polynomial_horner3_16.hpp | 672 +- .../tools/detail/polynomial_horner3_17.hpp | 746 +- .../tools/detail/polynomial_horner3_18.hpp | 824 +- .../tools/detail/polynomial_horner3_19.hpp | 906 +- .../tools/detail/polynomial_horner3_2.hpp | 96 +- .../tools/detail/polynomial_horner3_20.hpp | 992 +- .../tools/detail/polynomial_horner3_3.hpp | 96 +- .../tools/detail/polynomial_horner3_4.hpp | 96 +- .../tools/detail/polynomial_horner3_5.hpp | 122 +- .../tools/detail/polynomial_horner3_6.hpp | 152 +- .../tools/detail/polynomial_horner3_7.hpp | 186 +- .../tools/detail/polynomial_horner3_8.hpp | 224 +- .../tools/detail/polynomial_horner3_9.hpp | 266 +- .../math/tools/detail/rational_horner1_10.hpp | 276 +- .../math/tools/detail/rational_horner1_11.hpp | 300 +- .../math/tools/detail/rational_horner1_12.hpp | 324 +- .../math/tools/detail/rational_horner1_13.hpp | 348 +- .../math/tools/detail/rational_horner1_14.hpp | 372 +- .../math/tools/detail/rational_horner1_15.hpp | 396 +- .../math/tools/detail/rational_horner1_16.hpp | 420 +- .../math/tools/detail/rational_horner1_17.hpp | 444 +- .../math/tools/detail/rational_horner1_18.hpp | 468 +- .../math/tools/detail/rational_horner1_19.hpp | 492 +- .../math/tools/detail/rational_horner1_2.hpp | 84 +- .../math/tools/detail/rational_horner1_20.hpp | 516 +- .../math/tools/detail/rational_horner1_3.hpp | 108 +- .../math/tools/detail/rational_horner1_4.hpp | 132 +- .../math/tools/detail/rational_horner1_5.hpp | 156 +- .../math/tools/detail/rational_horner1_6.hpp | 180 +- .../math/tools/detail/rational_horner1_7.hpp | 204 +- .../math/tools/detail/rational_horner1_8.hpp | 228 +- .../math/tools/detail/rational_horner1_9.hpp | 252 +- .../math/tools/detail/rational_horner2_10.hpp | 288 +- .../math/tools/detail/rational_horner2_11.hpp | 320 +- .../math/tools/detail/rational_horner2_12.hpp | 352 +- .../math/tools/detail/rational_horner2_13.hpp | 384 +- .../math/tools/detail/rational_horner2_14.hpp | 416 +- .../math/tools/detail/rational_horner2_15.hpp | 448 +- .../math/tools/detail/rational_horner2_16.hpp | 480 +- .../math/tools/detail/rational_horner2_17.hpp | 512 +- .../math/tools/detail/rational_horner2_18.hpp | 544 +- .../math/tools/detail/rational_horner2_19.hpp | 576 +- .../math/tools/detail/rational_horner2_2.hpp | 96 +- .../math/tools/detail/rational_horner2_20.hpp | 608 +- .../math/tools/detail/rational_horner2_3.hpp | 96 +- .../math/tools/detail/rational_horner2_4.hpp | 96 +- .../math/tools/detail/rational_horner2_5.hpp | 128 +- .../math/tools/detail/rational_horner2_6.hpp | 160 +- .../math/tools/detail/rational_horner2_7.hpp | 192 +- .../math/tools/detail/rational_horner2_8.hpp | 224 +- .../math/tools/detail/rational_horner2_9.hpp | 256 +- .../math/tools/detail/rational_horner3_10.hpp | 792 +- .../math/tools/detail/rational_horner3_11.hpp | 964 +- .../math/tools/detail/rational_horner3_12.hpp | 1152 +- .../math/tools/detail/rational_horner3_13.hpp | 1356 +- .../math/tools/detail/rational_horner3_14.hpp | 1576 +-- .../math/tools/detail/rational_horner3_15.hpp | 1812 +-- .../math/tools/detail/rational_horner3_16.hpp | 2064 +-- .../math/tools/detail/rational_horner3_17.hpp | 2332 ++-- .../math/tools/detail/rational_horner3_18.hpp | 2616 ++-- .../math/tools/detail/rational_horner3_19.hpp | 2916 ++--- .../math/tools/detail/rational_horner3_2.hpp | 96 +- .../math/tools/detail/rational_horner3_20.hpp | 3232 ++--- .../math/tools/detail/rational_horner3_3.hpp | 96 +- .../math/tools/detail/rational_horner3_4.hpp | 96 +- .../math/tools/detail/rational_horner3_5.hpp | 172 +- .../math/tools/detail/rational_horner3_6.hpp | 264 +- .../math/tools/detail/rational_horner3_7.hpp | 372 +- .../math/tools/detail/rational_horner3_8.hpp | 496 +- .../math/tools/detail/rational_horner3_9.hpp | 636 +- performance/distributions.cpp | 892 +- performance/main.cpp | 270 +- performance/performance_measure.hpp | 162 +- performance/test_erf.cpp | 208 +- performance/test_gamma.cpp | 388 +- performance/test_ibeta.cpp | 362 +- performance/test_igamma.cpp | 368 +- performance/test_polynomial.cpp | 332 +- performance/test_reference.cpp | 20 +- test/test_rational.hpp | 10592 ++++++++-------- test/test_rational_double.cpp | 38 +- test/test_rational_float.cpp | 38 +- test/test_rational_ldouble.cpp | 38 +- tools/generate_rational_code.cpp | 1476 +-- tune/main.cpp | 246 +- tune/polynomial.cpp | 794 +- 135 files changed, 33968 insertions(+), 33968 deletions(-) diff --git a/doc/equations/ellint.xml b/doc/equations/ellint.xml index 9bdcd88be3ec4213bf2b175e554bab217aba1f02..c8aa5d507009a9a4efb1eef11ba78d37d88b14d6 100644 GIT binary patch literal 47010 zcmezW&xXOCp@JcoA%{VMp^PDwp@^ZFA(J7WA&vXE z0<|H4A(X+1!H2<3H99ITE26YB51_iL$AX`fq3K*=wCYLjS zpdLdxgE501Lq0yj9GUP(-G-NPj&}B$t z(1WUi*%uA=ImiVe44z=WE5P+YLRTGZ8X*@MGFUQLGFTwF3e|n;40a5$(2xfC5MnkY z2J;w-!SMnTC(a&A6kmeO2E||oLn=ceLkiRuMFw34U5rpqW+(!yDq%=vNMTT5C}+q7 z#|a{KoEZ`siWy266c}6?3K>el;Ri`sAQ4bHDgnm>db(3!FksMQuwXD|PypKuNmcp` zsIE!^r^QOB8)31d08Pt~kWivZh$}HDfKz=jI0Ys$R5I8yC@~~4?0xeP@N`3&W75twKRLn2s5DvAt3wg^KUAqR;E5FZ_5w-1}DG-&<>#T6(#(bXXH zi8B?Z1Ee~W!H%Jl!G=MfA(sKfhU7q)3T!k;S3ZLsgEmwbh)tX>kokpBT_84oT@W{6 z#tFKcAnJ$>C6Mcj8A=(Fu*Mp)*&vl5R|b*bVn`Tz5v2p-Zo+N>xr12Wf!q&LPdL;- zDnS^e8sy6gqTCG90m2|%pm^7T>H@Lx$0ke{$S(5I8+mqBL0t&4mpB)K{6e~2AYE$U zJd_8n>8zplg2ail7v#dhkvj?)5*d;iQlT{is7B2Imz#zRsSLRcN(}mV^A0R+*b)^2 zAl0DKnOqwoxd?Z9hscB41lY<>knOnSU?~>2*&r1l3^IlGIkW&8o}hF>T#5pvJ<8K0 z@wpWe*2IJtsJ0t#Efqj)+@%6YHLdfI8`LGBaK+~mP~Io(7LbdHEg@iO zj&R8XQVGH!(?RYWZS_z;T@x}9B9E=sg~?#{s6g>m!hk6bi%V>#f#g6Kq?gx-{r$DMfd7ZR;Ux2s81`8!p@*7MKVgG?t!Z677X$(c+_9eFV z7)%{H4bn%NO)wKcI!VvzFx?;;W&&w-AV?<+!%QHpW<%%(m6)Xa9%L)&xy7hW(aLPfY`WO4d46+TR+K42burMI541%a890Cw^pjHk3k{0A0f1C)btha|$q_}v0>F>O-}$epCO!$7)7D_uZ7A-zNa=>pkBS}6k4MOw)L(gkuM zd3`imyAYCMh|LScq!~gcLgcZvuwXKnEkaNjQqocc&52YnlrY%AXGN@_`3WI|Jy(Hj z2Bj3jaSl=mif22h$sjgvGeKpX0aPW3jj0kA8sxW95q?W#$YV%hAl1)=(;m#vghvHI zDna2$xV;5Z2?{&HEoYEQVrnLkI>IR&R0Dxj5|hS3YGD|phd9%bb%4Txw2}^_8)O$K zY)Btj0O^KdkSQSh3C9IY2Z)BGN8)@6QAX(10$O*l?Lz9%JiKp6P7|?G)NZYD*U+{qzaU7@wW$Is)#S?K{`OT<1W=9 zzQ%MvL>!mDLFSS=(gxB4@+04y22p|C z6o?$YxC6NuyIznhL9+PlhN%IyuL+MtfJ_6a#6R)?b2Ijo0+GdZF+?0Q{etWSiDLHF zK{BB9FqBI;{3#RWL;R@`qzaVE373|j(86sNBnEKB47N0gt^>k{)Rse|?xfusH&9p; zo*4wi9k!4K4IU9ZjkHM7z!9N7%~}PD|$d;n0;`V zE)WgU39=V|N(8BdVUP}xx!KTuK8TIm4oLdK9|jOLgu)b}3R~+D!8Ee=602ZiB4raX}SBQx#5Vx0P;bD%ICx^arXmILJ#7>1?aT%yVYkS>@G zP>LHZt3V-wib3H+kFsiLr_jM)V}W877MFzc6G$cDmO9K#P}~vDaUe56D!mEjO^`}L zH899-5C*BmU!#LmfiOrV$o|38Rv0bsLGgmXpcn#`HG@Al!D5d5nIn)tY2E$~;56o1603xqAX44^blT3!bE zgzz{Lx*eqTagcSB8YgxP#MK_ic7XhZf5Z!>8bm`%7UJ9miyh+fILLGm2I(Tse3Q_+y|)y zg%$B-JxB-0y|`;RkP7^10pvyy2B`$O6Ms352qWxvf=mJV0e_tcQU$ULcX&YT!3LWvRio<$xt?CF zGmu@l%S}|5f!dh(!vK;7356*{6|T{AQ261J1Gxtz4+>xGB`in<2vf%n(&7;0GEjI9 zWXc2CKQhw}EXHXw(mr(Kl<>$PD8GO(Ed3H5_XDX0VVDk3iW?ni2ZabK289nj$|_K< zAG#?Nf7=N;L_y&R@+-Y-ERY*Oc7x)QaDD=*1hw|?w=7|1g8V}`$AQcQsT}B79;lEf zwI2owT^I(19Vq5ts}?|P>^*;wN=j`4#S*AIB!0{l9Pr5^pmWMf z;Oi_vDsa0PBnvvX3)DUXv2m*erAko03{qEuc(~OPS|bJuT~K(z{7Y>457Gm&nV8%G z@)03-fXoB=Iu_dA2eC1I1@SSqb|p+^wA}!TQONi{C=3UGsSJy`(HR@eu^~uYLP$^! z0p-%+HDiN+90=lb2nq8)Y4bZEy&#>$l~o|sAPh;9#JLS*Iw)R3J07 z6Wk+EAajv1%ns7}z%Ua)x`_(~kPeV)P)HEhx&Y|_VURA6p9t3^Ak`pDYV45i1JdSg zAa2TKpsg=JAv^fe7$h#JF`fhqMNp0)EwzGD5PlcH%qG+d0jUFFkcpt!BrTtTbP#)r z32|*AkShE>1G$uN`Ua^2r61yQCP+2NFNAX>B=+&!4>Ap8H*t9iq#D0@u=pV~_X#oy zwAhn=$KsYrcbil%nuxmi3gM3STxY%Z8+-VD@lDL!tQVqf&vq52jJ>A1p z;Ex56Di8*l1#;(5&1;a@L&O7wk67~ry7gn^-k||WR{`L=J5m@*8Il=@ok7Bv@Ju_qUN#}8;{J&2EvK_LVRQ|zrEm}<)HC}t>RC<31phr8_$atr=Nfw zh+1O89-%D-NdIpNSNSv z7eo#IFag<0sO$jw4TM2z@!JSe1;QYegyIXN4u(PMi8C2l2l1f=(*>eIc99=TAQM0s zWC}g<5V4^Ma}V+98rc`5)qIe2g+IO^Y6zt)h$>2JCF0iO5EomZaD=3e9HLu2gwr8z zf5K#_ziNckaS2d*0AZMm2KQ`B03Zxc5C*Bm zZzD(*2!m7-iZPHn7zU{)&SYdApqM1Cy$90;qCs|%A4?z;Kp12S@v#Nc0m6_NA;0!U`e_nb!rSYT{Bk$TW~@;!-y(J}7G=(W2doe}o1UHXxr8E{$;e5GI3~ z7Ga{pZ-|CZjABojp!i3|#G4M&1=2w{^}tjk z(;%Io(sHPbT@fFWAfFN2E`o&!NDp!GimYRxL!Ov+I?TN=8st;_?Mj$RbQ+`+R3_t| z6-3v8&Ig$Q3N!rkROq^3d`Ou_y4yjvg4|6`dlS@iA|;d|ZX_-xLDUkPQX#7Gn+#Dy zs2l@@2PEf@&MAS?1>tr!D6~kQzalQ5K;n#;cqNolASU5zgMnflmmDaEf#gB{#NT3} z+zvvi6Xq8DAp%kb!XQ@@3Kx(%WDL?noar!KARVA`3x9tBrW%&x;b!u5ZqDDPn z_Cw-|IG;k)k`j_2pOK;-Z<%gD}Y5q}Nn1ouE>QxY7fp z1093x28G$c)Uu?dQIOkVX%G7?0w5LW7@~u?lmt;rY)XZw#&0r24WV)j6bq1?Ke%dH z;^PPA1JY|g;(G1Ku}Z#O#N`u6oDmbRgi;E`By2S)Oa`?l4)P_)cj)KAfy6-=B8R(w z2$CPzxg-21Bfxx(-3K7oV+$*g&p{X@PfYm=Qb$~Q3Q|d0`3cfNe0d4+FJZTUOvRtx zK>i0|kV=qws4EviGT1OkHOPO2?;}Lk4bnxtA3-`1{>1Mth&uc}g{UDE&mcE~e1?5B zHONgc3{pubpCYTp?>c0aAp1v4FVr3pD6~gQFIXx;ra>VC%DK4L@Pbr>RDseJXylT( zF$jwR!B6VIFWDlrRAg*5n$;J5H1yO@POhC5MCifC5VL-6~!ys3H+=;(* zgQ*75ARVB1B(3Cy=>&x{X)SU@SQ6((ko!op1!4oSp$0OaShX-;<4-LhRmd1*11N+^ z+non90i>HW`#?HDx=0H(kS-Vo=?1x&^g07!0%(kpcy~kMj1=|c+zX4iEqMwv#72Y& zYV82?2RaQ38DeueHoe6A5Lq|KR?6Z7WE#ZBq`3g1hg2U!bP;D0L@hBn5TX*lsSq`U z+zU~KtpyL0p?+@%6o2@8sW7|A?{k3aOj?h05*JgX%@TsrH~x49rC%5ZsRq??_}eEi z)gT(A0~G$m^{PQSU>Ky6^l}sulf=6bWD6+n$RAGynE>)3aV;^B?;vg@9O@8tgmM(f zL=XnKgIKjN^@QC3QVGH!(?PL8T+0rm1B5}khJNV6;sN(~B18p!OEpj$$KQ?vg+3@{ z64$;2sRqR`;Wj12x47+x$YTo)Sen2k2a^Y-8CsX7gvMK8ZXqs@fI<)CYVyhvkZxj1 zcaWPv7^EH)v&5G_P4! zrHqC7f%H%ZyPhfNUpqCJ3Yl`EirnS31kY$#rWd^RyTlD zgHj6N`~q?r{uTzzEaF>NARV}U0&*ir1;{tJa}`Jx2!m9D+=#z!BsTPLr*n{9APlmP z7`N*);M>nnJr~nAz9HdAPFV&@ZP@3QK_QB(jR%qgr32ihKS%{AG_jwR192}l(?R;M z$0JAvWGDW#08&NBUQF{rx*k2R1gkX}kkOE0Xe#~|T>X*S44Ts09a)nmpwNCt#K zx{tU>mHFvt&}G&))$f~Tt) zyY4{w9e4Q!3Lj9~8_Hn~DOE7b2Z%Vfas?uT&;j8i&VT}i2!yA=P{EMPki(G2P|RS< zpu~{DP{L5cP{3ftpwFPsP!5KA4CM^Q40;Ut3`Gp-4EhX)43-R*3>FOf489ByQxGg) z1|J3`1_g!`hD-)fYdD7?k)aZ7GH9PsK0`7?HiHtp?gqI7;Yv_kfiOrER92`l49)%z z?p75f9n85V}r?W=%t z5hb-I_SHy`P{A}CxVD4ip*?3=0$7Jq}1*V1_D099L|B z%mwAx!Po+&B)!tRl{cDRA?XxGg3=WzOblssPcHtp10>Cpk{8f*K=_b464YM>@sk+x U8B!Q3!F3>r52|rNHLx860HTW81^@s6 literal 47010 zcmezW&xXOCp@JcoA%{VMp^PDwp@^ZFA(J7WA&vXE z0<|H4A(X+1!H2<3H99ITE26YBr1_iL$AX`fq3K*=wCYLjS zpdLdxgE501Lq0yj9GUP(-G-NPj&}B$t z(1WUi*%uA=ImiVe44z=WE5P+YLRTGZ8X*@MGFUQLGFTwF3e|n;40a5$(2xfC5MnkY z2J;w-!SMnTC(a&A6kmeO2E||oLn=ceLkiRuMFw34U5rpqW+(!yDq%=vNMTT5C}+q7 z#|a{KoEZ`siWy266c}6?3K>el;Ri`sAQ4bHDgnm>db(3!FksMQuwXD|PypKuNmcp` zsIE!^r^QOB8)31d08Pt~kWivZh$}HDfKz=jI0Ys$R5I8yC@~~4?0xeP@N`3&W75twKRLn2s5DvAt3wg^KUAqR;E5FZ_5w-1}DG-&<>#T6(#(bXXH zi8B?Z1Ee~W!H%Jl!G=MfA(sKfhU7q)3T!k;S3ZLsgEmwbh)tX>kokpBT_84oT@W{6 z#tFKcAnJ$>C6Mcj8A=(Fu*Mp)*&vl5R|b*bVn`Tz5v2p-Zo+N>xr12Wf!q&LPdL;- zDnS^e8sy6gqTCG90m2|%pm^7T>H@Lx$0ke{$S(5I8+mqBL0t&4mpB)K{6e~2AYE$U zJd_8n>8zplg2ail7v#dhkvj?)5*d;iQlT{is7B2Imz#zRsSLRcN(}mV^A0R+*b)^2 zAl0DKnOqwoxd?Z9hscB41lY<>knOnSU?~>2*&r1l3^IlGIkW&8o}hF>T#5pvJ<8K0 z@wpWe*2IJtsJ0t#Efqj)+@%6YHLdfI8`LGBaK+~mP~Io(7LbdHEg@iO zj&R8XQVGH!(?RYWZS_z;T@x}9B9E=sg~?#{s6g>m!hk6bi%V>#f#g6Kq?gx-{r$DMfd7ZR;Ux2s81`8!p@*7MKVgG?t!Z677X$(c+_9eFV z7)%{H4bn%NO)wKcI!VvzFx?;;W&&w-AV?<+!%QHpW<%%(m6)Xa9%L)&xy7hW(aLPfY`WO4d46+TR+K42burMI541%a890Cw^pjHk3k{0A0f1C)btha|$q_}v0>F>O-}$epCO!$7)7D_uZ7A-zNa=>pkBS}6k4MOw)L(gkuM zd3`imyAYCMh|LScq!~gcLgcZvuwXKnEkaNjQqocc&52YnlrY%AXGN@_`3WI|Jy(Hj z2Bj3jaSl=mif22h$sjgvGeKpX0aPW3jj0kA8sxW95q?W#$YV%hAl1)=(;m#vghvHI zDna2$xV;5Z2?{&HEoYEQVrnLkI>IR&R0Dxj5|hS3YGD|phd9%bb%4Txw2}^_8)O$K zY)Btj0O^KdkSQSh3C9IY2Z)BGN8)@6QAX(10$O*l?Lz9%JiKp6P7|?G)NZYD*U+{qzaU7@wW$Is)#S?K{`OT<1W=9 zzQ%MvL>!mDLFSS=(gxB4@+04y22p|C z6o?$YxC6NuyIznhL9+PlhN%IyuL+MtfJ_6a#6R)?b2Ijo0+GdZF+?0Q{etWSiDLHF zK{BB9FqBI;{3#RWL;R@`qzaVE373|j(86sNBnEKB47N0gt^>k{)Rse|?xfusH&9p; zo*4wi9k!4K4IU9ZjkHM7z!9N7%~}PD|$d;n0;`V zE)WgU39=V|N(8BdVUP}xx!KTuK8TIm4oLdK9|jOLgu)b}3R~+D!8Ee=602ZiB4raX}SBQx#5Vx0P;bD%ICx^arXmILJ#7>1?aT%yVYkS>@G zP>LHZt3V-wib3H+kFsiLr_jM)V}W877MFzc6G$cDmO9K#P}~vDaUe56D!mEjO^`}L zH899-5C*BmU!#LmfiOrV$o|38Rv0bsLGgmXpcn#`HG@Al!D5d5nIn)tY2E$~;56o1603xqAX44^blT3!bE zgzz{Lx*eqTagcSB8YgxP#MK_ic7XhZf5Z!>8bm`%7UJ9miyh+fILLGm2I(Tse3Q_+y|)y zg%$B-JxB-0y|`;RkP7^10pvyy2B`$O6Ms352qWxvf=mJV0e_tcQU$ULcX&YT!3LWvRio<$xt?CF zGmu@l%S}|5f!dh(!vK;7356*{6|T{AQ261J1Gxtz4+>xGB`in<2vf%n(&7;0GEjI9 zWXc2CKQhw}EXHXw(mr(Kl<>$PD8GO(Ed3H5_XDX0VVDk3iW?ni2ZabK289nj$|_K< zAG#?Nf7=N;L_y&R@+-Y-ERY*Oc7x)QaDD=*1hw|?w=7|1g8V}`$AQcQsT}B79;lEf zwI2owT^I(19Vq5ts}?|P>^*;wN=j`4#S*AIB!0{l9Pr5^pmWMf z;Oi_vDsa0PBnvvX3)DUXv2m*erAko03{qEuc(~OPS|bJuT~K(z{7Y>457Gm&nV8%G z@)03-fXoB=Iu_dA2eC1I1@SSqb|p+^wA}!TQONi{C=3UGsSJy`(HR@eu^~uYLP$^! z0p-%+HDiN+90=lb2nq8)Y4bZEy&#>$l~o|sAPh;9#JLS*Iw)R3J07 z6Wk+EAajv1%ns7}z%Ua)x`_(~kPeV)P)HEhx&Y|_VURA6p9t3^Ak`pDYV45i1JdSg zAa2TKpsg=JAv^fe7$h#JF`fhqMNp0)EwzGD5PlcH%qG+d0jUFFkcpt!BrTtTbP#)r z32|*AkShE>1G$uN`Ua^2r61yQCP+2NFNAX>B=+&!4>Ap8H*t9iq#D0@u=pV~_X#oy zwAhn=$KsYrcbil%nuxmi3gM3STxY%Z8+-VD@lDL!tQVqf&vq52jJ>A1p z;Ex56Di8*l1#;(5&1;a@L&O7wk67~ry7gn^-k||WR{`L=J5m@*8Il=@ok7Bv@Ju_qUN#}8;{J&2EvK_LVRQ|zrEm}<)HC}t>RC<31phr8_$atr=Nfw zh+1O89-%D-NdIpNSNSv z7eo#IFag<0sO$jw4TM2z@!JSe1;QYegyIXN4u(PMi8C2l2l1f=(*>eIc99=TAQM0s zWC}g<5V4^Ma}V+98rc`5)qIe2g+IO^Y6zt)h$>2JCF0iO5EomZaD=3e9HLu2gwr8z zf5K#_ziNckaS2d*0AZMm2KQ`B03Zxc5C*Bm zZzD(*2!m7-iZPHn7zU{)&SYdApqM1Cy$90;qCs|%A4?z;Kp12S@v#Nc0m6_NA;0!U`e_nb!rSYT{Bk$TW~@;!-y(J}7G=(W2doe}o1UHXxr8E{$;e5GI3~ z7Ga{pZ-|CZjABojp!i3|#G4M&1=2w{^}tjk z(;%Io(sHPbT@fFWAfFN2E`o&!NDp!GimYRxL!Ov+I?TN=8st;_?Mj$RbQ+`+R3_t| z6-3v8&Ig$Q3N!rkROq^3d`Ou_y4yjvg4|6`dlS@iA|;d|ZX_-xLDUkPQX#7Gn+#Dy zs2l@@2PEf@&MAS?1>tr!D6~kQzalQ5K;n#;cqNolASU5zgMnflmmDaEf#gB{#NT3} z+zvvi6Xq8DAp%kb!XQ@@3Kx(%WDL?noar!KARVA`3x9tBrW%&x;b!u5ZqDDPn z_Cw-|IG;k)k`j_2pOK;-Z<%gD}Y5q}Nn1ouE>QxY7fp z1093x28G$c)Uu?dQIOkVX%G7?0w5LW7@~u?lmt;rY)XZw#&0r24WV)j6bq1?Ke%dH z;^PPA1JY|g;(G1Ku}Z#O#N`u6oDmbRgi;E`By2S)Oa`?l4)P_)cj)KAfy6-=B8R(w z2$CPzxg-21Bfxx(-3K7oV+$*g&p{X@PfYm=Qb$~Q3Q|d0`3cfNe0d4+FJZTUOvRtx zK>i0|kV=qws4EviGT1OkHOPO2?;}Lk4bnxtA3-`1{>1Mth&uc}g{UDE&mcE~e1?5B zHONgc3{pubpCYTp?>c0aAp1v4FVr3pD6~gQFIXx;ra>VC%DK4L@Pbr>RDseJXylT( zF$jwR!B6VIFWDlrRAg*5n$;J5H1yO@POhC5MCifC5VL-6~!ys3H+=;(* zgQ*75ARVB1B(3Cy=>&x{X)SU@SQ6((ko!op1!4oSp$0OaShX-;<4-LhRmd1*11N+^ z+non90i>HW`#?HDx=0H(kS-Vo=?1x&^g07!0%(kpcy~kMj1=|c+zX4iEqMwv#72Y& zYV82?2RaQ38DeueHoe6A5Lq|KR?6Z7WE#ZBq`3g1hg2U!bP;D0L@hBn5TX*lsSq`U z+zU~KtpyL0p?+@%6o2@8sW7|A?{k3aOj?h05*JgX%@TsrH~x49rC%5ZsRq??_}eEi z)gT(A0~G$m^{PQSU>Ky6^l}sulf=6bWD6+n$RAGynE>)3aV;^B?;vg@9O@8tgmM(f zL=XnKgIKjN^@QC3QVGH!(?PL8T+0rm1B5}khJNV6;sN(~B18p!OEpj$$KQ?vg+3@{ z64$;2sRqR`;Wj12x47+x$YTo)Sen2k2a^Y-8CsX7gvMK8ZXqs@fI<)CYVyhvkZxj1 zcaWPv7^EH)v&5G_P4! zrHqC7f%H%ZyPhfNUpqCJ3Yl`EirnS31kY$#rWd^RyTlD zgHj6N`~q?r{uTzzEaF>NARV}U0&*ir1;{tJa}`Jx2!m9D+=#z!BsTPLr*n{9APlmP z7`N*);M>nnJr~nAz9HdAPFV&@ZP@3QK_QB(jR%qgr32ihKS%{AG_jwR192}l(?R;M z$0JAvWGDW#08&NBUQF{rx*k2R1gkX}kkOE0Xe#~|T>X*S44Ts09a)nmpwNCt#K zx{tU>mHFvt&}G&))$f~Tt) zyY4{w9e4Q!3Lj9~8_Hn~DOE7b2Z%Vfas?uT&;j8i&VT}i2!yA=P{EMPki(G2P|RS< zpu~{DP{L5cP{3ftpwFPsP!5KA4CM^Q40;Ut3`Gp-4EhX)43-R*3>FOf489ByQxGg) z1|J3`1_g!`hD-)fYdD7?k)aZ7GH9PsK0`7?HiHtp?gqI7;Yv_kfiOrER92`l49)%z z?p75f9n85V}r?W=%t z5hb-I_SHy`P{A}CxVD4ip*?3=0$7Jq}1*V1_D099L|B z%mwAx!Po+&B)!tRl{cDRA?XxGg3=WzOblssPcHtp10>Cpk{8f*K=_b464YM>@sk+x U8B!Q3!F3>r52|rNHLx860Du(d2mk;8 diff --git a/doc/equations/gamma_ratio.xml b/doc/equations/gamma_ratio.xml index c0ea71e32b6d50c924912942b20de2fe0804cc69..112f0e29f8cb44516a7e2287a41f69d4baff192a 100644 GIT binary patch delta 673 zcmbOuF-KxT03+ALz-D$X1_cHM2KCAJnN%k+x-fE0c4aJO#2kOdna4!Gwccr>#oBiH1E z?8b~-lW#K1LfDcJl^_RzRHrc%F(fi1gVjG|m1N|ae34Uh@&qoH$#YmGz&vF}uE~tt zl9LNKI2gGmf8@{w^Tj7Suv4KX8FU`6GwoWI1jK3nW8CxEWxC8`uV5!G#2kOdna4!Gwccr>#oBk$yc z?8c0|lW#K1LfDcJl^_RzRHrc%F(fi1gVjG|m1N|de34Uh@&qoH$#YmGz&vF}-pP#I zl9LNKI2d^+f8@{w^Tj7Suv4KX8FU`6GwoWI1jK3nW8CxEWxC8`uVvXE z0<|H4A(X+1!H2<3H99ITE26YB51_iL$AX`fq3K*=wCYLjS zpdLdxgE501Lq0yj9GUP(-G-NPj&}B$t z(1WUi*%uA=ImiVe44z=WE5P+YLRTGZ8X*@MGFUQLGFTwF3e|n;40a5$(2xfC5MnkY z2J;w-!SMnTC(a&A6kmeO2E||oLn=ceLkiRuMFw34U5rpqW+(!yDq%=vNMTT5C}+q7 z#|a{KoEZ`siWy266c}6?3K>el;Ri`sAQ4bHDgnm>db(3!FksMQuwXD|PypKuNmcp` zsIE!^r^QOB8)31d08Pt~kWivZh$}HDfKz=jI0Ys$R5I8yC@~~4?0xeP@N`3&W75tt|_lqwiX80;8w7}6OM8FImC!-hehA(sIm2T8dwJ!#N92MS+M z7=XlK7`si#vY8Ba3{?ye8$fJ?*&tOAacph{xd@ldAY1bp>=B}g1qB`z02{Dv(SKr$c zA>!ovSdAeU+-?E2A7G^lD1;GqAp8fh3DpH4S&({dXo&=3W7CVfH8A=&)8L;~nSr*y?$fRP1 zQicM&sz9niDnTyKfrbx=jp+-JN*IRez@BDcs$ew4|AgHFGL^6@kf|V*AXj3~?;sWE z7^DM#xFYKSsV0&P9WV^i3Cfj(b2>~1It>Y7VqFYTO*k|l>hQ-1 zL=C?52vLFCHkj|RmrpRCf>hzN1*8t729&oAq3IaJ#-5HrDsj6AWEKd6RDoiYxKsvG zOq8dG6uPg*favu2hu}Y z*nxC{bb-Q;v@`?K3Bn-VpfEIohCYZ*IK@G9k`|5-J@{H5AQjj!$c?0j3&~;2d1(=30tkcL z019(slG7weHwZ)OF!KBXvYq(y4rCiL2I(fxUYIE$6F^}|ewsx#iL!76nM6rgLiAIT zmO&5ywL>yPo6coFlF;7q*DHS@x3mO^E0FQqfGNdx(GAJ?VqqLzw zdO#@x)|UgZ5j7V`mK+nY=UtF#pgf7YT!X2|hL%|%)yS^FUJrnDf!vLIlmsM8xSs(s z2UpmFQa?x@GfqG%gLHxXf;$C*%*38D zV0y8q2#_pDFZPrGk_Fj|UoYke2gDzUScdQ+W7?o`D$tzLV4tA@g$nJ)HbJ2}_{X?G zt|UJ9gGvAp2BjKM=wVNfAQdnSNf(H80uzVP5P4js0zws}?SeZzA?9G(0};n%KFA-S z5Wt`7XqQGnVW`GXz>o=VL4iaN^%cnf5Fe21Gs1BT3ImX>wDu*TIX;kIK^Wv7T=4~x zhhdO9%us>J!f22xkniY`Qin%O;SVWTc!E}p;2*ICsib~963Q*Gcn8rS7YyFGM^7yf z{%8#fia7-aP~3q^X51w{NF7KOD27L8i9w+O!jM#iSuR4vapgx)ID$eOcRh$pC&W&C zqlqB1L2*R5TmiX&aD4@`5rjeJf_fsLl|!b`-X4fgt=bdhX4=(>xccoNpMfyQcbKsV zl0n8GRUmib4_lZHkZMpEV{hxjRKaMFYLMCK(69xuQNtFd5=4VkgUlvA{y@4w7^D*v zZ}{U8q!NT7=@@^=fJ_9rHWjbSAtvF92Z$`DJrHqRxdCJ|C={@VFh~~UF50Ck%zh;( z%wQO1zYpGU0jUP5#PmBz1{s4?f&7C%oMAdZszG6+1GOE*#-E-*W)n_*kQl-3T8KRE zkO8?1SA4?U4x&NoaN7b>0m2|vAa@hakq~#`HW4C^&t(u5m?l8PvFU`!Aap?ZqiqgQ z%#F4=Agg~NVSyk)DH@blaks=EsR)s(V0t0q*wP_L1e`rCphes|Er25rjc5zziFZ3^E3(Lii4!f01>8*dU#_{SQ)sj6teFv5CEgLRJZ4 zgH(geCR_@`RFh`*$f@_SrvOm+;!8guc~BVP9&Lw(J4hAoxp7GD!DbUg2GeyQn?W&8 zyLE4*QD0MQ_K5a(J@3=RIg3Gp+o zID*Jx`WGTjsP@2Kj)6iD6gER6^%A$j6_zqUIf51|eL>-ceU1oZGcpE+F31(wYi?wf zAT~%fD6dm*6)|R70oj9$L3V=t;|J|)fY^u@1F}jG8>AZKAM*RI_{%Yf9iW+K+%AWt zcH&Y3$i2976UZ(Q2C2bq8%PBRgH+MF#Dm#`y9WkR0mC2{fnp2y{3=W(jE3nTHtmAq z0l!-yae+VdK(^vn0dgNm705Tlx-FLhS9u3A4IP6_C+r58E|6;S;u_fmkZ%b0ZDBe< zG{|01?!sPDgH&L{AYCB4hzmK83B<%2LLD*TOvprtJg%Gwk;RN3h&V3$LH;Ip9RzjP zKM4D3#u8gm!2S5kY2*2GDszUH;@~mY78S`Wl1qZAwv;( zrz&b42?|%t^b5*EAPkblmG(jMAPiE2+XRpb5C*9N#oyp>$s)TJ|EMP{mt)^=1d+uI z8HhNx_yC0wt}+AWDopc0G9V1mjomFEc@PGv!EFLa1qg#w;jcYGsz4Z|5)`Y>M76;N#&;j8iMu0&shww&sCWC4p)DjUnZb#>wL7@S{kTiryQy?)AhKOTJg%DZD znl9XJ156WP`f%k3m^`Refq&NmD4l~;jodLa?4b(^K@bLo557ORi z4+<~bF#|FMgh8r6Icjw581+mmP}m@2P&h%-6QOffkadCBAf2Ed5AJ>&NEHZ!RD$AS zAV-5??jWwl0;xvEFdtyA!BACFI|UQA6J$Tgg`jxEU)F$Bf-p!mC`O3wql3~0zEjCS zX2LMYY|>l;N=5kl?I5#3<`VB_m<~`Wjk|XMQU$}1wh&>rfZPG{ANjQ}<>es6t+?7X z5LwJJ5+aVP)&u#A+!5BHIA#q>OW5-kC?trBVUSAPDGVe_ZitSQF>7omG=ahmS1Lv1 zR(z|~L8>68;2$l8sl&`GAQ^NFG7*$&h-;;Tbc1w&QW9~cGE4_3MNzl+2s0VvdctF$ zuyO)-*g;fa4>gD!zW4)$3U<9PcM=W(h%K0=K*TXiagd#qxd~Tk3vx3EgKWTb4@d?X zgH(ZBM|`VkbmSe<`oJ8+1%)fF_y);=Fhm|#+(Be9V+|sXExkZw5IP`y$XGjQ$25qK PdcrN}{9DK=%61F@Xf|i8 literal 22966 zcmezW&xXOCp@JcoA%{VMp^PDwp@^ZFA(J7WA&vXE z0<|H4A(X+1!H2<3H99ITE26YBr1_iL$AX`fq3K*=wCYLjS zpdLdxgE501Lq0yj9GUP(-G-NPj&}B$t z(1WUi*%uA=ImiVe44z=WE5P+YLRTGZ8X*@MGFUQLGFTwF3e|n;40a5$(2xfC5MnkY z2J;w-!SMnTC(a&A6kmeO2E||oLn=ceLkiRuMFw34U5rpqW+(!yDq%=vNMTT5C}+q7 z#|a{KoEZ`siWy266c}6?3K>el;Ri`sAQ4bHDgnm>db(3!FksMQuwXD|PypKuNmcp` zsIE!^r^QOB8)31d08Pt~kWivZh$}HDfKz=jI0Ys$R5I8yC@~~4?0xeP@N`3&W75tt|_lqwiX80;8w7}6OM8FImC!-hehA(sIm2T8dwJ!#N92MS+M z7=XlK7`si#vY8Ba3{?ye8$fJ?*&tOAacph{xd@ldAY1bp>=B}g1qB`z02{Dv(SKr$c zA>!ovSdAeU+-?E2A7G^lD1;GqAp8fh3DpH4S&({dXo&=3W7CVfH8A=&)8L;~nSr*y?$fRP1 zQicM&sz9niDnTyKfrbx=jp+-JN*IRez@BDcs$ew4|AgHFGL^6@kf|V*AXj3~?;sWE z7^DM#xFYKSsV0&P9WV^i3Cfj(b2>~1It>Y7VqFYTO*k|l>hQ-1 zL=C?52vLFCHkj|RmrpRCf>hzN1*8t729&oAq3IaJ#-5HrDsj6AWEKd6RDoiYxKsvG zOq8dG6uPg*favu2hu}Y z*nxC{bb-Q;v@`?K3Bn-VpfEIohCYZ*IK@G9k`|5-J@{H5AQjj!$c?0j3&~;2d1(=30tkcL z019(slG7weHwZ)OF!KBXvYq(y4rCiL2I(fxUYIE$6F^}|ewsx#iL!76nM6rgLiAIT zmO&5ywL>yPo6coFlF;7q*DHS@x3mO^E0FQqfGNdx(GAJ?VqqLzw zdO#@x)|UgZ5j7V`mK+nY=UtF#pgf7YT!X2|hL%|%)yS^FUJrnDf!vLIlmsM8xSs(s z2UpmFQa?x@GfqG%gLHxXf;$C*%*38D zV0y8q2#_pDFZPrGk_Fj|UoYke2gDzUScdQ+W7?o`D$tzLV4tA@g$nJ)HbJ2}_{X?G zt|UJ9gGvAp2BjKM=wVNfAQdnSNf(H80uzVP5P4js0zws}?SeZzA?9G(0};n%KFA-S z5Wt`7XqQGnVW`GXz>o=VL4iaN^%cnf5Fe21Gs1BT3ImX>wDu*TIX;kIK^Wv7T=4~x zhhdO9%us>J!f22xkniY`Qin%O;SVWTc!E}p;2*ICsib~963Q*Gcn8rS7YyFGM^7yf z{%8#fia7-aP~3q^X51w{NF7KOD27L8i9w+O!jM#iSuR4vapgx)ID$eOcRh$pC&W&C zqlqB1L2*R5TmiX&aD4@`5rjeJf_fsLl|!b`-X4fgt=bdhX4=(>xccoNpMfyQcbKsV zl0n8GRUmib4_lZHkZMpEV{hxjRKaMFYLMCK(69xuQNtFd5=4VkgUlvA{y@4w7^D*v zZ}{U8q!NT7=@@^=fJ_9rHWjbSAtvF92Z$`DJrHqRxdCJ|C={@VFh~~UF50Ck%zh;( z%wQO1zYpGU0jUP5#PmBz1{s4?f&7C%oMAdZszG6+1GOE*#-E-*W)n_*kQl-3T8KRE zkO8?1SA4?U4x&NoaN7b>0m2|vAa@hakq~#`HW4C^&t(u5m?l8PvFU`!Aap?ZqiqgQ z%#F4=Agg~NVSyk)DH@blaks=EsR)s(V0t0q*wP_L1e`rCphes|Er25rjc5zziFZ3^E3(Lii4!f01>8*dU#_{SQ)sj6teFv5CEgLRJZ4 zgH(geCR_@`RFh`*$f@_SrvOm+;!8guc~BVP9&Lw(J4hAoxp7GD!DbUg2GeyQn?W&8 zyLE4*QD0MQ_K5a(J@3=RIg3Gp+o zID*Jx`WGTjsP@2Kj)6iD6gER6^%A$j6_zqUIf51|eL>-ceU1oZGcpE+F31(wYi?wf zAT~%fD6dm*6)|R70oj9$L3V=t;|J|)fY^u@1F}jG8>AZKAM*RI_{%Yf9iW+K+%AWt zcH&Y3$i2976UZ(Q2C2bq8%PBRgH+MF#Dm#`y9WkR0mC2{fnp2y{3=W(jE3nTHtmAq z0l!-yae+VdK(^vn0dgNm705Tlx-FLhS9u3A4IP6_C+r58E|6;S;u_fmkZ%b0ZDBe< zG{|01?!sPDgH&L{AYCB4hzmK83B<%2LLD*TOvprtJg%Gwk;RN3h&V3$LH;Ip9RzjP zKM4D3#u8gm!2S5kY2*2GDszUH;@~mY78S`Wl1qZAwv;( zrz&b42?|%t^b5*EAPkblmG(jMAPiE2+XRpb5C*9N#oyp>$s)TJ|EMP{mt)^=1d+uI z8HhNx_yC0wt}+AWDopc0G9V1mjomFEc@PGv!EFLa1qg#w;jcYGsz4Z|5)`Y>M76;N#&;j8iMu0&shww&sCWC4p)DjUnZb#>wL7@S{kTiryQy?)AhKOTJg%DZD znl9XJ156WP`f%k3m^`Refq&NmD4l~;jodLa?4b(^K@bLo557ORi z4+<~bF#|FMgh8r6Icjw581+mmP}m@2P&h%-6QOffkadCBAf2Ed5AJ>&NEHZ!RD$AS zAV-5??jWwl0;xvEFdtyA!BACFI|UQA6J$Tgg`jxEU)F$Bf-p!mC`O3wql3~0zEjCS zX2LMYY|>l;N=5kl?I5#3<`VB_m<~`Wjk|XMQU$}1wh&>rfZPG{ANjQ}<>es6t+?7X z5LwJJ5+aVP)&u#A+!5BHIA#q>OW5-kC?trBVUSAPDGVe_ZitSQF>7omG=ahmS1Lv1 zR(z|~L8>68;2$l8sl&`GAQ^NFG7*$&h-;;Tbc1w&QW9~cGE4_3MNzl+2s0VvdctF$ zuyO)-*g;fa4>gD!zW4)$3U<9PcM=W(h%K0=K*TXiagd#qxd~Tk3vx3EgKWTb4@d?X zgH(ZBM|`VkbmSe<`oJ8+1%)fF_y);=Fhm|#+(Be9V+|sXExkZw5IP`y$XGjQ$25qK PdcrN}{9DK=%61F@4Bc*o diff --git a/example/negative_binomial_example1.cpp b/example/negative_binomial_example1.cpp index 0216c04cc..96686edf5 100644 --- a/example/negative_binomial_example1.cpp +++ b/example/negative_binomial_example1.cpp @@ -1,282 +1,282 @@ -// negative_binomial_example1.cpp - -// Copyright Paul A. Bristow 2006. - -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt -// or copy at http://www.boost.org/LICENSE_1_0.txt) - -#define BOOST_MATH_THROW_ON_DOMAIN_ERROR -//#define BOOST_MATH_THROW_ON_OVERFLOW_ERROR -// If this is enabled then quantile(nb, 1) will throw thus: -// Message from thrown exception was: -// Error in function double __cdecl boost::math::quantile(const class boost::math::negative_binomial_distribution &,const double &): Probability argument is 1, which implies infinite failures ! - - -#ifdef _MSC_VER -# pragma warning(disable: 4127) // conditional expression is constant. -# pragma warning(disable: 4512) // assignment operator could not be generated. -# pragma warning(disable: 4996) // 'std::char_traits::copy' was declared deprecated. -#endif - -// Example 1 of using negative_binomial distribution. - -// http://en.wikipedia.org/wiki/Negative_binomial_distribution - -// (After a problem by Dr. Diane Evans, -// Professor of mathematics at Rose-Hulman Institute of Technology) - -// Pat is required to sell candy bars to raise money for the 6th grade field trip. -// There are thirty houses in the neighborhood, -// and Pat is not supposed to return home until five candy bars have been sold. -// So the child goes door to door, selling candy bars. -// At each house, there is a 0.4 probability (40%) of selling one candy bar -// and a 0.6 probability (60%) of selling nothing. - -// What is the probability mass/density function for selling the last (fifth) candy bar at the nth house? - -// The Negative Binomial(r, p) distribution describes the probability of k failures -// and r successes in k+r Bernoulli(p) trials with success on the last trial. -// Selling five candy bars means getting five successes, so successes r = 5. -// The total number of trials n (in this case, houses) this takes is therefore -// = sucesses + failures or k + r = k + 5. -// The random variable we are interested in is the number of houses k -// that must be visited to sell five candy bars, -// so we substitute k = n 5 into a NegBin(5, 0.4) mass/density function -// and obtain the following mass/density function of the distribution of houses (for n >= 5): -// Obviously, the best case is that Pat makes sales on all the first five houses. - -// What is the probability that Pat finishes ON the tenth house? - -// f(10) = 0.1003290624, or about 1 in 10 - -// What is the probability that Pat finishes ON OR BEFORE reaching the eighth house? - -// To finish on or before the eighth house, -// Pat must finish at the fifth, sixth, seventh, or eighth house. -// Sum those probabilities: - - // f(5) = 0.01024 - // f(6) = 0.03072 - // f(7) = 0.055296 - // f(8) = 0.0774144 - // sum {j=5 to 8} f(j) = 0.17367 - -// What is the probability that Pat exhausts all 30 houses in the neighborhood, -// and still doesn't sell the required 5 candy bars? - -// 1 - sum{j=5 to 30} f(j) = 1 - incomplete beta (p = 0.4)(5, 30-5+1) =~ 1 - 0.99849 = 0.00151 = 0.15%. - -// see also http://www.math.uah.edu/stat/bernoulli/Introduction.xhtml -// http://www.codecogs.com/pages/catgen.php?category=stats/dists/discrete - -#include // for negative_binomial_distribution - using boost::math::negative_binomial_distribution; - using boost::math::negative_binomial; // typedef provides default type is double. - using ::boost::math::cdf; - using ::boost::math::pdf; // Probability of negative_binomial. - using ::boost::math::quantile; - -#include - using std::cout; - using std::endl; - using std::noshowpoint; -#include - using std::setprecision; - -#include - -int main() -{ - cout << "Example 1 using the Negative Binomial Distribution."; - #if defined(__FILE__) && defined(__TIMESTAMP__) - cout << " " << __FILE__ << ' ' << __TIMESTAMP__ << ' '<< _MSC_FULL_VER << "\n"; - #endif - cout << endl; - cout.precision(5); // NB INF shows wrongly with < 5 ! - // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=240227 - - try - { - double sales_quota = 5; // Pat's sales quota - successes (r). - double success_fraction = 0.4; // success_fraction (p) - so fail_fraction is 0.6. - negative_binomial nb(sales_quota, success_fraction); // double by default. - int all_houses = 30; // The number of houses on the estate. - - cout <<"Selling candy bars - an example of using the negative binomial distribution. " - << "\n""An example by Dr. Diane Evans," - "\n""Professor of Mathematics at Rose-Hulman Institute of Technology," - << "\n""see http://en.wikipedia.org/wiki/Negative_binomial_distribution""\n" - << endl; - cout << "Pat has a sales per house success rate of " << success_fraction - << ".""\n""Therefore he would, on average, sell " << nb.success_fraction() * 100 << " bars after trying 100 houses." << endl; - - cout << "With a success rate of " << nb.success_fraction() << ", he might expect, on average,""\n" - " to need to visit about " << success_fraction * all_houses << " houses in order to sell all " << nb.successes() << " candy bars. " << endl; - - // To finish on or before the 8th house, Pat must finish at the 5th, 6th, 7th or 8th house. - // (Obviously he could not finish on fewer than 5 houses because he must sell 5 candy bars. - // so the 5th house is the first that he could possibly finish on). - // The probability that he will finish on EXACTLY on any house is the Probability Density Function (pdf). - cout << "Probability that Pat finishes on the " << sales_quota << "th house is " << "f(5) = " << pdf(nb, nb.successes()) << endl; - cout << "Probability that Pat finishes on the 6th house is " << pdf(nb, 6 - sales_quota) << endl; - cout << "Probability that Pat finishes on the 7th house is " << pdf(nb, 7 - sales_quota) << endl; - cout << "Probability that Pat finishes on the 8th house is " << pdf(nb, 8 - sales_quota) << endl; - - // The sum of the probabilities for these houses is the Cumulative Distribution Function (cdf). - cout << "Probability that Pat finishes on or before the 8th house is sum " - "\n" << "pdf(sales_quota) + pdf(6) + pdf(7) + pdf(8) = " - // Sum each of the mass/density probabilities for houses sales_quota = 5, 6, 7, & 8. - << pdf(nb, sales_quota - sales_quota) // 0 - + pdf(nb, 6 - sales_quota) // 1 - + pdf(nb, 7 - sales_quota) // 2 - + pdf(nb, 8 - sales_quota) // 3 - << endl; - - // Or using the negative binomial **cumulative** distribution function (cdf instead sum of the pdfs): - cout << "\n""Probability of selling his quota of " << sales_quota - << " candy bars""\n""on or before the " << 8 << "th house is " - << cdf(nb, 8 - sales_quota) << endl; - - cout << "\n""Probability that Pat finishes exactly on the 10th house is " << pdf(nb, 10 - sales_quota) << endl; - cout << "\n""Probability of selling his quota of " << sales_quota - << " candy bars""\n""on or before the " << 10 << "th house is " - << cdf(nb, 10 - sales_quota) << endl; - - cout << "Probability that Pat finishes on the 11th house is " << pdf(nb, 11 - sales_quota) << endl; - cout << "\n""Probability of selling his quota of " << sales_quota - << " candy bars""\n""on or before the " << 11 << "th house is " - << cdf(nb, 11 - sales_quota) << endl; - - cout << "Probability that Pat finishes on the 12th house is " << pdf(nb, 12 - sales_quota) << endl; - cout << "\n""Probability of selling his quota of " << sales_quota - << " candy bars""\n""on or before the " << 12 << "th house is " - << cdf(nb, 12 - sales_quota) << endl; - - // Finally consider the risk of Pat not setting his quota of 5 bars even after visiting all the houses. - // Calculate the probability that he would sell on the (non-existent) last-plus-1 house. - cout << "\n""Probability of selling his quota of " << sales_quota - << " candy bars""\n""on or before the " << all_houses + 1 << "th house is " - << cdf(nb, all_houses + 1 - sales_quota) << endl; - // So the risk of failing even at the 31th (non-existent) house is 1 - this probability. - cout << "\n""Probability of failing to sell his quota of " << sales_quota - << " candy bars""\n""even after visiting all " << all_houses << " houses is " - << 1 - cdf(nb, all_houses - sales_quota + 1) << endl; - - double p = cdf(nb, (8 - sales_quota)); - cout << "Probability of meeting sales quota on or before 8th house is "<< p << endl; - // Probability of meeting sales quota on or before 8th house is 0.174 - cout << "If the confidence of meeting sales quota is " << p - << ", then the finishing house is " << quantile(nb, p) + sales_quota << endl; - // Also try wanting absolute certainty that all 5 will be sold - // which implies an infinite number of sales. - // (Of course, there are only 30 houses on the estate, so he can't even be certain of selling his quota. - cout << "If the confidence of meeting sales quota is " << 1. - << ", then the finishing house is " << quantile(nb, 1) + sales_quota << endl; // 1.#INF == infinity. - - cout << "If the confidence of meeting sales quota is " << 0. - << ", then the finishing house is " << quantile(nb, 0.) + sales_quota << endl; - - cout << "If the confidence of meeting sales quota is " << 1 - 0.00151 // 30 th - << ", then the finishing house is " << quantile(nb, 1 - 0.00151) + sales_quota << endl; - - // If the opposite is true, we don't want to assume any confidence, then - // this is tantamount to assuming that the first sales_quota will be successful. - cout << "If confidence of meeting quota is zero (we assume all houses are successful sales)" - ", then finishing house is " << sales_quota << endl; - - - int const pssize = 11; - double ps[pssize] = {0., 0.001, 0.01, 0.05, 0.1, 0.5, 0.9, 0.95, 0.99, 0.999, 1.}; - for (int i = 0; i < pssize; i++) - { - cout << "If confidence of meeting quota is " << ps[i] - << ", then finishing house is " << ceil(quantile(nb, ps[i])) + sales_quota << endl; - } - - cout << "If we demand a confidence of meeting sales quota of unity" - ", then we can never be certain of selling 5 bars, so the finishing house is infinite!" << endl; - } - catch(const std::exception& e) - { - std::cout << - "\n""Message from thrown exception was:\n " << e.what() << std::endl; - } - - return 0; -} // int main() - -/* - -Output is: - -Example 1 using the Negative Binomial Distribution. ..\..\..\..\..\..\boost-san -dbox\libs\math_functions\example\negative_binomial_example1.cpp Wed Nov 22 18:33 -:26 2006 140050727 - -Selling candy bars - an example of using the negative binomial distribution. -An example by Dr. Diane Evans, -Professor of Mathematics at Rose-Hulman Institute of Technology, -see http://en.wikipedia.org/wiki/Negative_binomial_distribution - -Pat has a sales per house success rate of 0.4. -Therefore he would, on average, sell 40 bars after trying 100 houses. -With a success rate of 0.4, he might expect, on average, - to need to visit about 12 houses in order to sell all 5 candy bars. -Probability that Pat finishes on the 5th house is f(5) = 0.10033 -Probability that Pat finishes on the 6th house is 0.03072 -Probability that Pat finishes on the 7th house is 0.055296 -Probability that Pat finishes on the 8th house is 0.077414 -Probability that Pat finishes on or before the 8th house is sum -pdf(sales_quota) + pdf(6) + pdf(7) + pdf(8) = 0.17367 - -Probability of selling his quota of 5 candy bars -on or before the 8th house is 0.17367 - -Probability that Pat finishes exactly on the 10th house is 0.10033 - -Probability of selling his quota of 5 candy bars -on or before the 10th house is 0.3669 -Probability that Pat finishes on the 11th house is 0.10033 - -Probability of selling his quota of 5 candy bars -on or before the 11th house is 0.46723 -Probability that Pat finishes on the 12th house is 0.094596 - -Probability of selling his quota of 5 candy bars -on or before the 12th house is 0.56182 - -Probability of selling his quota of 5 candy bars -on or before the 31th house is 0.99897 - -Probability of failing to sell his quota of 5 candy bars -even after visiting all 30 houses is 0.0010314 -Probability of meeting sales quota on or before 8th house is 0.17367 -If the confidence of meeting sales quota is 0.17367, then the finishing house is 8 -If the confidence of meeting sales quota is 1, then the finishing house is 1.#INF -If the confidence of meeting sales quota is 0, then the finishing house is 5 -If the confidence of meeting sales quota is 0.99849, then the finishing house is 30 -If confidence of meeting quota is zero (we assume all houses are successful sale -s), then finishing house is 5 -If confidence of meeting quota is 0, then finishing house is 5 -If confidence of meeting quota is 0.001, then finishing house is 5 -If confidence of meeting quota is 0.01, then finishing house is 5 -If confidence of meeting quota is 0.05, then finishing house is 7 -If confidence of meeting quota is 0.1, then finishing house is 8 -If confidence of meeting quota is 0.5, then finishing house is 12 -If confidence of meeting quota is 0.9, then finishing house is 18 -If confidence of meeting quota is 0.95, then finishing house is 21 -If confidence of meeting quota is 0.99, then finishing house is 25 -If confidence of meeting quota is 0.999, then finishing house is 32 -If confidence of meeting quota is 1, then finishing house is 1.#INF -If we demand a confidence of meeting sales quota of unity, then we can never be -certain of selling 5 bars, so the finishing house is infinite! -Press any key to continue . . . - -*/ - - - - - +// negative_binomial_example1.cpp + +// Copyright Paul A. Bristow 2006. + +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#define BOOST_MATH_THROW_ON_DOMAIN_ERROR +//#define BOOST_MATH_THROW_ON_OVERFLOW_ERROR +// If this is enabled then quantile(nb, 1) will throw thus: +// Message from thrown exception was: +// Error in function double __cdecl boost::math::quantile(const class boost::math::negative_binomial_distribution &,const double &): Probability argument is 1, which implies infinite failures ! + + +#ifdef _MSC_VER +# pragma warning(disable: 4127) // conditional expression is constant. +# pragma warning(disable: 4512) // assignment operator could not be generated. +# pragma warning(disable: 4996) // 'std::char_traits::copy' was declared deprecated. +#endif + +// Example 1 of using negative_binomial distribution. + +// http://en.wikipedia.org/wiki/Negative_binomial_distribution + +// (After a problem by Dr. Diane Evans, +// Professor of mathematics at Rose-Hulman Institute of Technology) + +// Pat is required to sell candy bars to raise money for the 6th grade field trip. +// There are thirty houses in the neighborhood, +// and Pat is not supposed to return home until five candy bars have been sold. +// So the child goes door to door, selling candy bars. +// At each house, there is a 0.4 probability (40%) of selling one candy bar +// and a 0.6 probability (60%) of selling nothing. + +// What is the probability mass/density function for selling the last (fifth) candy bar at the nth house? + +// The Negative Binomial(r, p) distribution describes the probability of k failures +// and r successes in k+r Bernoulli(p) trials with success on the last trial. +// Selling five candy bars means getting five successes, so successes r = 5. +// The total number of trials n (in this case, houses) this takes is therefore +// = sucesses + failures or k + r = k + 5. +// The random variable we are interested in is the number of houses k +// that must be visited to sell five candy bars, +// so we substitute k = n 5 into a NegBin(5, 0.4) mass/density function +// and obtain the following mass/density function of the distribution of houses (for n >= 5): +// Obviously, the best case is that Pat makes sales on all the first five houses. + +// What is the probability that Pat finishes ON the tenth house? + +// f(10) = 0.1003290624, or about 1 in 10 + +// What is the probability that Pat finishes ON OR BEFORE reaching the eighth house? + +// To finish on or before the eighth house, +// Pat must finish at the fifth, sixth, seventh, or eighth house. +// Sum those probabilities: + + // f(5) = 0.01024 + // f(6) = 0.03072 + // f(7) = 0.055296 + // f(8) = 0.0774144 + // sum {j=5 to 8} f(j) = 0.17367 + +// What is the probability that Pat exhausts all 30 houses in the neighborhood, +// and still doesn't sell the required 5 candy bars? + +// 1 - sum{j=5 to 30} f(j) = 1 - incomplete beta (p = 0.4)(5, 30-5+1) =~ 1 - 0.99849 = 0.00151 = 0.15%. + +// see also http://www.math.uah.edu/stat/bernoulli/Introduction.xhtml +// http://www.codecogs.com/pages/catgen.php?category=stats/dists/discrete + +#include // for negative_binomial_distribution + using boost::math::negative_binomial_distribution; + using boost::math::negative_binomial; // typedef provides default type is double. + using ::boost::math::cdf; + using ::boost::math::pdf; // Probability of negative_binomial. + using ::boost::math::quantile; + +#include + using std::cout; + using std::endl; + using std::noshowpoint; +#include + using std::setprecision; + +#include + +int main() +{ + cout << "Example 1 using the Negative Binomial Distribution."; + #if defined(__FILE__) && defined(__TIMESTAMP__) + cout << " " << __FILE__ << ' ' << __TIMESTAMP__ << ' '<< _MSC_FULL_VER << "\n"; + #endif + cout << endl; + cout.precision(5); // NB INF shows wrongly with < 5 ! + // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=240227 + + try + { + double sales_quota = 5; // Pat's sales quota - successes (r). + double success_fraction = 0.4; // success_fraction (p) - so fail_fraction is 0.6. + negative_binomial nb(sales_quota, success_fraction); // double by default. + int all_houses = 30; // The number of houses on the estate. + + cout <<"Selling candy bars - an example of using the negative binomial distribution. " + << "\n""An example by Dr. Diane Evans," + "\n""Professor of Mathematics at Rose-Hulman Institute of Technology," + << "\n""see http://en.wikipedia.org/wiki/Negative_binomial_distribution""\n" + << endl; + cout << "Pat has a sales per house success rate of " << success_fraction + << ".""\n""Therefore he would, on average, sell " << nb.success_fraction() * 100 << " bars after trying 100 houses." << endl; + + cout << "With a success rate of " << nb.success_fraction() << ", he might expect, on average,""\n" + " to need to visit about " << success_fraction * all_houses << " houses in order to sell all " << nb.successes() << " candy bars. " << endl; + + // To finish on or before the 8th house, Pat must finish at the 5th, 6th, 7th or 8th house. + // (Obviously he could not finish on fewer than 5 houses because he must sell 5 candy bars. + // so the 5th house is the first that he could possibly finish on). + // The probability that he will finish on EXACTLY on any house is the Probability Density Function (pdf). + cout << "Probability that Pat finishes on the " << sales_quota << "th house is " << "f(5) = " << pdf(nb, nb.successes()) << endl; + cout << "Probability that Pat finishes on the 6th house is " << pdf(nb, 6 - sales_quota) << endl; + cout << "Probability that Pat finishes on the 7th house is " << pdf(nb, 7 - sales_quota) << endl; + cout << "Probability that Pat finishes on the 8th house is " << pdf(nb, 8 - sales_quota) << endl; + + // The sum of the probabilities for these houses is the Cumulative Distribution Function (cdf). + cout << "Probability that Pat finishes on or before the 8th house is sum " + "\n" << "pdf(sales_quota) + pdf(6) + pdf(7) + pdf(8) = " + // Sum each of the mass/density probabilities for houses sales_quota = 5, 6, 7, & 8. + << pdf(nb, sales_quota - sales_quota) // 0 + + pdf(nb, 6 - sales_quota) // 1 + + pdf(nb, 7 - sales_quota) // 2 + + pdf(nb, 8 - sales_quota) // 3 + << endl; + + // Or using the negative binomial **cumulative** distribution function (cdf instead sum of the pdfs): + cout << "\n""Probability of selling his quota of " << sales_quota + << " candy bars""\n""on or before the " << 8 << "th house is " + << cdf(nb, 8 - sales_quota) << endl; + + cout << "\n""Probability that Pat finishes exactly on the 10th house is " << pdf(nb, 10 - sales_quota) << endl; + cout << "\n""Probability of selling his quota of " << sales_quota + << " candy bars""\n""on or before the " << 10 << "th house is " + << cdf(nb, 10 - sales_quota) << endl; + + cout << "Probability that Pat finishes on the 11th house is " << pdf(nb, 11 - sales_quota) << endl; + cout << "\n""Probability of selling his quota of " << sales_quota + << " candy bars""\n""on or before the " << 11 << "th house is " + << cdf(nb, 11 - sales_quota) << endl; + + cout << "Probability that Pat finishes on the 12th house is " << pdf(nb, 12 - sales_quota) << endl; + cout << "\n""Probability of selling his quota of " << sales_quota + << " candy bars""\n""on or before the " << 12 << "th house is " + << cdf(nb, 12 - sales_quota) << endl; + + // Finally consider the risk of Pat not setting his quota of 5 bars even after visiting all the houses. + // Calculate the probability that he would sell on the (non-existent) last-plus-1 house. + cout << "\n""Probability of selling his quota of " << sales_quota + << " candy bars""\n""on or before the " << all_houses + 1 << "th house is " + << cdf(nb, all_houses + 1 - sales_quota) << endl; + // So the risk of failing even at the 31th (non-existent) house is 1 - this probability. + cout << "\n""Probability of failing to sell his quota of " << sales_quota + << " candy bars""\n""even after visiting all " << all_houses << " houses is " + << 1 - cdf(nb, all_houses - sales_quota + 1) << endl; + + double p = cdf(nb, (8 - sales_quota)); + cout << "Probability of meeting sales quota on or before 8th house is "<< p << endl; + // Probability of meeting sales quota on or before 8th house is 0.174 + cout << "If the confidence of meeting sales quota is " << p + << ", then the finishing house is " << quantile(nb, p) + sales_quota << endl; + // Also try wanting absolute certainty that all 5 will be sold + // which implies an infinite number of sales. + // (Of course, there are only 30 houses on the estate, so he can't even be certain of selling his quota. + cout << "If the confidence of meeting sales quota is " << 1. + << ", then the finishing house is " << quantile(nb, 1) + sales_quota << endl; // 1.#INF == infinity. + + cout << "If the confidence of meeting sales quota is " << 0. + << ", then the finishing house is " << quantile(nb, 0.) + sales_quota << endl; + + cout << "If the confidence of meeting sales quota is " << 1 - 0.00151 // 30 th + << ", then the finishing house is " << quantile(nb, 1 - 0.00151) + sales_quota << endl; + + // If the opposite is true, we don't want to assume any confidence, then + // this is tantamount to assuming that the first sales_quota will be successful. + cout << "If confidence of meeting quota is zero (we assume all houses are successful sales)" + ", then finishing house is " << sales_quota << endl; + + + int const pssize = 11; + double ps[pssize] = {0., 0.001, 0.01, 0.05, 0.1, 0.5, 0.9, 0.95, 0.99, 0.999, 1.}; + for (int i = 0; i < pssize; i++) + { + cout << "If confidence of meeting quota is " << ps[i] + << ", then finishing house is " << ceil(quantile(nb, ps[i])) + sales_quota << endl; + } + + cout << "If we demand a confidence of meeting sales quota of unity" + ", then we can never be certain of selling 5 bars, so the finishing house is infinite!" << endl; + } + catch(const std::exception& e) + { + std::cout << + "\n""Message from thrown exception was:\n " << e.what() << std::endl; + } + + return 0; +} // int main() + +/* + +Output is: + +Example 1 using the Negative Binomial Distribution. ..\..\..\..\..\..\boost-san +dbox\libs\math_functions\example\negative_binomial_example1.cpp Wed Nov 22 18:33 +:26 2006 140050727 + +Selling candy bars - an example of using the negative binomial distribution. +An example by Dr. Diane Evans, +Professor of Mathematics at Rose-Hulman Institute of Technology, +see http://en.wikipedia.org/wiki/Negative_binomial_distribution + +Pat has a sales per house success rate of 0.4. +Therefore he would, on average, sell 40 bars after trying 100 houses. +With a success rate of 0.4, he might expect, on average, + to need to visit about 12 houses in order to sell all 5 candy bars. +Probability that Pat finishes on the 5th house is f(5) = 0.10033 +Probability that Pat finishes on the 6th house is 0.03072 +Probability that Pat finishes on the 7th house is 0.055296 +Probability that Pat finishes on the 8th house is 0.077414 +Probability that Pat finishes on or before the 8th house is sum +pdf(sales_quota) + pdf(6) + pdf(7) + pdf(8) = 0.17367 + +Probability of selling his quota of 5 candy bars +on or before the 8th house is 0.17367 + +Probability that Pat finishes exactly on the 10th house is 0.10033 + +Probability of selling his quota of 5 candy bars +on or before the 10th house is 0.3669 +Probability that Pat finishes on the 11th house is 0.10033 + +Probability of selling his quota of 5 candy bars +on or before the 11th house is 0.46723 +Probability that Pat finishes on the 12th house is 0.094596 + +Probability of selling his quota of 5 candy bars +on or before the 12th house is 0.56182 + +Probability of selling his quota of 5 candy bars +on or before the 31th house is 0.99897 + +Probability of failing to sell his quota of 5 candy bars +even after visiting all 30 houses is 0.0010314 +Probability of meeting sales quota on or before 8th house is 0.17367 +If the confidence of meeting sales quota is 0.17367, then the finishing house is 8 +If the confidence of meeting sales quota is 1, then the finishing house is 1.#INF +If the confidence of meeting sales quota is 0, then the finishing house is 5 +If the confidence of meeting sales quota is 0.99849, then the finishing house is 30 +If confidence of meeting quota is zero (we assume all houses are successful sale +s), then finishing house is 5 +If confidence of meeting quota is 0, then finishing house is 5 +If confidence of meeting quota is 0.001, then finishing house is 5 +If confidence of meeting quota is 0.01, then finishing house is 5 +If confidence of meeting quota is 0.05, then finishing house is 7 +If confidence of meeting quota is 0.1, then finishing house is 8 +If confidence of meeting quota is 0.5, then finishing house is 12 +If confidence of meeting quota is 0.9, then finishing house is 18 +If confidence of meeting quota is 0.95, then finishing house is 21 +If confidence of meeting quota is 0.99, then finishing house is 25 +If confidence of meeting quota is 0.999, then finishing house is 32 +If confidence of meeting quota is 1, then finishing house is 1.#INF +If we demand a confidence of meeting sales quota of unity, then we can never be +certain of selling 5 bars, so the finishing house is infinite! +Press any key to continue . . . + +*/ + + + + + diff --git a/include/boost/math/special_functions/detail/t_distribution_inv.hpp b/include/boost/math/special_functions/detail/t_distribution_inv.hpp index 742b6a988..776092634 100644 --- a/include/boost/math/special_functions/detail/t_distribution_inv.hpp +++ b/include/boost/math/special_functions/detail/t_distribution_inv.hpp @@ -1,502 +1,502 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_MATH_SF_DETAIL_INV_T_HPP -#define BOOST_MATH_SF_DETAIL_INV_T_HPP - -#include - -namespace boost{ namespace math{ namespace detail{ - -// -// The main method used is due to Hill: -// -// G. W. Hill, Algorithm 396, Student’s t-Quantiles, -// Communications of the ACM, 13(10): 619-620, Oct., 1970. -// -template -T inverse_students_t_hill(T ndf, T u) -{ - using namespace std; - BOOST_ASSERT(u <= 0.5); - - T a, b, c, d, q, x, y; - - if (ndf > 1e20f) - return -boost::math::erfc_inv(2 * u) * constants::root_two(); - - a = 1 / (ndf - 0.5f); - b = 48 / (a * a); - c = ((20700 * a / b - 98) * a - 16) * a + 96.36f; - d = ((94.5f / (b + c) - 3) / b + 1) * sqrt(a * constants::pi() / 2) * ndf; - y = pow(d * 2 * u, 2 / ndf); - - if (y > (0.05f + a)) - { - // - // Asymptotic inverse expansion about normal: - // - x = -boost::math::erfc_inv(2 * u) * constants::root_two(); - y = x * x; - - if (ndf < 5) - c += 0.3f * (ndf - 4.5f) * (x + 0.6f); - c += (((0.05f * d * x - 5) * x - 7) * x - 2) * x + b; - y = (((((0.4f * y + 6.3f) * y + 36) * y + 94.5f) / c - y - 3) / b + 1) * x; - y = boost::math::expm1(a * y * y); - } - else - { - y = ((1 / (((ndf + 6) / (ndf * y) - 0.089f * d - 0.822f) - * (ndf + 2) * 3) + 0.5 / (ndf + 4)) * y - 1) - * (ndf + 1) / (ndf + 2) + 1 / y; - } - q = sqrt(ndf * y); - - return -q; -} -// -// Tail and body series are due to Shaw: -// -// www.mth.kcl.ac.uk/˜shaww/web_page/papers/Tdistribution06.pdf -// -// Shaw, W.T., 2006, "Sampling Student’s T distribution – use of -// the inverse cumulative distribution function." -// Journal of Computational Finance, Vol 9 Issue 4, pp 37-73, Summer 2006 -// -template -T inverse_students_t_tail_series(T df, T v, T u, const L& l) -{ - using namespace std; - // Tail series expansion, see section 6 of Shaw's paper. - // w is calculated using Eq 60: - T w = detail::tgamma_delta_ratio_imp(df / 2, constants::half(), l) - * sqrt(df * constants::pi()) * v; - // define some variables: - T np2 = df + 2; - T np4 = df + 4; - T np6 = df + 6; - // - // Calculate the coefficients d(k), these depend only on the - // number of degrees of freedom df, so at least in theory - // we could tabulate these for fixed df, see p15 of Shaw: - // - T d[7] = { 1, }; - d[1] = -(df + 1) / (2 * np2); - np2 *= (df + 2); - d[2] = -df * (df + 1) * (df + 3) / (8 * np2 * np4); - np2 *= df + 2; - d[3] = -df * (df + 1) * (df + 5) * (((3 * df) + 7) * df -2) / (48 * np2 * np4 * np6); - np2 *= (df + 2); - np4 *= (df + 4); - d[4] = -df * (df + 1) * (df + 7) * - ( (((((15 * df) + 154) * df + 465) * df + 286) * df - 336) * df + 64 ) - / (384 * np2 * np4 * np6 * (df + 8)); - np2 *= (df + 2); - d[5] = -df * (df + 1) * (df + 3) * (df + 9) - * (((((((35 * df + 452) * df + 1573) * df + 600) * df - 2020) * df) + 928) * df -128) - / (1280 * np2 * np4 * np6 * (df + 8) * (df + 10)); - np2 *= (df + 2); - np4 *= (df + 4); - np6 *= (df + 6); - d[6] = -df * (df + 1) * (df + 11) - * ((((((((((((945 * df) + 31506) * df + 425858) * df + 2980236) * df + 11266745) * df + 20675018) * df + 7747124) * df - 22574632) * df - 8565600) * df + 18108416) * df - 7099392) * df + 884736) - / (46080 * np2 * np4 * np6 * (df + 8) * (df + 10) * (df +12)); - // - // Now bring everthing together to provide the result, - // this is Eq 62 of Shaw: - // - T rn = sqrt(df); - T div = pow(rn * w, 1 / df); - T power = div * div; - T result = tools::evaluate_polynomial(d, power); - result *= rn; - result /= div; - return -result; -} - -template -T inverse_students_t_body_series(T df, T u, const L& l) -{ - using namespace std; - // - // Body series for small N: - // - // Start with Eq 56 of Shaw: - // - T v = detail::tgamma_delta_ratio_imp(df / 2, constants::half(), l) - * sqrt(df * constants::pi()) * (u - constants::half()); - // - // Workspace for the polynomial coefficients: - // - T c[11] = { 0, 1, }; - // - // Figure out what the coefficients are, note these depend - // only on the degrees of freedom (Eq 57 of Shaw): - // - c[2] = T(1) / 6 + T(1) / (6 * df); - T in = 1 / df; - c[3] = (((T(1) / 120) * in) + (T(1) / 15)) * in + (T(7) / 120); - c[4] = ((((T(1) / 5040) * in + (T(1) / 560)) * in + (T(3) / 112)) * in + T(127) / 5040); - c[5] = ((((T(1) / 362880) * in + (T(17) / 45360)) * in + (T(67) / 60480)) * in + (T(479) / 45360)) * in + (T(4369) / 362880); - c[6] = ((((((T(1) / 39916800) * in + (T(2503) / 39916800)) * in + (T(11867) / 19958400)) * in + (T(1285) / 798336)) * in + (T(153161) / 39916800)) * in + (T(34807) / 5702400)); - c[7] = (((((((T(1) / 6227020800LL) * in + (T(37) / 2402400)) * in + - (T(339929) / 2075673600LL)) * in + (T(67217) / 97297200)) * in + - (T(870341) / 691891200LL)) * in + (T(70691) / 64864800LL)) * in + - (T(20036983LL) / 6227020800LL)); - c[8] = (((((((T(1) / 1307674368000LL) * in + (T(1042243LL) / 261534873600LL)) * in + - (T(21470159) / 435891456000LL)) * in + (T(326228899LL) / 1307674368000LL)) * in + - (T(843620579) / 1307674368000LL)) * in + (T(332346031LL) / 435891456000LL)) * in + - (T(43847599) / 1307674368000LL)) * in + (T(2280356863LL) / 1307674368000LL); - c[9] = (((((((((T(1) / 355687428096000LL)) * in + (T(24262727LL) / 22230464256000LL)) * in + - (T(123706507LL) / 8083805184000LL)) * in + (T(404003599LL) / 4446092851200LL)) * in + - (T(51811946317LL) / 177843714048000LL)) * in + (T(91423417LL) / 177843714048LL)) * in + - (T(32285445833LL) / 88921857024000LL)) * in + (T(531839683LL) / 1710035712000LL)) * in + - (T(49020204823LL) / 50812489728000LL); - c[10] = (((((((((T(1) / 121645100408832000LL) * in + - (T(4222378423LL) / 13516122267648000LL)) * in + - (T(49573465457LL) / 10137091700736000LL)) * in + - (T(176126809LL) / 5304600576000LL)) * in + - (T(44978231873LL) / 355687428096000LL)) * in + - (T(5816850595639LL) / 20274183401472000LL)) * in + - (T(73989712601LL) / 206879422464000LL)) * in + - (T(26591354017LL) / 259925428224000LL)) * in + - (T(14979648446341LL) / 40548366802944000LL)) * in + - (T(65967241200001LL) / 121645100408832000LL); - // - // The result is then a polynomial in v (see Eq 56 of Shaw): - // - return tools::evaluate_odd_polynomial(c, v); -} - -template -T inverse_students_t(T df, T u, T v, const L& l, bool* pexact = 0) -{ - // - // df = number of degrees of freedom. - // u = probablity. - // v = 1 - u. - // l = lanczos type to use. - // - using namespace std; - bool invert = false; - T result = 0; - if(pexact) - *pexact = false; - if(u > v) - { - // function is symmetric, invert it: - std::swap(u, v); - invert = true; - } - if((floor(df) == df) && (df < 20)) - { - // - // we have integer degrees of freedom, try for the special - // cases first: - // - T tolerance = ldexp(1.0f, (2 * tools::digits()) / 3); - - switch(boost::math::tools::real_cast(df)) - { - case 1: - { - // - // df = 1 is the same as the Cauchy distribution, see - // Shaw Eq 35: - // - // FIXME: fails when u is small!!! - result = tan(constants::pi() * (u - constants::half())); - if(u == 0.5) - result = 0; - else - result = -cos(constants::pi() * u) / sin(constants::pi() * u); - if(pexact) - *pexact = true; - break; - } - case 2: - { - // - // df = 2 has an exact result, see Shaw Eq 36: - // - result =(2 * u - 1) / sqrt(2 * u * v); - if(pexact) - *pexact = true; - break; - } - case 4: - { - // - // df = 4 has an exact result, see Shaw Eq 38 & 39: - // - T alpha = 4 * u * v; - T root_alpha = sqrt(alpha); - T r = 4 * cos(acos(root_alpha) / 3) / root_alpha; - T x = sqrt(r - 4); - result = u - 0.5f < 0 ? -x : x; - if(pexact) - *pexact = true; - break; - } - case 6: - { - // - // We get numeric overflow in this area: - // - if(u < 1e-150) - return (invert ? -1 : 1) * inverse_students_t_hill(df, u); - // - // Newton-Raphson iteration of a polynomial case, - // choice of seed value is taken from Shaw's online - // supplement: - // - T a = 4 * (u - u * u);//1 - 4 * (u - 0.5f) * (u - 0.5f); - T b = boost::math::cbrt(a); - static const T c = 0.85498797333834849467655443627193L; - T p = 6 * (1 + c * (1 / b - 1)); - T p0; - do{ - T p2 = p * p; - T p4 = p2 * p2; - T p5 = p * p4; - p0 = p; - // next term is given by Eq 41: - p = 2 * (8 * a * p5 - 270 * p2 + 2187) / (5 * (4 * a * p4 - 216 * p - 243)); - }while(fabs((p - p0) / p) > tolerance); - // - // Use Eq 45 to extract the result: - // - p = sqrt(p - df); - result = (u - 0.5f) < 0 ? -p : p; - break; - } -#if 0 - // - // These are Shaw's "exact" but iterative solutions - // for even df, the numerical accuracy of these is - // rather less than Hill's method, so these are disabled - // for now, which is a shame because they are reasonably - // quick to evaluate... - // - case 8: - { - // - // Newton-Raphson iteration of a polynomial case, - // choice of seed value is taken from Shaw's online - // supplement: - // - static const T c8 = 0.85994765706259820318168359251872L; - T a = 4 * (u - u * u); //1 - 4 * (u - 0.5f) * (u - 0.5f); - T b = pow(a, T(1) / 4); - T p = 8 * (1 + c8 * (1 / b - 1)); - T p0 = p; - do{ - T p5 = p * p; - p5 *= p5 * p; - p0 = p; - // Next term is given by Eq 42: - p = 2 * (3 * p + (640 * (160 + p * (24 + p * (p + 4)))) / (-5120 + p * (-2048 - 960 * p + a * p5))) / 7; - }while(fabs((p - p0) / p) > tolerance); - // - // Use Eq 45 to extract the result: - // - p = sqrt(p - df); - result = (u - 0.5f) < 0 ? -p : p; - break; - } - case 10: - { - // - // Newton-Raphson iteration of a polynomial case, - // choice of seed value is taken from Shaw's online - // supplement: - // - static const T c10 = 0.86781292867813396759105692122285L; - T a = 4 * (u - u * u); //1 - 4 * (u - 0.5f) * (u - 0.5f); - T b = pow(a, T(1) / 5); - T p = 10 * (1 + c10 * (1 / b - 1)); - T p0; - do{ - T p6 = p * p; - p6 *= p6 * p6; - p0 = p; - // Next term given by Eq 43: - p = (8 * p) / 9 + (218750 * (21875 + 4 * p * (625 + p * (75 + 2 * p * (5 + p))))) / - (9 * (-68359375 + 8 * p * (-2343750 + p * (-546875 - 175000 * p + 8 * a * p6)))); - }while(fabs((p - p0) / p) > tolerance); - // - // Use Eq 45 to extract the result: - // - p = sqrt(p - df); - result = (u - 0.5f) < 0 ? -p : p; - break; - } -#endif - default: - goto calculate_real; - } - } - else - { -calculate_real: - if(df < 3) - { - // - // Use a roughly linear scheme to choose between Shaw's - // tail series and body series: - // - T crossover = 0.2742f - df * 0.0242143f; - if(u > crossover) - { - result = boost::math::detail::inverse_students_t_body_series(df, u, l); - } - else - { - result = boost::math::detail::inverse_students_t_tail_series(df, u, v, l); - } - } - else - { - // - // Use Hill's method except in the exteme tails - // where we use Shaw's tail series. - // The crossover point is roughly exponential in -df: - // - T crossover = ldexp(1.0f, tools::real_cast(df / -0.654f)); - if(u > crossover) - { - result = boost::math::detail::inverse_students_t_hill(df, u); - } - else - { - result = boost::math::detail::inverse_students_t_tail_series(df, u, v, l); - } - } - } - return invert ? -result : result; -} - -template -inline T estimate_ibeta_inv_from_t_dist(T a, T p, T q, T* py, const L& l) -{ - T u = (p > q) ? 0.5f - q / 2 : p / 2; - T v = 1 - u; // u < 0.5 so no cancellation error - T df = a * 2; - T t = boost::math::detail::inverse_students_t(df, u, v, l); - T x = df / (df + t * t); - *py = t * t / (df + t * t); - return x; -} - -template -inline T fast_students_t_quantile_imp(T df, T p, const L& l, const mpl::false_*) -{ - using namespace std; - // - // Need to use inverse incomplete beta to get - // required precision so not so fast: - // - T probability = (p > 0.5) ? 1 - p : p; - T t, x, y; - x = ibeta_inv(df / 2, T(0.5), 2 * probability, &y); - if(df * y > tools::max_value() * x) - t = tools::overflow_error(BOOST_CURRENT_FUNCTION); - else - t = sqrt(df * y / x); - // - // Figure out sign based on the size of p: - // - if(p < 0.5) - t = -t; - return t; -} - -template -T fast_students_t_quantile_imp(T df, T p, const L& l, const mpl::true_*) -{ - using namespace std; - bool invert = false; - if((df < 2) && (floor(df) != df)) - return boost::math::detail::fast_students_t_quantile_imp(df, p, l, static_cast(0)); - if(p > 0.5) - { - p = 1 - p; - invert = true; - } - // - // Get an estimate of the result: - // - bool exact; - T t = inverse_students_t(df, p, 1-p, l, &exact); - if((t == 0) || exact) - return invert ? -t : t; // can't do better! - // - // Change variables to inverse incomplete beta: - // - T t2 = t * t; - T xb = df / (df + t2); - T y = t2 / (df + t2); - T a = df / 2; - // - // t can be so large that x underflows, - // just return our estimate in that case: - // - if(xb == 0) - return t; - // - // Get incomplete beta and it's derivative: - // - T f1; - T f0 = xb < y ? ibeta_imp(a, constants::half(), xb, l, false, true, &f1) - : ibeta_imp(constants::half(), a, y, l, true, true, &f1); - - // Get cdf from incomplete beta result: - T p0 = f0 / 2 - p; - // Get pdf from derivative: - T p1 = f1 * sqrt(y * xb * xb * xb / df); - // - // Second derivative divided by p1: - // - // yacas gives: - // - // In> PrettyForm(Simplify(D(t) (1 + t^2/v) ^ (-(v+1)/2))) - // - // | | v + 1 | | - // | -| ----- + 1 | | - // | | 2 | | - // -| | 2 | | - // | | t | | - // | | -- + 1 | | - // | ( v + 1 ) * | v | * t | - // --------------------------------------------- - // v - // - // Which after some manipulation is: - // - // -p1 * t * (df + 1) / (t^2 + df) - // - T p2 = t * (df + 1) / (t * t + df); - // Halley step: - t = fabs(t); - t += p0 / (p1 + p0 * p2 / 2); - return !invert ? -t : t; -} - -template -inline T fast_students_t_quantile(T df, T p) -{ - typedef typename lanczos::lanczos_traits::value_type value_type; - typedef typename lanczos::lanczos_traits::evaluation_type evaluation_type; - typedef mpl::bool_< - (std::numeric_limits::digits <= 53) - && - (std::numeric_limits::is_specialized)> tag_type; - return tools::checked_narrowing_cast(fast_students_t_quantile_imp(static_cast(df), static_cast(p), evaluation_type(), static_cast(0)), BOOST_CURRENT_FUNCTION); -} - -}}} // namespaces - -#endif // BOOST_MATH_SF_DETAIL_INV_T_HPP +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_MATH_SF_DETAIL_INV_T_HPP +#define BOOST_MATH_SF_DETAIL_INV_T_HPP + +#include + +namespace boost{ namespace math{ namespace detail{ + +// +// The main method used is due to Hill: +// +// G. W. Hill, Algorithm 396, Student’s t-Quantiles, +// Communications of the ACM, 13(10): 619-620, Oct., 1970. +// +template +T inverse_students_t_hill(T ndf, T u) +{ + using namespace std; + BOOST_ASSERT(u <= 0.5); + + T a, b, c, d, q, x, y; + + if (ndf > 1e20f) + return -boost::math::erfc_inv(2 * u) * constants::root_two(); + + a = 1 / (ndf - 0.5f); + b = 48 / (a * a); + c = ((20700 * a / b - 98) * a - 16) * a + 96.36f; + d = ((94.5f / (b + c) - 3) / b + 1) * sqrt(a * constants::pi() / 2) * ndf; + y = pow(d * 2 * u, 2 / ndf); + + if (y > (0.05f + a)) + { + // + // Asymptotic inverse expansion about normal: + // + x = -boost::math::erfc_inv(2 * u) * constants::root_two(); + y = x * x; + + if (ndf < 5) + c += 0.3f * (ndf - 4.5f) * (x + 0.6f); + c += (((0.05f * d * x - 5) * x - 7) * x - 2) * x + b; + y = (((((0.4f * y + 6.3f) * y + 36) * y + 94.5f) / c - y - 3) / b + 1) * x; + y = boost::math::expm1(a * y * y); + } + else + { + y = ((1 / (((ndf + 6) / (ndf * y) - 0.089f * d - 0.822f) + * (ndf + 2) * 3) + 0.5 / (ndf + 4)) * y - 1) + * (ndf + 1) / (ndf + 2) + 1 / y; + } + q = sqrt(ndf * y); + + return -q; +} +// +// Tail and body series are due to Shaw: +// +// www.mth.kcl.ac.uk/˜shaww/web_page/papers/Tdistribution06.pdf +// +// Shaw, W.T., 2006, "Sampling Student’s T distribution – use of +// the inverse cumulative distribution function." +// Journal of Computational Finance, Vol 9 Issue 4, pp 37-73, Summer 2006 +// +template +T inverse_students_t_tail_series(T df, T v, T u, const L& l) +{ + using namespace std; + // Tail series expansion, see section 6 of Shaw's paper. + // w is calculated using Eq 60: + T w = detail::tgamma_delta_ratio_imp(df / 2, constants::half(), l) + * sqrt(df * constants::pi()) * v; + // define some variables: + T np2 = df + 2; + T np4 = df + 4; + T np6 = df + 6; + // + // Calculate the coefficients d(k), these depend only on the + // number of degrees of freedom df, so at least in theory + // we could tabulate these for fixed df, see p15 of Shaw: + // + T d[7] = { 1, }; + d[1] = -(df + 1) / (2 * np2); + np2 *= (df + 2); + d[2] = -df * (df + 1) * (df + 3) / (8 * np2 * np4); + np2 *= df + 2; + d[3] = -df * (df + 1) * (df + 5) * (((3 * df) + 7) * df -2) / (48 * np2 * np4 * np6); + np2 *= (df + 2); + np4 *= (df + 4); + d[4] = -df * (df + 1) * (df + 7) * + ( (((((15 * df) + 154) * df + 465) * df + 286) * df - 336) * df + 64 ) + / (384 * np2 * np4 * np6 * (df + 8)); + np2 *= (df + 2); + d[5] = -df * (df + 1) * (df + 3) * (df + 9) + * (((((((35 * df + 452) * df + 1573) * df + 600) * df - 2020) * df) + 928) * df -128) + / (1280 * np2 * np4 * np6 * (df + 8) * (df + 10)); + np2 *= (df + 2); + np4 *= (df + 4); + np6 *= (df + 6); + d[6] = -df * (df + 1) * (df + 11) + * ((((((((((((945 * df) + 31506) * df + 425858) * df + 2980236) * df + 11266745) * df + 20675018) * df + 7747124) * df - 22574632) * df - 8565600) * df + 18108416) * df - 7099392) * df + 884736) + / (46080 * np2 * np4 * np6 * (df + 8) * (df + 10) * (df +12)); + // + // Now bring everthing together to provide the result, + // this is Eq 62 of Shaw: + // + T rn = sqrt(df); + T div = pow(rn * w, 1 / df); + T power = div * div; + T result = tools::evaluate_polynomial(d, power); + result *= rn; + result /= div; + return -result; +} + +template +T inverse_students_t_body_series(T df, T u, const L& l) +{ + using namespace std; + // + // Body series for small N: + // + // Start with Eq 56 of Shaw: + // + T v = detail::tgamma_delta_ratio_imp(df / 2, constants::half(), l) + * sqrt(df * constants::pi()) * (u - constants::half()); + // + // Workspace for the polynomial coefficients: + // + T c[11] = { 0, 1, }; + // + // Figure out what the coefficients are, note these depend + // only on the degrees of freedom (Eq 57 of Shaw): + // + c[2] = T(1) / 6 + T(1) / (6 * df); + T in = 1 / df; + c[3] = (((T(1) / 120) * in) + (T(1) / 15)) * in + (T(7) / 120); + c[4] = ((((T(1) / 5040) * in + (T(1) / 560)) * in + (T(3) / 112)) * in + T(127) / 5040); + c[5] = ((((T(1) / 362880) * in + (T(17) / 45360)) * in + (T(67) / 60480)) * in + (T(479) / 45360)) * in + (T(4369) / 362880); + c[6] = ((((((T(1) / 39916800) * in + (T(2503) / 39916800)) * in + (T(11867) / 19958400)) * in + (T(1285) / 798336)) * in + (T(153161) / 39916800)) * in + (T(34807) / 5702400)); + c[7] = (((((((T(1) / 6227020800LL) * in + (T(37) / 2402400)) * in + + (T(339929) / 2075673600LL)) * in + (T(67217) / 97297200)) * in + + (T(870341) / 691891200LL)) * in + (T(70691) / 64864800LL)) * in + + (T(20036983LL) / 6227020800LL)); + c[8] = (((((((T(1) / 1307674368000LL) * in + (T(1042243LL) / 261534873600LL)) * in + + (T(21470159) / 435891456000LL)) * in + (T(326228899LL) / 1307674368000LL)) * in + + (T(843620579) / 1307674368000LL)) * in + (T(332346031LL) / 435891456000LL)) * in + + (T(43847599) / 1307674368000LL)) * in + (T(2280356863LL) / 1307674368000LL); + c[9] = (((((((((T(1) / 355687428096000LL)) * in + (T(24262727LL) / 22230464256000LL)) * in + + (T(123706507LL) / 8083805184000LL)) * in + (T(404003599LL) / 4446092851200LL)) * in + + (T(51811946317LL) / 177843714048000LL)) * in + (T(91423417LL) / 177843714048LL)) * in + + (T(32285445833LL) / 88921857024000LL)) * in + (T(531839683LL) / 1710035712000LL)) * in + + (T(49020204823LL) / 50812489728000LL); + c[10] = (((((((((T(1) / 121645100408832000LL) * in + + (T(4222378423LL) / 13516122267648000LL)) * in + + (T(49573465457LL) / 10137091700736000LL)) * in + + (T(176126809LL) / 5304600576000LL)) * in + + (T(44978231873LL) / 355687428096000LL)) * in + + (T(5816850595639LL) / 20274183401472000LL)) * in + + (T(73989712601LL) / 206879422464000LL)) * in + + (T(26591354017LL) / 259925428224000LL)) * in + + (T(14979648446341LL) / 40548366802944000LL)) * in + + (T(65967241200001LL) / 121645100408832000LL); + // + // The result is then a polynomial in v (see Eq 56 of Shaw): + // + return tools::evaluate_odd_polynomial(c, v); +} + +template +T inverse_students_t(T df, T u, T v, const L& l, bool* pexact = 0) +{ + // + // df = number of degrees of freedom. + // u = probablity. + // v = 1 - u. + // l = lanczos type to use. + // + using namespace std; + bool invert = false; + T result = 0; + if(pexact) + *pexact = false; + if(u > v) + { + // function is symmetric, invert it: + std::swap(u, v); + invert = true; + } + if((floor(df) == df) && (df < 20)) + { + // + // we have integer degrees of freedom, try for the special + // cases first: + // + T tolerance = ldexp(1.0f, (2 * tools::digits()) / 3); + + switch(boost::math::tools::real_cast(df)) + { + case 1: + { + // + // df = 1 is the same as the Cauchy distribution, see + // Shaw Eq 35: + // + // FIXME: fails when u is small!!! + result = tan(constants::pi() * (u - constants::half())); + if(u == 0.5) + result = 0; + else + result = -cos(constants::pi() * u) / sin(constants::pi() * u); + if(pexact) + *pexact = true; + break; + } + case 2: + { + // + // df = 2 has an exact result, see Shaw Eq 36: + // + result =(2 * u - 1) / sqrt(2 * u * v); + if(pexact) + *pexact = true; + break; + } + case 4: + { + // + // df = 4 has an exact result, see Shaw Eq 38 & 39: + // + T alpha = 4 * u * v; + T root_alpha = sqrt(alpha); + T r = 4 * cos(acos(root_alpha) / 3) / root_alpha; + T x = sqrt(r - 4); + result = u - 0.5f < 0 ? -x : x; + if(pexact) + *pexact = true; + break; + } + case 6: + { + // + // We get numeric overflow in this area: + // + if(u < 1e-150) + return (invert ? -1 : 1) * inverse_students_t_hill(df, u); + // + // Newton-Raphson iteration of a polynomial case, + // choice of seed value is taken from Shaw's online + // supplement: + // + T a = 4 * (u - u * u);//1 - 4 * (u - 0.5f) * (u - 0.5f); + T b = boost::math::cbrt(a); + static const T c = 0.85498797333834849467655443627193L; + T p = 6 * (1 + c * (1 / b - 1)); + T p0; + do{ + T p2 = p * p; + T p4 = p2 * p2; + T p5 = p * p4; + p0 = p; + // next term is given by Eq 41: + p = 2 * (8 * a * p5 - 270 * p2 + 2187) / (5 * (4 * a * p4 - 216 * p - 243)); + }while(fabs((p - p0) / p) > tolerance); + // + // Use Eq 45 to extract the result: + // + p = sqrt(p - df); + result = (u - 0.5f) < 0 ? -p : p; + break; + } +#if 0 + // + // These are Shaw's "exact" but iterative solutions + // for even df, the numerical accuracy of these is + // rather less than Hill's method, so these are disabled + // for now, which is a shame because they are reasonably + // quick to evaluate... + // + case 8: + { + // + // Newton-Raphson iteration of a polynomial case, + // choice of seed value is taken from Shaw's online + // supplement: + // + static const T c8 = 0.85994765706259820318168359251872L; + T a = 4 * (u - u * u); //1 - 4 * (u - 0.5f) * (u - 0.5f); + T b = pow(a, T(1) / 4); + T p = 8 * (1 + c8 * (1 / b - 1)); + T p0 = p; + do{ + T p5 = p * p; + p5 *= p5 * p; + p0 = p; + // Next term is given by Eq 42: + p = 2 * (3 * p + (640 * (160 + p * (24 + p * (p + 4)))) / (-5120 + p * (-2048 - 960 * p + a * p5))) / 7; + }while(fabs((p - p0) / p) > tolerance); + // + // Use Eq 45 to extract the result: + // + p = sqrt(p - df); + result = (u - 0.5f) < 0 ? -p : p; + break; + } + case 10: + { + // + // Newton-Raphson iteration of a polynomial case, + // choice of seed value is taken from Shaw's online + // supplement: + // + static const T c10 = 0.86781292867813396759105692122285L; + T a = 4 * (u - u * u); //1 - 4 * (u - 0.5f) * (u - 0.5f); + T b = pow(a, T(1) / 5); + T p = 10 * (1 + c10 * (1 / b - 1)); + T p0; + do{ + T p6 = p * p; + p6 *= p6 * p6; + p0 = p; + // Next term given by Eq 43: + p = (8 * p) / 9 + (218750 * (21875 + 4 * p * (625 + p * (75 + 2 * p * (5 + p))))) / + (9 * (-68359375 + 8 * p * (-2343750 + p * (-546875 - 175000 * p + 8 * a * p6)))); + }while(fabs((p - p0) / p) > tolerance); + // + // Use Eq 45 to extract the result: + // + p = sqrt(p - df); + result = (u - 0.5f) < 0 ? -p : p; + break; + } +#endif + default: + goto calculate_real; + } + } + else + { +calculate_real: + if(df < 3) + { + // + // Use a roughly linear scheme to choose between Shaw's + // tail series and body series: + // + T crossover = 0.2742f - df * 0.0242143f; + if(u > crossover) + { + result = boost::math::detail::inverse_students_t_body_series(df, u, l); + } + else + { + result = boost::math::detail::inverse_students_t_tail_series(df, u, v, l); + } + } + else + { + // + // Use Hill's method except in the exteme tails + // where we use Shaw's tail series. + // The crossover point is roughly exponential in -df: + // + T crossover = ldexp(1.0f, tools::real_cast(df / -0.654f)); + if(u > crossover) + { + result = boost::math::detail::inverse_students_t_hill(df, u); + } + else + { + result = boost::math::detail::inverse_students_t_tail_series(df, u, v, l); + } + } + } + return invert ? -result : result; +} + +template +inline T estimate_ibeta_inv_from_t_dist(T a, T p, T q, T* py, const L& l) +{ + T u = (p > q) ? 0.5f - q / 2 : p / 2; + T v = 1 - u; // u < 0.5 so no cancellation error + T df = a * 2; + T t = boost::math::detail::inverse_students_t(df, u, v, l); + T x = df / (df + t * t); + *py = t * t / (df + t * t); + return x; +} + +template +inline T fast_students_t_quantile_imp(T df, T p, const L& l, const mpl::false_*) +{ + using namespace std; + // + // Need to use inverse incomplete beta to get + // required precision so not so fast: + // + T probability = (p > 0.5) ? 1 - p : p; + T t, x, y; + x = ibeta_inv(df / 2, T(0.5), 2 * probability, &y); + if(df * y > tools::max_value() * x) + t = tools::overflow_error(BOOST_CURRENT_FUNCTION); + else + t = sqrt(df * y / x); + // + // Figure out sign based on the size of p: + // + if(p < 0.5) + t = -t; + return t; +} + +template +T fast_students_t_quantile_imp(T df, T p, const L& l, const mpl::true_*) +{ + using namespace std; + bool invert = false; + if((df < 2) && (floor(df) != df)) + return boost::math::detail::fast_students_t_quantile_imp(df, p, l, static_cast(0)); + if(p > 0.5) + { + p = 1 - p; + invert = true; + } + // + // Get an estimate of the result: + // + bool exact; + T t = inverse_students_t(df, p, 1-p, l, &exact); + if((t == 0) || exact) + return invert ? -t : t; // can't do better! + // + // Change variables to inverse incomplete beta: + // + T t2 = t * t; + T xb = df / (df + t2); + T y = t2 / (df + t2); + T a = df / 2; + // + // t can be so large that x underflows, + // just return our estimate in that case: + // + if(xb == 0) + return t; + // + // Get incomplete beta and it's derivative: + // + T f1; + T f0 = xb < y ? ibeta_imp(a, constants::half(), xb, l, false, true, &f1) + : ibeta_imp(constants::half(), a, y, l, true, true, &f1); + + // Get cdf from incomplete beta result: + T p0 = f0 / 2 - p; + // Get pdf from derivative: + T p1 = f1 * sqrt(y * xb * xb * xb / df); + // + // Second derivative divided by p1: + // + // yacas gives: + // + // In> PrettyForm(Simplify(D(t) (1 + t^2/v) ^ (-(v+1)/2))) + // + // | | v + 1 | | + // | -| ----- + 1 | | + // | | 2 | | + // -| | 2 | | + // | | t | | + // | | -- + 1 | | + // | ( v + 1 ) * | v | * t | + // --------------------------------------------- + // v + // + // Which after some manipulation is: + // + // -p1 * t * (df + 1) / (t^2 + df) + // + T p2 = t * (df + 1) / (t * t + df); + // Halley step: + t = fabs(t); + t += p0 / (p1 + p0 * p2 / 2); + return !invert ? -t : t; +} + +template +inline T fast_students_t_quantile(T df, T p) +{ + typedef typename lanczos::lanczos_traits::value_type value_type; + typedef typename lanczos::lanczos_traits::evaluation_type evaluation_type; + typedef mpl::bool_< + (std::numeric_limits::digits <= 53) + && + (std::numeric_limits::is_specialized)> tag_type; + return tools::checked_narrowing_cast(fast_students_t_quantile_imp(static_cast(df), static_cast(p), evaluation_type(), static_cast(0)), BOOST_CURRENT_FUNCTION); +} + +}}} // namespaces + +#endif // BOOST_MATH_SF_DETAIL_INV_T_HPP diff --git a/include/boost/math/tools/detail/polynomial_horner1_10.hpp b/include/boost/math/tools/detail/polynomial_horner1_10.hpp index 014259759..ffc3a6804 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_10.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_10.hpp @@ -1,84 +1,84 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_10_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_10_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_10_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_10_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_11.hpp b/include/boost/math/tools/detail/polynomial_horner1_11.hpp index 2471952ca..8e2232c53 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_11.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_11.hpp @@ -1,90 +1,90 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_11_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_11_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_11_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_11_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_12.hpp b/include/boost/math/tools/detail/polynomial_horner1_12.hpp index 9704c1b15..07d2947c9 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_12.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_12.hpp @@ -1,96 +1,96 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_12_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_12_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_12_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_12_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_13.hpp b/include/boost/math/tools/detail/polynomial_horner1_13.hpp index a2553a827..d826b5150 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_13.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_13.hpp @@ -1,102 +1,102 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_13_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_13_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_13_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_13_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_14.hpp b/include/boost/math/tools/detail/polynomial_horner1_14.hpp index f9931f762..02b23ada5 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_14.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_14.hpp @@ -1,108 +1,108 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_14_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_14_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_14_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_14_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_15.hpp b/include/boost/math/tools/detail/polynomial_horner1_15.hpp index 9189da868..72cbbd298 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_15.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_15.hpp @@ -1,114 +1,114 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_15_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_15_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_15_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_15_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_16.hpp b/include/boost/math/tools/detail/polynomial_horner1_16.hpp index cede01859..39202e001 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_16.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_16.hpp @@ -1,120 +1,120 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_16_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_16_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_16_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_16_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_17.hpp b/include/boost/math/tools/detail/polynomial_horner1_17.hpp index a2d81133a..a777ab76b 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_17.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_17.hpp @@ -1,126 +1,126 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_17_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_17_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) -{ - return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_17_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_17_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) +{ + return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_18.hpp b/include/boost/math/tools/detail/polynomial_horner1_18.hpp index 44bcd0f1b..57e171c6b 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_18.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_18.hpp @@ -1,132 +1,132 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_18_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_18_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) -{ - return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) -{ - return static_cast(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_18_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_18_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) +{ + return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) +{ + return static_cast(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_19.hpp b/include/boost/math/tools/detail/polynomial_horner1_19.hpp index b002b090e..f2e893d65 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_19.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_19.hpp @@ -1,138 +1,138 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_19_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_19_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) -{ - return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) -{ - return static_cast(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) -{ - return static_cast((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_19_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_19_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) +{ + return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) +{ + return static_cast(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) +{ + return static_cast((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_2.hpp b/include/boost/math/tools/detail/polynomial_horner1_2.hpp index 2ef35e1d5..cf2af8ec2 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_2.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_2.hpp @@ -1,36 +1,36 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_2_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_2_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_2_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_2_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_20.hpp b/include/boost/math/tools/detail/polynomial_horner1_20.hpp index 552550032..6cd2fa2ca 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_20.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_20.hpp @@ -1,144 +1,144 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_20_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_20_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) -{ - return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) -{ - return static_cast(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) -{ - return static_cast((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<20>*) -{ - return static_cast(((((((((((((((((((a[19] * x + a[18]) * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_20_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_20_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + return static_cast(((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + return static_cast((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + return static_cast(((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + return static_cast(((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + return static_cast((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + return static_cast(((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) +{ + return static_cast((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) +{ + return static_cast(((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) +{ + return static_cast((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<20>*) +{ + return static_cast(((((((((((((((((((a[19] * x + a[18]) * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_3.hpp b/include/boost/math/tools/detail/polynomial_horner1_3.hpp index bf1036d0a..34283d1cf 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_3.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_3.hpp @@ -1,42 +1,42 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_3_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_3_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_3_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_3_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_4.hpp b/include/boost/math/tools/detail/polynomial_horner1_4.hpp index 81340ebb7..7a06708e0 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_4.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_4.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_4_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_4_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_4_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_4_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_5.hpp b/include/boost/math/tools/detail/polynomial_horner1_5.hpp index 50ba7bd76..135e155ec 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_5.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_5.hpp @@ -1,54 +1,54 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_5_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_5_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_5_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_5_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_6.hpp b/include/boost/math/tools/detail/polynomial_horner1_6.hpp index 3f6d7e928..af993517c 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_6.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_6.hpp @@ -1,60 +1,60 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_6_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_6_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_6_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_6_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_7.hpp b/include/boost/math/tools/detail/polynomial_horner1_7.hpp index 3091f1fcb..9205f2efa 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_7.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_7.hpp @@ -1,66 +1,66 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_7_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_7_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_7_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_7_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_8.hpp b/include/boost/math/tools/detail/polynomial_horner1_8.hpp index f3ffd22f8..70afa9008 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_8.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_8.hpp @@ -1,72 +1,72 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_8_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_8_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_8_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_8_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner1_9.hpp b/include/boost/math/tools/detail/polynomial_horner1_9.hpp index 87e3869ce..b823f24b5 100644 --- a/include/boost/math/tools/detail/polynomial_horner1_9.hpp +++ b/include/boost/math/tools/detail/polynomial_horner1_9.hpp @@ -1,78 +1,78 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_9_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_9_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_9_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_9_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + return static_cast((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + return static_cast(((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + return static_cast((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + return static_cast(((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + return static_cast((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_10.hpp b/include/boost/math/tools/detail/polynomial_horner2_10.hpp index 512e27d83..0474d7e3e 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_10.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_10.hpp @@ -1,90 +1,90 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_10_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_10_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_10_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_10_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_11.hpp b/include/boost/math/tools/detail/polynomial_horner2_11.hpp index 6349c894f..6fd1ea99e 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_11.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_11.hpp @@ -1,97 +1,97 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_11_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_11_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_11_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_11_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_12.hpp b/include/boost/math/tools/detail/polynomial_horner2_12.hpp index 02fabebbd..c6615c7ac 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_12.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_12.hpp @@ -1,104 +1,104 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_12_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_12_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_12_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_12_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_13.hpp b/include/boost/math/tools/detail/polynomial_horner2_13.hpp index 66c421a5f..02f4136b7 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_13.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_13.hpp @@ -1,111 +1,111 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_13_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_13_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_13_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_13_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_14.hpp b/include/boost/math/tools/detail/polynomial_horner2_14.hpp index dab8375fd..34d27cc9f 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_14.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_14.hpp @@ -1,118 +1,118 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_14_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_14_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_14_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_14_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_15.hpp b/include/boost/math/tools/detail/polynomial_horner2_15.hpp index a4ce91b8a..a1615243f 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_15.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_15.hpp @@ -1,125 +1,125 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_15_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_15_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - V x2 = x * x; - return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_15_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_15_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + V x2 = x * x; + return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_16.hpp b/include/boost/math/tools/detail/polynomial_horner2_16.hpp index e0a34352e..43a2679bf 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_16.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_16.hpp @@ -1,132 +1,132 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_16_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_16_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - V x2 = x * x; - return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - V x2 = x * x; - return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_16_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_16_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + V x2 = x * x; + return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + V x2 = x * x; + return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_17.hpp b/include/boost/math/tools/detail/polynomial_horner2_17.hpp index d355011c1..83dd92129 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_17.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_17.hpp @@ -1,139 +1,139 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_17_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_17_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - V x2 = x * x; - return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - V x2 = x * x; - return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) -{ - V x2 = x * x; - return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_17_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_17_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + V x2 = x * x; + return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + V x2 = x * x; + return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) +{ + V x2 = x * x; + return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_18.hpp b/include/boost/math/tools/detail/polynomial_horner2_18.hpp index e3eaae740..8a13a049e 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_18.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_18.hpp @@ -1,146 +1,146 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_18_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_18_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - V x2 = x * x; - return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - V x2 = x * x; - return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) -{ - V x2 = x * x; - return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) -{ - V x2 = x * x; - return static_cast(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_18_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_18_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + V x2 = x * x; + return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + V x2 = x * x; + return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) +{ + V x2 = x * x; + return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) +{ + V x2 = x * x; + return static_cast(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_19.hpp b/include/boost/math/tools/detail/polynomial_horner2_19.hpp index d37aba861..38e522634 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_19.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_19.hpp @@ -1,153 +1,153 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_19_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_19_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - V x2 = x * x; - return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - V x2 = x * x; - return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) -{ - V x2 = x * x; - return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) -{ - V x2 = x * x; - return static_cast(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) -{ - V x2 = x * x; - return static_cast(((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_19_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_19_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + V x2 = x * x; + return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + V x2 = x * x; + return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) +{ + V x2 = x * x; + return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) +{ + V x2 = x * x; + return static_cast(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) +{ + V x2 = x * x; + return static_cast(((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_2.hpp b/include/boost/math/tools/detail/polynomial_horner2_2.hpp index 606bb9809..5421d828c 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_2.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_2.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_2_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_2_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_2_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_2_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_20.hpp b/include/boost/math/tools/detail/polynomial_horner2_20.hpp index 052f8ae64..dd422705c 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_20.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_20.hpp @@ -1,160 +1,160 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_20_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_20_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - V x2 = x * x; - return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - V x2 = x * x; - return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) -{ - V x2 = x * x; - return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) -{ - V x2 = x * x; - return static_cast(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) -{ - V x2 = x * x; - return static_cast(((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<20>*) -{ - V x2 = x * x; - return static_cast((((((((((a[19] * x2 + a[17]) * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_20_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_20_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + return static_cast(((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + return static_cast(((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + return static_cast((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + return static_cast(((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + V x2 = x * x; + return static_cast(((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + V x2 = x * x; + return static_cast((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) +{ + V x2 = x * x; + return static_cast((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) +{ + V x2 = x * x; + return static_cast(((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) +{ + V x2 = x * x; + return static_cast(((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<20>*) +{ + V x2 = x * x; + return static_cast((((((((((a[19] * x2 + a[17]) * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_3.hpp b/include/boost/math/tools/detail/polynomial_horner2_3.hpp index 6beb79287..cd568ab79 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_3.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_3.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_3_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_3_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_3_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_3_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_4.hpp b/include/boost/math/tools/detail/polynomial_horner2_4.hpp index 7e226d84b..a99a695c7 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_4.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_4.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_4_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_4_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_4_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_4_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_5.hpp b/include/boost/math/tools/detail/polynomial_horner2_5.hpp index 9cd89f008..950568f9d 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_5.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_5.hpp @@ -1,55 +1,55 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_5_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_5_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_5_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_5_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_6.hpp b/include/boost/math/tools/detail/polynomial_horner2_6.hpp index aff9c58e2..b1035f503 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_6.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_6.hpp @@ -1,62 +1,62 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_6_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_6_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_6_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_6_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_7.hpp b/include/boost/math/tools/detail/polynomial_horner2_7.hpp index 886ae623e..0b167564d 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_7.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_7.hpp @@ -1,69 +1,69 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_7_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_7_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_7_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_7_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_8.hpp b/include/boost/math/tools/detail/polynomial_horner2_8.hpp index 1e57e9b62..ba92c21e2 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_8.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_8.hpp @@ -1,76 +1,76 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_8_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_8_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_8_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_8_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner2_9.hpp b/include/boost/math/tools/detail/polynomial_horner2_9.hpp index 0f41fd2a4..cc4afb38d 100644 --- a/include/boost/math/tools/detail/polynomial_horner2_9.hpp +++ b/include/boost/math/tools/detail/polynomial_horner2_9.hpp @@ -1,83 +1,83 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_9_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_9_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_9_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_9_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + return static_cast((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + return static_cast(((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + return static_cast(((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + return static_cast((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + return static_cast((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_10.hpp b/include/boost/math/tools/detail/polynomial_horner3_10.hpp index cbf166489..14b1b66f3 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_10.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_10.hpp @@ -1,156 +1,156 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_10_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_10_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[8] * x2 + a[6]); - t[1] = static_cast(a[7] * x2 + a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_10_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_10_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[8] * x2 + a[6]); + t[1] = static_cast(a[7] * x2 + a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_11.hpp b/include/boost/math/tools/detail/polynomial_horner3_11.hpp index 3adbfb389..690906938 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_11.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_11.hpp @@ -1,181 +1,181 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_11_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_11_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[8] * x2 + a[6]); - t[1] = static_cast(a[7] * x2 + a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[10] * x2 + a[8]); - t[1] = static_cast(a[9] * x2 + a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_11_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_11_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[8] * x2 + a[6]); + t[1] = static_cast(a[7] * x2 + a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[10] * x2 + a[8]); + t[1] = static_cast(a[9] * x2 + a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_12.hpp b/include/boost/math/tools/detail/polynomial_horner3_12.hpp index 6894a9d1a..d17d3c586 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_12.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_12.hpp @@ -1,208 +1,208 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_12_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_12_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[8] * x2 + a[6]); - t[1] = static_cast(a[7] * x2 + a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[10] * x2 + a[8]); - t[1] = static_cast(a[9] * x2 + a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_12_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_12_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[8] * x2 + a[6]); + t[1] = static_cast(a[7] * x2 + a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[10] * x2 + a[8]); + t[1] = static_cast(a[9] * x2 + a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_13.hpp b/include/boost/math/tools/detail/polynomial_horner3_13.hpp index 3472e6282..aff043bd1 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_13.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_13.hpp @@ -1,237 +1,237 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_13_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_13_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[8] * x2 + a[6]); - t[1] = static_cast(a[7] * x2 + a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[10] * x2 + a[8]); - t[1] = static_cast(a[9] * x2 + a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[12] * x2 + a[10]); - t[1] = static_cast(a[11] * x2 + a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_13_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_13_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[8] * x2 + a[6]); + t[1] = static_cast(a[7] * x2 + a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[10] * x2 + a[8]); + t[1] = static_cast(a[9] * x2 + a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[12] * x2 + a[10]); + t[1] = static_cast(a[11] * x2 + a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_14.hpp b/include/boost/math/tools/detail/polynomial_horner3_14.hpp index cbacac7e0..5ff2a51de 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_14.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_14.hpp @@ -1,268 +1,268 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_14_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_14_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[8] * x2 + a[6]); - t[1] = static_cast(a[7] * x2 + a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[10] * x2 + a[8]); - t[1] = static_cast(a[9] * x2 + a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[12] * x2 + a[10]); - t[1] = static_cast(a[11] * x2 + a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_14_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_14_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[8] * x2 + a[6]); + t[1] = static_cast(a[7] * x2 + a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[10] * x2 + a[8]); + t[1] = static_cast(a[9] * x2 + a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[12] * x2 + a[10]); + t[1] = static_cast(a[11] * x2 + a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_15.hpp b/include/boost/math/tools/detail/polynomial_horner3_15.hpp index abafcbc34..896545617 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_15.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_15.hpp @@ -1,301 +1,301 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_15_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_15_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[8] * x2 + a[6]); - t[1] = static_cast(a[7] * x2 + a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[10] * x2 + a[8]); - t[1] = static_cast(a[9] * x2 + a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[12] * x2 + a[10]); - t[1] = static_cast(a[11] * x2 + a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[14] * x2 + a[12]); - t[1] = static_cast(a[13] * x2 + a[11]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_15_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_15_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[8] * x2 + a[6]); + t[1] = static_cast(a[7] * x2 + a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[10] * x2 + a[8]); + t[1] = static_cast(a[9] * x2 + a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[12] * x2 + a[10]); + t[1] = static_cast(a[11] * x2 + a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[14] * x2 + a[12]); + t[1] = static_cast(a[13] * x2 + a[11]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_16.hpp b/include/boost/math/tools/detail/polynomial_horner3_16.hpp index 98a95c03e..5bfddc59a 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_16.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_16.hpp @@ -1,336 +1,336 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_16_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_16_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[8] * x2 + a[6]); - t[1] = static_cast(a[7] * x2 + a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[10] * x2 + a[8]); - t[1] = static_cast(a[9] * x2 + a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[12] * x2 + a[10]); - t[1] = static_cast(a[11] * x2 + a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[14] * x2 + a[12]); - t[1] = static_cast(a[13] * x2 + a[11]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[15] * x2 + a[13]; - t[1] = a[14] * x2 + a[12]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_16_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_16_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[8] * x2 + a[6]); + t[1] = static_cast(a[7] * x2 + a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[10] * x2 + a[8]); + t[1] = static_cast(a[9] * x2 + a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[12] * x2 + a[10]); + t[1] = static_cast(a[11] * x2 + a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[14] * x2 + a[12]); + t[1] = static_cast(a[13] * x2 + a[11]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[15] * x2 + a[13]; + t[1] = a[14] * x2 + a[12]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_17.hpp b/include/boost/math/tools/detail/polynomial_horner3_17.hpp index c61b83c03..d6679b392 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_17.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_17.hpp @@ -1,373 +1,373 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_17_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_17_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[8] * x2 + a[6]); - t[1] = static_cast(a[7] * x2 + a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[10] * x2 + a[8]); - t[1] = static_cast(a[9] * x2 + a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[12] * x2 + a[10]); - t[1] = static_cast(a[11] * x2 + a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[14] * x2 + a[12]); - t[1] = static_cast(a[13] * x2 + a[11]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[15] * x2 + a[13]; - t[1] = a[14] * x2 + a[12]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[16] * x2 + a[14]); - t[1] = static_cast(a[15] * x2 + a[13]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[11]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_17_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_17_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[8] * x2 + a[6]); + t[1] = static_cast(a[7] * x2 + a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[10] * x2 + a[8]); + t[1] = static_cast(a[9] * x2 + a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[12] * x2 + a[10]); + t[1] = static_cast(a[11] * x2 + a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[14] * x2 + a[12]); + t[1] = static_cast(a[13] * x2 + a[11]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[15] * x2 + a[13]; + t[1] = a[14] * x2 + a[12]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[16] * x2 + a[14]); + t[1] = static_cast(a[15] * x2 + a[13]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[11]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_18.hpp b/include/boost/math/tools/detail/polynomial_horner3_18.hpp index 317155719..df016a173 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_18.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_18.hpp @@ -1,412 +1,412 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_18_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_18_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[8] * x2 + a[6]); - t[1] = static_cast(a[7] * x2 + a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[10] * x2 + a[8]); - t[1] = static_cast(a[9] * x2 + a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[12] * x2 + a[10]); - t[1] = static_cast(a[11] * x2 + a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[14] * x2 + a[12]); - t[1] = static_cast(a[13] * x2 + a[11]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[15] * x2 + a[13]; - t[1] = a[14] * x2 + a[12]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[16] * x2 + a[14]); - t[1] = static_cast(a[15] * x2 + a[13]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[11]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[17] * x2 + a[15]; - t[1] = a[16] * x2 + a[14]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[13]); - t[1] += static_cast(a[12]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_18_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_18_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[8] * x2 + a[6]); + t[1] = static_cast(a[7] * x2 + a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[10] * x2 + a[8]); + t[1] = static_cast(a[9] * x2 + a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[12] * x2 + a[10]); + t[1] = static_cast(a[11] * x2 + a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[14] * x2 + a[12]); + t[1] = static_cast(a[13] * x2 + a[11]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[15] * x2 + a[13]; + t[1] = a[14] * x2 + a[12]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[16] * x2 + a[14]); + t[1] = static_cast(a[15] * x2 + a[13]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[11]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[17] * x2 + a[15]; + t[1] = a[16] * x2 + a[14]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[13]); + t[1] += static_cast(a[12]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_19.hpp b/include/boost/math/tools/detail/polynomial_horner3_19.hpp index d1aed0903..10adbe556 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_19.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_19.hpp @@ -1,453 +1,453 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_19_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_19_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[8] * x2 + a[6]); - t[1] = static_cast(a[7] * x2 + a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[10] * x2 + a[8]); - t[1] = static_cast(a[9] * x2 + a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[12] * x2 + a[10]); - t[1] = static_cast(a[11] * x2 + a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[14] * x2 + a[12]); - t[1] = static_cast(a[13] * x2 + a[11]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[15] * x2 + a[13]; - t[1] = a[14] * x2 + a[12]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[16] * x2 + a[14]); - t[1] = static_cast(a[15] * x2 + a[13]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[11]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[17] * x2 + a[15]; - t[1] = a[16] * x2 + a[14]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[13]); - t[1] += static_cast(a[12]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[18] * x2 + a[16]); - t[1] = static_cast(a[17] * x2 + a[15]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[13]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[11]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_19_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_19_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[8] * x2 + a[6]); + t[1] = static_cast(a[7] * x2 + a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[10] * x2 + a[8]); + t[1] = static_cast(a[9] * x2 + a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[12] * x2 + a[10]); + t[1] = static_cast(a[11] * x2 + a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[14] * x2 + a[12]); + t[1] = static_cast(a[13] * x2 + a[11]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[15] * x2 + a[13]; + t[1] = a[14] * x2 + a[12]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[16] * x2 + a[14]); + t[1] = static_cast(a[15] * x2 + a[13]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[11]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[17] * x2 + a[15]; + t[1] = a[16] * x2 + a[14]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[13]); + t[1] += static_cast(a[12]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[18] * x2 + a[16]); + t[1] = static_cast(a[17] * x2 + a[15]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[13]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[11]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_2.hpp b/include/boost/math/tools/detail/polynomial_horner3_2.hpp index f8c0d1bd4..b32501f0a 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_2.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_2.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_2_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_2_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_2_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_2_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_20.hpp b/include/boost/math/tools/detail/polynomial_horner3_20.hpp index 499352d1e..68bd0bead 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_20.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_20.hpp @@ -1,496 +1,496 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_20_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_20_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[8] * x2 + a[6]); - t[1] = static_cast(a[7] * x2 + a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[10] * x2 + a[8]); - t[1] = static_cast(a[9] * x2 + a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[12] * x2 + a[10]); - t[1] = static_cast(a[11] * x2 + a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[14] * x2 + a[12]); - t[1] = static_cast(a[13] * x2 + a[11]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[15] * x2 + a[13]; - t[1] = a[14] * x2 + a[12]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[16] * x2 + a[14]); - t[1] = static_cast(a[15] * x2 + a[13]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[11]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[17] * x2 + a[15]; - t[1] = a[16] * x2 + a[14]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[13]); - t[1] += static_cast(a[12]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[18] * x2 + a[16]); - t[1] = static_cast(a[17] * x2 + a[15]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[13]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[11]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<20>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[19] * x2 + a[17]; - t[1] = a[18] * x2 + a[16]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[15]); - t[1] += static_cast(a[14]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[13]); - t[1] += static_cast(a[12]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_20_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_20_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[8] * x2 + a[6]); + t[1] = static_cast(a[7] * x2 + a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[10] * x2 + a[8]); + t[1] = static_cast(a[9] * x2 + a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[12] * x2 + a[10]); + t[1] = static_cast(a[11] * x2 + a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<15>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[14] * x2 + a[12]); + t[1] = static_cast(a[13] * x2 + a[11]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<16>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[15] * x2 + a[13]; + t[1] = a[14] * x2 + a[12]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<17>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[16] * x2 + a[14]); + t[1] = static_cast(a[15] * x2 + a[13]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[11]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<18>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[17] * x2 + a[15]; + t[1] = a[16] * x2 + a[14]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[13]); + t[1] += static_cast(a[12]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<19>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[18] * x2 + a[16]); + t[1] = static_cast(a[17] * x2 + a[15]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[13]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[11]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<20>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[19] * x2 + a[17]; + t[1] = a[18] * x2 + a[16]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[15]); + t[1] += static_cast(a[14]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[13]); + t[1] += static_cast(a[12]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_3.hpp b/include/boost/math/tools/detail/polynomial_horner3_3.hpp index 66b8d3c3b..8296740a5 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_3.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_3.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_3_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_3_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_3_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_3_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_4.hpp b/include/boost/math/tools/detail/polynomial_horner3_4.hpp index 49917d76a..e6ba3179b 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_4.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_4.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_4_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_4_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_4_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_4_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_5.hpp b/include/boost/math/tools/detail/polynomial_horner3_5.hpp index 96d54f6c1..d4e94b90d 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_5.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_5.hpp @@ -1,61 +1,61 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_5_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_5_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_5_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_5_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_6.hpp b/include/boost/math/tools/detail/polynomial_horner3_6.hpp index 41f6c1f95..143defc63 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_6.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_6.hpp @@ -1,76 +1,76 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_6_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_6_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_6_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_6_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_7.hpp b/include/boost/math/tools/detail/polynomial_horner3_7.hpp index 695645b71..016895076 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_7.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_7.hpp @@ -1,93 +1,93 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_7_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_7_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_7_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_7_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_8.hpp b/include/boost/math/tools/detail/polynomial_horner3_8.hpp index 180d27d38..9a373446e 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_8.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_8.hpp @@ -1,112 +1,112 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_8_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_8_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_8_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_8_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/polynomial_horner3_9.hpp b/include/boost/math/tools/detail/polynomial_horner3_9.hpp index e47d610b9..d0f9dd310 100644 --- a/include/boost/math/tools/detail/polynomial_horner3_9.hpp +++ b/include/boost/math/tools/detail/polynomial_horner3_9.hpp @@ -1,133 +1,133 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Unrolled polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_EVAL_9_HPP -#define BOOST_MATH_TOOLS_POLY_EVAL_9_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) -{ - return static_cast(a[1] * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) -{ - return static_cast((a[2] * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) -{ - return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[4] * x2 + a[2]); - t[1] = static_cast(a[3] * x2 + a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[6] * x2 + a[4]); - t[1] = static_cast(a[5] * x2 + a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) -{ - V x2 = x * x; - V t[2]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[0] *= x; - return t[0] + t[1]; -} - -template -inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[8] * x2 + a[6]); - t[1] = static_cast(a[7] * x2 + a[5]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[0] *= x2; - t[1] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[0] *= x2; - t[0] += static_cast(a[0]); - t[1] *= x; - return t[0] + t[1]; -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Unrolled polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_EVAL_9_HPP +#define BOOST_MATH_TOOLS_POLY_EVAL_9_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) +{ + return static_cast(a[1] * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) +{ + return static_cast((a[2] * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) +{ + return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[4] * x2 + a[2]); + t[1] = static_cast(a[3] * x2 + a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[6] * x2 + a[4]); + t[1] = static_cast(a[5] * x2 + a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*) +{ + V x2 = x * x; + V t[2]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[0] *= x; + return t[0] + t[1]; +} + +template +inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[8] * x2 + a[6]); + t[1] = static_cast(a[7] * x2 + a[5]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[0] *= x2; + t[1] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[0] *= x2; + t[0] += static_cast(a[0]); + t[1] *= x; + return t[0] + t[1]; +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_10.hpp b/include/boost/math/tools/detail/rational_horner1_10.hpp index 10ae0f81b..919ba6d09 100644 --- a/include/boost/math/tools/detail/rational_horner1_10.hpp +++ b/include/boost/math/tools/detail/rational_horner1_10.hpp @@ -1,138 +1,138 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_10_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_10_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_10_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_10_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_11.hpp b/include/boost/math/tools/detail/rational_horner1_11.hpp index d8ca2acc4..e17bfbc72 100644 --- a/include/boost/math/tools/detail/rational_horner1_11.hpp +++ b/include/boost/math/tools/detail/rational_horner1_11.hpp @@ -1,150 +1,150 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_11_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_11_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_11_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_11_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_12.hpp b/include/boost/math/tools/detail/rational_horner1_12.hpp index 5530d14fb..67b430a99 100644 --- a/include/boost/math/tools/detail/rational_horner1_12.hpp +++ b/include/boost/math/tools/detail/rational_horner1_12.hpp @@ -1,162 +1,162 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_12_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_12_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_12_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_12_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_13.hpp b/include/boost/math/tools/detail/rational_horner1_13.hpp index bb0c263fe..33ae67523 100644 --- a/include/boost/math/tools/detail/rational_horner1_13.hpp +++ b/include/boost/math/tools/detail/rational_horner1_13.hpp @@ -1,174 +1,174 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_13_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_13_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_13_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_13_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_14.hpp b/include/boost/math/tools/detail/rational_horner1_14.hpp index 59d443832..0c5f1884c 100644 --- a/include/boost/math/tools/detail/rational_horner1_14.hpp +++ b/include/boost/math/tools/detail/rational_horner1_14.hpp @@ -1,186 +1,186 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_14_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_14_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_14_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_14_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_15.hpp b/include/boost/math/tools/detail/rational_horner1_15.hpp index 80e096602..848190761 100644 --- a/include/boost/math/tools/detail/rational_horner1_15.hpp +++ b/include/boost/math/tools/detail/rational_horner1_15.hpp @@ -1,198 +1,198 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_15_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_15_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_15_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_15_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_16.hpp b/include/boost/math/tools/detail/rational_horner1_16.hpp index def345fdf..e0661f8b3 100644 --- a/include/boost/math/tools/detail/rational_horner1_16.hpp +++ b/include/boost/math/tools/detail/rational_horner1_16.hpp @@ -1,210 +1,210 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_16_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_16_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_16_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_16_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_17.hpp b/include/boost/math/tools/detail/rational_horner1_17.hpp index 7e6c27765..f123da4c9 100644 --- a/include/boost/math/tools/detail/rational_horner1_17.hpp +++ b/include/boost/math/tools/detail/rational_horner1_17.hpp @@ -1,222 +1,222 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_17_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_17_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) -{ - if(x <= 1) - return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_17_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_17_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) +{ + if(x <= 1) + return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_18.hpp b/include/boost/math/tools/detail/rational_horner1_18.hpp index 34cfaadbf..718ace87f 100644 --- a/include/boost/math/tools/detail/rational_horner1_18.hpp +++ b/include/boost/math/tools/detail/rational_horner1_18.hpp @@ -1,234 +1,234 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_18_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_18_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) -{ - if(x <= 1) - return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) -{ - if(x <= 1) - return static_cast((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) / (((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_18_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_18_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) +{ + if(x <= 1) + return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) +{ + if(x <= 1) + return static_cast((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) / (((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_19.hpp b/include/boost/math/tools/detail/rational_horner1_19.hpp index bcbbd626d..c849ba8c0 100644 --- a/include/boost/math/tools/detail/rational_horner1_19.hpp +++ b/include/boost/math/tools/detail/rational_horner1_19.hpp @@ -1,246 +1,246 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_19_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_19_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) -{ - if(x <= 1) - return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) -{ - if(x <= 1) - return static_cast((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) / (((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) -{ - if(x <= 1) - return static_cast(((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((((b[18] * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) * z + a[18]) / ((((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]) * z + b[18])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_19_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_19_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) +{ + if(x <= 1) + return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) +{ + if(x <= 1) + return static_cast((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) / (((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) +{ + if(x <= 1) + return static_cast(((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((((b[18] * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) * z + a[18]) / ((((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]) * z + b[18])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_2.hpp b/include/boost/math/tools/detail/rational_horner1_2.hpp index 580e3b1f9..87e41ab3f 100644 --- a/include/boost/math/tools/detail/rational_horner1_2.hpp +++ b/include/boost/math/tools/detail/rational_horner1_2.hpp @@ -1,42 +1,42 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_2_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_2_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_2_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_2_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_20.hpp b/include/boost/math/tools/detail/rational_horner1_20.hpp index e3a43811d..e05eaaa89 100644 --- a/include/boost/math/tools/detail/rational_horner1_20.hpp +++ b/include/boost/math/tools/detail/rational_horner1_20.hpp @@ -1,258 +1,258 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_20_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_20_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) -{ - if(x <= 1) - return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) -{ - if(x <= 1) - return static_cast((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) / (((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) -{ - if(x <= 1) - return static_cast(((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((((b[18] * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) * z + a[18]) / ((((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]) * z + b[18])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<20>*) -{ - if(x <= 1) - return static_cast((((((((((((((((((((a[19] * x + a[18]) * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((((b[19] * x + b[18]) * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) * z + a[18]) * z + a[19]) / (((((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]) * z + b[18]) * z + b[19])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_20_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_20_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + return static_cast((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + return static_cast(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + return static_cast((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + return static_cast((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + return static_cast(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + return static_cast((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) +{ + if(x <= 1) + return static_cast(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) +{ + if(x <= 1) + return static_cast((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) / (((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) +{ + if(x <= 1) + return static_cast(((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((((b[18] * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) * z + a[18]) / ((((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]) * z + b[18])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<20>*) +{ + if(x <= 1) + return static_cast((((((((((((((((((((a[19] * x + a[18]) * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((((b[19] * x + b[18]) * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) * z + a[18]) * z + a[19]) / (((((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]) * z + b[18]) * z + b[19])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_3.hpp b/include/boost/math/tools/detail/rational_horner1_3.hpp index 02e9d4de9..ac1b785e9 100644 --- a/include/boost/math/tools/detail/rational_horner1_3.hpp +++ b/include/boost/math/tools/detail/rational_horner1_3.hpp @@ -1,54 +1,54 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_3_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_3_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_3_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_3_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_4.hpp b/include/boost/math/tools/detail/rational_horner1_4.hpp index 398b0ceea..eeced600f 100644 --- a/include/boost/math/tools/detail/rational_horner1_4.hpp +++ b/include/boost/math/tools/detail/rational_horner1_4.hpp @@ -1,66 +1,66 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_4_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_4_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_4_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_4_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_5.hpp b/include/boost/math/tools/detail/rational_horner1_5.hpp index 5b52df604..0479f6637 100644 --- a/include/boost/math/tools/detail/rational_horner1_5.hpp +++ b/include/boost/math/tools/detail/rational_horner1_5.hpp @@ -1,78 +1,78 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_5_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_5_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_5_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_5_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_6.hpp b/include/boost/math/tools/detail/rational_horner1_6.hpp index 4cb56ca7d..db259968e 100644 --- a/include/boost/math/tools/detail/rational_horner1_6.hpp +++ b/include/boost/math/tools/detail/rational_horner1_6.hpp @@ -1,90 +1,90 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_6_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_6_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_6_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_6_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_7.hpp b/include/boost/math/tools/detail/rational_horner1_7.hpp index 0eb1c0a31..b431fe91e 100644 --- a/include/boost/math/tools/detail/rational_horner1_7.hpp +++ b/include/boost/math/tools/detail/rational_horner1_7.hpp @@ -1,102 +1,102 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_7_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_7_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_7_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_7_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_8.hpp b/include/boost/math/tools/detail/rational_horner1_8.hpp index b01f03101..5a04a7a34 100644 --- a/include/boost/math/tools/detail/rational_horner1_8.hpp +++ b/include/boost/math/tools/detail/rational_horner1_8.hpp @@ -1,114 +1,114 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_8_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_8_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_8_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_8_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner1_9.hpp b/include/boost/math/tools/detail/rational_horner1_9.hpp index 764a8a733..4b5465fc4 100644 --- a/include/boost/math/tools/detail/rational_horner1_9.hpp +++ b/include/boost/math/tools/detail/rational_horner1_9.hpp @@ -1,126 +1,126 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using Horners rule -#ifndef BOOST_MATH_TOOLS_POLY_RAT_9_HPP -#define BOOST_MATH_TOOLS_POLY_RAT_9_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - if(x <= 1) - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); - else - { - V z = 1 / x; - return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - if(x <= 1) - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - if(x <= 1) - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using Horners rule +#ifndef BOOST_MATH_TOOLS_POLY_RAT_9_HPP +#define BOOST_MATH_TOOLS_POLY_RAT_9_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + if(x <= 1) + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); + else + { + V z = 1 / x; + return static_cast((a[0] * z + a[1]) / (b[0] * z + b[1])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + if(x <= 1) + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + if(x <= 1) + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + return static_cast(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + return static_cast((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + return static_cast(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + return static_cast((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + return static_cast(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_10.hpp b/include/boost/math/tools/detail/rational_horner2_10.hpp index 9f01b97ad..db752742d 100644 --- a/include/boost/math/tools/detail/rational_horner2_10.hpp +++ b/include/boost/math/tools/detail/rational_horner2_10.hpp @@ -1,144 +1,144 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_10_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_10_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_10_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_10_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_11.hpp b/include/boost/math/tools/detail/rational_horner2_11.hpp index 7fb99fb99..2b728e8b4 100644 --- a/include/boost/math/tools/detail/rational_horner2_11.hpp +++ b/include/boost/math/tools/detail/rational_horner2_11.hpp @@ -1,160 +1,160 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_11_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_11_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_11_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_11_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_12.hpp b/include/boost/math/tools/detail/rational_horner2_12.hpp index dc272ae77..daa14e4d2 100644 --- a/include/boost/math/tools/detail/rational_horner2_12.hpp +++ b/include/boost/math/tools/detail/rational_horner2_12.hpp @@ -1,176 +1,176 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_12_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_12_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_12_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_12_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_13.hpp b/include/boost/math/tools/detail/rational_horner2_13.hpp index 6e51de66b..e5dfc6228 100644 --- a/include/boost/math/tools/detail/rational_horner2_13.hpp +++ b/include/boost/math/tools/detail/rational_horner2_13.hpp @@ -1,192 +1,192 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_13_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_13_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_13_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_13_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_14.hpp b/include/boost/math/tools/detail/rational_horner2_14.hpp index 68e82675b..37ddfa5e6 100644 --- a/include/boost/math/tools/detail/rational_horner2_14.hpp +++ b/include/boost/math/tools/detail/rational_horner2_14.hpp @@ -1,208 +1,208 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_14_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_14_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_14_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_14_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_15.hpp b/include/boost/math/tools/detail/rational_horner2_15.hpp index 5c48a4826..9168b2efc 100644 --- a/include/boost/math/tools/detail/rational_horner2_15.hpp +++ b/include/boost/math/tools/detail/rational_horner2_15.hpp @@ -1,224 +1,224 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_15_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_15_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z)); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_15_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_15_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z)); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_16.hpp b/include/boost/math/tools/detail/rational_horner2_16.hpp index f3ab6e79c..7dafa460a 100644 --- a/include/boost/math/tools/detail/rational_horner2_16.hpp +++ b/include/boost/math/tools/detail/rational_horner2_16.hpp @@ -1,240 +1,240 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_16_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_16_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_16_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_16_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_17.hpp b/include/boost/math/tools/detail/rational_horner2_17.hpp index c975adde1..06330599d 100644 --- a/include/boost/math/tools/detail/rational_horner2_17.hpp +++ b/include/boost/math/tools/detail/rational_horner2_17.hpp @@ -1,256 +1,256 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_17_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_17_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16] + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16] + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z)); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_17_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_17_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16] + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16] + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z)); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_18.hpp b/include/boost/math/tools/detail/rational_horner2_18.hpp index d8513c0d7..78584e037 100644 --- a/include/boost/math/tools/detail/rational_horner2_18.hpp +++ b/include/boost/math/tools/detail/rational_horner2_18.hpp @@ -1,272 +1,272 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_18_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_18_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16] + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16] + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_18_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_18_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16] + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16] + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_19.hpp b/include/boost/math/tools/detail/rational_horner2_19.hpp index c8269f301..592e9edbc 100644 --- a/include/boost/math/tools/detail/rational_horner2_19.hpp +++ b/include/boost/math/tools/detail/rational_horner2_19.hpp @@ -1,288 +1,288 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_19_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_19_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16] + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16] + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((((b[18] * x2 + b[16]) * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z2 + a[18] + ((((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) * z) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z2 + b[18] + ((((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17]) * z)); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_19_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_19_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16] + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16] + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((((b[18] * x2 + b[16]) * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z2 + a[18] + ((((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) * z) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z2 + b[18] + ((((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17]) * z)); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_2.hpp b/include/boost/math/tools/detail/rational_horner2_2.hpp index 5373d144f..c5400a0d1 100644 --- a/include/boost/math/tools/detail/rational_horner2_2.hpp +++ b/include/boost/math/tools/detail/rational_horner2_2.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_2_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_2_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_2_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_2_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_20.hpp b/include/boost/math/tools/detail/rational_horner2_20.hpp index affba5158..7f8f5d6a0 100644 --- a/include/boost/math/tools/detail/rational_horner2_20.hpp +++ b/include/boost/math/tools/detail/rational_horner2_20.hpp @@ -1,304 +1,304 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_20_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_20_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16] + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16] + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((((b[18] * x2 + b[16]) * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z2 + a[18] + ((((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) * z) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z2 + b[18] + ((((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<20>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((((((a[19] * x2 + a[17]) * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((((b[19] * x2 + b[17]) * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((((b[18] * x2 + b[16]) * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z2 + a[18]) * z + ((((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) * z2 + a[19]) / ((((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z2 + b[18]) * z + ((((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17]) * z2 + b[19])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_20_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_20_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((a[9] * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((b[9] * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10] + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z) / (((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10] + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((a[10] * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((b[10] * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z + ((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z + ((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((a[13] * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((b[13] * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14] + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z) / (((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14] + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((a[14] * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((b[14] * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z + ((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z + ((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((((a[15] * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((((b[15] * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16] + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z) / ((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16] + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + (((((((a[16] * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / (((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + (((((((b[16] * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z + (((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z + (((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((((((((a[17] * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / (((((((((b[18] * x2 + b[16]) * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((((((((b[17] * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z2 + a[18] + ((((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) * z) / (((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z2 + b[18] + ((((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<20>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((((((a[19] * x2 + a[17]) * x2 + a[15]) * x2 + a[13]) * x2 + a[11]) * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((((((((a[18] * x2 + a[16]) * x2 + a[14]) * x2 + a[12]) * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((((((((b[19] * x2 + b[17]) * x2 + b[15]) * x2 + b[13]) * x2 + b[11]) * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((((((((b[18] * x2 + b[16]) * x2 + b[14]) * x2 + b[12]) * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12]) * z2 + a[14]) * z2 + a[16]) * z2 + a[18]) * z + ((((((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z2 + a[13]) * z2 + a[15]) * z2 + a[17]) * z2 + a[19]) / ((((((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12]) * z2 + b[14]) * z2 + b[16]) * z2 + b[18]) * z + ((((((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z2 + b[13]) * z2 + b[15]) * z2 + b[17]) * z2 + b[19])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_3.hpp b/include/boost/math/tools/detail/rational_horner2_3.hpp index f1897e145..645c3c364 100644 --- a/include/boost/math/tools/detail/rational_horner2_3.hpp +++ b/include/boost/math/tools/detail/rational_horner2_3.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_3_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_3_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_3_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_3_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_4.hpp b/include/boost/math/tools/detail/rational_horner2_4.hpp index e7d6ccd13..781b4c109 100644 --- a/include/boost/math/tools/detail/rational_horner2_4.hpp +++ b/include/boost/math/tools/detail/rational_horner2_4.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_4_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_4_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_4_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_4_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_5.hpp b/include/boost/math/tools/detail/rational_horner2_5.hpp index 76e614918..a11d0d643 100644 --- a/include/boost/math/tools/detail/rational_horner2_5.hpp +++ b/include/boost/math/tools/detail/rational_horner2_5.hpp @@ -1,64 +1,64 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_5_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_5_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_5_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_5_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_6.hpp b/include/boost/math/tools/detail/rational_horner2_6.hpp index fb525fe3a..596bc115c 100644 --- a/include/boost/math/tools/detail/rational_horner2_6.hpp +++ b/include/boost/math/tools/detail/rational_horner2_6.hpp @@ -1,80 +1,80 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_6_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_6_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_6_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_6_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_7.hpp b/include/boost/math/tools/detail/rational_horner2_7.hpp index 2bb083afe..28998d2c9 100644 --- a/include/boost/math/tools/detail/rational_horner2_7.hpp +++ b/include/boost/math/tools/detail/rational_horner2_7.hpp @@ -1,96 +1,96 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_7_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_7_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_7_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_7_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_8.hpp b/include/boost/math/tools/detail/rational_horner2_8.hpp index 3ef0a3ad3..1405c432f 100644 --- a/include/boost/math/tools/detail/rational_horner2_8.hpp +++ b/include/boost/math/tools/detail/rational_horner2_8.hpp @@ -1,112 +1,112 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_8_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_8_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_8_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_8_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner2_9.hpp b/include/boost/math/tools/detail/rational_horner2_9.hpp index 424909efe..5a537ef4e 100644 --- a/include/boost/math/tools/detail/rational_horner2_9.hpp +++ b/include/boost/math/tools/detail/rational_horner2_9.hpp @@ -1,128 +1,128 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_9_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_9_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_9_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_9_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((a[4] * x2 + a[2]) * x2 + a[0] + (a[3] * x2 + a[1]) * x) / ((b[4] * x2 + b[2]) * x2 + b[0] + (b[3] * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((a[0] * z2 + a[2]) * z2 + a[4] + (a[1] * z2 + a[3]) * z) / ((b[0] * z2 + b[2]) * z2 + b[4] + (b[1] * z2 + b[3]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[5] * x2 + a[3]) * x2 + a[1]) * x + (a[4] * x2 + a[2]) * x2 + a[0]) / (((b[5] * x2 + b[3]) * x2 + b[1]) * x + (b[4] * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z + (a[1] * z2 + a[3]) * z2 + a[5]) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z + (b[1] * z2 + b[3]) * z2 + b[5])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast((((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + ((a[5] * x2 + a[3]) * x2 + a[1]) * x) / (((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + ((b[5] * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6] + ((a[1] * z2 + a[3]) * z2 + a[5]) * z) / (((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6] + ((b[1] * z2 + b[3]) * z2 + b[5]) * z)); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x + ((a[6] * x2 + a[4]) * x2 + a[2]) * x2 + a[0]) / ((((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x + ((b[6] * x2 + b[4]) * x2 + b[2]) * x2 + b[0])); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z + ((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z + ((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7])); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((a[8] * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((a[7] * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((b[8] * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((b[7] * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8] + (((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z) / ((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8] + (((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z)); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_10.hpp b/include/boost/math/tools/detail/rational_horner3_10.hpp index 757fb091a..205077c2d 100644 --- a/include/boost/math/tools/detail/rational_horner3_10.hpp +++ b/include/boost/math/tools/detail/rational_horner3_10.hpp @@ -1,396 +1,396 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_10_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_10_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[8] * x2 + a[6]; - t[1] = a[7] * x2 + a[5]; - t[2] = b[8] * x2 + b[6]; - t[3] = b[7] * x2 + b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[8]); - t[2] += static_cast(b[8]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[2] = b[9] * x2 + b[7]; - t[3] = b[8] * x2 + b[6]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_10_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_10_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[8] * x2 + a[6]; + t[1] = a[7] * x2 + a[5]; + t[2] = b[8] * x2 + b[6]; + t[3] = b[7] * x2 + b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[8]); + t[2] += static_cast(b[8]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[2] = b[9] * x2 + b[7]; + t[3] = b[8] * x2 + b[6]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_11.hpp b/include/boost/math/tools/detail/rational_horner3_11.hpp index 26b7bab2d..05ed555c2 100644 --- a/include/boost/math/tools/detail/rational_horner3_11.hpp +++ b/include/boost/math/tools/detail/rational_horner3_11.hpp @@ -1,482 +1,482 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_11_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_11_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[8] * x2 + a[6]; - t[1] = a[7] * x2 + a[5]; - t[2] = b[8] * x2 + b[6]; - t[3] = b[7] * x2 + b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[8]); - t[2] += static_cast(b[8]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[2] = b[9] * x2 + b[7]; - t[3] = b[8] * x2 + b[6]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[10] * x2 + a[8]; - t[1] = a[9] * x2 + a[7]; - t[2] = b[10] * x2 + b[8]; - t[3] = b[9] * x2 + b[7]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[10]); - t[2] += static_cast(b[10]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_11_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_11_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[8] * x2 + a[6]; + t[1] = a[7] * x2 + a[5]; + t[2] = b[8] * x2 + b[6]; + t[3] = b[7] * x2 + b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[8]); + t[2] += static_cast(b[8]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[2] = b[9] * x2 + b[7]; + t[3] = b[8] * x2 + b[6]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[10] * x2 + a[8]; + t[1] = a[9] * x2 + a[7]; + t[2] = b[10] * x2 + b[8]; + t[3] = b[9] * x2 + b[7]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[10]); + t[2] += static_cast(b[10]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_12.hpp b/include/boost/math/tools/detail/rational_horner3_12.hpp index 2bcb20c35..88d6d9402 100644 --- a/include/boost/math/tools/detail/rational_horner3_12.hpp +++ b/include/boost/math/tools/detail/rational_horner3_12.hpp @@ -1,576 +1,576 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_12_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_12_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[8] * x2 + a[6]; - t[1] = a[7] * x2 + a[5]; - t[2] = b[8] * x2 + b[6]; - t[3] = b[7] * x2 + b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[8]); - t[2] += static_cast(b[8]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[2] = b[9] * x2 + b[7]; - t[3] = b[8] * x2 + b[6]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[10] * x2 + a[8]; - t[1] = a[9] * x2 + a[7]; - t[2] = b[10] * x2 + b[8]; - t[3] = b[9] * x2 + b[7]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[10]); - t[2] += static_cast(b[10]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[2] = b[11] * x2 + b[9]; - t[3] = b[10] * x2 + b[8]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_12_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_12_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[8] * x2 + a[6]; + t[1] = a[7] * x2 + a[5]; + t[2] = b[8] * x2 + b[6]; + t[3] = b[7] * x2 + b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[8]); + t[2] += static_cast(b[8]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[2] = b[9] * x2 + b[7]; + t[3] = b[8] * x2 + b[6]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[10] * x2 + a[8]; + t[1] = a[9] * x2 + a[7]; + t[2] = b[10] * x2 + b[8]; + t[3] = b[9] * x2 + b[7]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[10]); + t[2] += static_cast(b[10]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[2] = b[11] * x2 + b[9]; + t[3] = b[10] * x2 + b[8]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_13.hpp b/include/boost/math/tools/detail/rational_horner3_13.hpp index b218c2aee..8f1661a88 100644 --- a/include/boost/math/tools/detail/rational_horner3_13.hpp +++ b/include/boost/math/tools/detail/rational_horner3_13.hpp @@ -1,678 +1,678 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_13_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_13_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[8] * x2 + a[6]; - t[1] = a[7] * x2 + a[5]; - t[2] = b[8] * x2 + b[6]; - t[3] = b[7] * x2 + b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[8]); - t[2] += static_cast(b[8]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[2] = b[9] * x2 + b[7]; - t[3] = b[8] * x2 + b[6]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[10] * x2 + a[8]; - t[1] = a[9] * x2 + a[7]; - t[2] = b[10] * x2 + b[8]; - t[3] = b[9] * x2 + b[7]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[10]); - t[2] += static_cast(b[10]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[2] = b[11] * x2 + b[9]; - t[3] = b[10] * x2 + b[8]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[12] * x2 + a[10]; - t[1] = a[11] * x2 + a[9]; - t[2] = b[12] * x2 + b[10]; - t[3] = b[11] * x2 + b[9]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[12]); - t[2] += static_cast(b[12]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_13_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_13_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[8] * x2 + a[6]; + t[1] = a[7] * x2 + a[5]; + t[2] = b[8] * x2 + b[6]; + t[3] = b[7] * x2 + b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[8]); + t[2] += static_cast(b[8]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[2] = b[9] * x2 + b[7]; + t[3] = b[8] * x2 + b[6]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[10] * x2 + a[8]; + t[1] = a[9] * x2 + a[7]; + t[2] = b[10] * x2 + b[8]; + t[3] = b[9] * x2 + b[7]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[10]); + t[2] += static_cast(b[10]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[2] = b[11] * x2 + b[9]; + t[3] = b[10] * x2 + b[8]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[12] * x2 + a[10]; + t[1] = a[11] * x2 + a[9]; + t[2] = b[12] * x2 + b[10]; + t[3] = b[11] * x2 + b[9]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[12]); + t[2] += static_cast(b[12]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_14.hpp b/include/boost/math/tools/detail/rational_horner3_14.hpp index 319cf6ede..299617339 100644 --- a/include/boost/math/tools/detail/rational_horner3_14.hpp +++ b/include/boost/math/tools/detail/rational_horner3_14.hpp @@ -1,788 +1,788 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_14_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_14_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[8] * x2 + a[6]; - t[1] = a[7] * x2 + a[5]; - t[2] = b[8] * x2 + b[6]; - t[3] = b[7] * x2 + b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[8]); - t[2] += static_cast(b[8]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[2] = b[9] * x2 + b[7]; - t[3] = b[8] * x2 + b[6]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[10] * x2 + a[8]; - t[1] = a[9] * x2 + a[7]; - t[2] = b[10] * x2 + b[8]; - t[3] = b[9] * x2 + b[7]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[10]); - t[2] += static_cast(b[10]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[2] = b[11] * x2 + b[9]; - t[3] = b[10] * x2 + b[8]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[12] * x2 + a[10]; - t[1] = a[11] * x2 + a[9]; - t[2] = b[12] * x2 + b[10]; - t[3] = b[11] * x2 + b[9]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[12]); - t[2] += static_cast(b[12]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[2] = b[13] * x2 + b[11]; - t[3] = b[12] * x2 + b[10]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_14_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_14_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[8] * x2 + a[6]; + t[1] = a[7] * x2 + a[5]; + t[2] = b[8] * x2 + b[6]; + t[3] = b[7] * x2 + b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[8]); + t[2] += static_cast(b[8]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[2] = b[9] * x2 + b[7]; + t[3] = b[8] * x2 + b[6]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[10] * x2 + a[8]; + t[1] = a[9] * x2 + a[7]; + t[2] = b[10] * x2 + b[8]; + t[3] = b[9] * x2 + b[7]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[10]); + t[2] += static_cast(b[10]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[2] = b[11] * x2 + b[9]; + t[3] = b[10] * x2 + b[8]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[12] * x2 + a[10]; + t[1] = a[11] * x2 + a[9]; + t[2] = b[12] * x2 + b[10]; + t[3] = b[11] * x2 + b[9]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[12]); + t[2] += static_cast(b[12]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[2] = b[13] * x2 + b[11]; + t[3] = b[12] * x2 + b[10]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_15.hpp b/include/boost/math/tools/detail/rational_horner3_15.hpp index 06ed68db9..67b71b42c 100644 --- a/include/boost/math/tools/detail/rational_horner3_15.hpp +++ b/include/boost/math/tools/detail/rational_horner3_15.hpp @@ -1,906 +1,906 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_15_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_15_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[8] * x2 + a[6]; - t[1] = a[7] * x2 + a[5]; - t[2] = b[8] * x2 + b[6]; - t[3] = b[7] * x2 + b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[8]); - t[2] += static_cast(b[8]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[2] = b[9] * x2 + b[7]; - t[3] = b[8] * x2 + b[6]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[10] * x2 + a[8]; - t[1] = a[9] * x2 + a[7]; - t[2] = b[10] * x2 + b[8]; - t[3] = b[9] * x2 + b[7]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[10]); - t[2] += static_cast(b[10]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[2] = b[11] * x2 + b[9]; - t[3] = b[10] * x2 + b[8]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[12] * x2 + a[10]; - t[1] = a[11] * x2 + a[9]; - t[2] = b[12] * x2 + b[10]; - t[3] = b[11] * x2 + b[9]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[12]); - t[2] += static_cast(b[12]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[2] = b[13] * x2 + b[11]; - t[3] = b[12] * x2 + b[10]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[14] * x2 + a[12]; - t[1] = a[13] * x2 + a[11]; - t[2] = b[14] * x2 + b[12]; - t[3] = b[13] * x2 + b[11]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[9]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[14]); - t[2] += static_cast(b[14]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_15_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_15_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[8] * x2 + a[6]; + t[1] = a[7] * x2 + a[5]; + t[2] = b[8] * x2 + b[6]; + t[3] = b[7] * x2 + b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[8]); + t[2] += static_cast(b[8]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[2] = b[9] * x2 + b[7]; + t[3] = b[8] * x2 + b[6]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[10] * x2 + a[8]; + t[1] = a[9] * x2 + a[7]; + t[2] = b[10] * x2 + b[8]; + t[3] = b[9] * x2 + b[7]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[10]); + t[2] += static_cast(b[10]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[2] = b[11] * x2 + b[9]; + t[3] = b[10] * x2 + b[8]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[12] * x2 + a[10]; + t[1] = a[11] * x2 + a[9]; + t[2] = b[12] * x2 + b[10]; + t[3] = b[11] * x2 + b[9]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[12]); + t[2] += static_cast(b[12]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[2] = b[13] * x2 + b[11]; + t[3] = b[12] * x2 + b[10]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[14] * x2 + a[12]; + t[1] = a[13] * x2 + a[11]; + t[2] = b[14] * x2 + b[12]; + t[3] = b[13] * x2 + b[11]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[9]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[14]); + t[2] += static_cast(b[14]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_16.hpp b/include/boost/math/tools/detail/rational_horner3_16.hpp index 9bad7fce8..75cb17a60 100644 --- a/include/boost/math/tools/detail/rational_horner3_16.hpp +++ b/include/boost/math/tools/detail/rational_horner3_16.hpp @@ -1,1032 +1,1032 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_16_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_16_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[8] * x2 + a[6]; - t[1] = a[7] * x2 + a[5]; - t[2] = b[8] * x2 + b[6]; - t[3] = b[7] * x2 + b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[8]); - t[2] += static_cast(b[8]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[2] = b[9] * x2 + b[7]; - t[3] = b[8] * x2 + b[6]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[10] * x2 + a[8]; - t[1] = a[9] * x2 + a[7]; - t[2] = b[10] * x2 + b[8]; - t[3] = b[9] * x2 + b[7]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[10]); - t[2] += static_cast(b[10]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[2] = b[11] * x2 + b[9]; - t[3] = b[10] * x2 + b[8]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[12] * x2 + a[10]; - t[1] = a[11] * x2 + a[9]; - t[2] = b[12] * x2 + b[10]; - t[3] = b[11] * x2 + b[9]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[12]); - t[2] += static_cast(b[12]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[2] = b[13] * x2 + b[11]; - t[3] = b[12] * x2 + b[10]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[14] * x2 + a[12]; - t[1] = a[13] * x2 + a[11]; - t[2] = b[14] * x2 + b[12]; - t[3] = b[13] * x2 + b[11]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[9]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[14]); - t[2] += static_cast(b[14]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[15] * x2 + a[13]; - t[1] = a[14] * x2 + a[12]; - t[2] = b[15] * x2 + b[13]; - t[3] = b[14] * x2 + b[12]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[2] += static_cast(b[11]); - t[3] += static_cast(b[10]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_16_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_16_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[8] * x2 + a[6]; + t[1] = a[7] * x2 + a[5]; + t[2] = b[8] * x2 + b[6]; + t[3] = b[7] * x2 + b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[8]); + t[2] += static_cast(b[8]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[2] = b[9] * x2 + b[7]; + t[3] = b[8] * x2 + b[6]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[10] * x2 + a[8]; + t[1] = a[9] * x2 + a[7]; + t[2] = b[10] * x2 + b[8]; + t[3] = b[9] * x2 + b[7]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[10]); + t[2] += static_cast(b[10]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[2] = b[11] * x2 + b[9]; + t[3] = b[10] * x2 + b[8]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[12] * x2 + a[10]; + t[1] = a[11] * x2 + a[9]; + t[2] = b[12] * x2 + b[10]; + t[3] = b[11] * x2 + b[9]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[12]); + t[2] += static_cast(b[12]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[2] = b[13] * x2 + b[11]; + t[3] = b[12] * x2 + b[10]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[14] * x2 + a[12]; + t[1] = a[13] * x2 + a[11]; + t[2] = b[14] * x2 + b[12]; + t[3] = b[13] * x2 + b[11]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[9]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[14]); + t[2] += static_cast(b[14]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[15] * x2 + a[13]; + t[1] = a[14] * x2 + a[12]; + t[2] = b[15] * x2 + b[13]; + t[3] = b[14] * x2 + b[12]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[2] += static_cast(b[11]); + t[3] += static_cast(b[10]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_17.hpp b/include/boost/math/tools/detail/rational_horner3_17.hpp index cb82af4e0..275236412 100644 --- a/include/boost/math/tools/detail/rational_horner3_17.hpp +++ b/include/boost/math/tools/detail/rational_horner3_17.hpp @@ -1,1166 +1,1166 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_17_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_17_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[8] * x2 + a[6]; - t[1] = a[7] * x2 + a[5]; - t[2] = b[8] * x2 + b[6]; - t[3] = b[7] * x2 + b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[8]); - t[2] += static_cast(b[8]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[2] = b[9] * x2 + b[7]; - t[3] = b[8] * x2 + b[6]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[10] * x2 + a[8]; - t[1] = a[9] * x2 + a[7]; - t[2] = b[10] * x2 + b[8]; - t[3] = b[9] * x2 + b[7]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[10]); - t[2] += static_cast(b[10]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[2] = b[11] * x2 + b[9]; - t[3] = b[10] * x2 + b[8]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[12] * x2 + a[10]; - t[1] = a[11] * x2 + a[9]; - t[2] = b[12] * x2 + b[10]; - t[3] = b[11] * x2 + b[9]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[12]); - t[2] += static_cast(b[12]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[2] = b[13] * x2 + b[11]; - t[3] = b[12] * x2 + b[10]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[14] * x2 + a[12]; - t[1] = a[13] * x2 + a[11]; - t[2] = b[14] * x2 + b[12]; - t[3] = b[13] * x2 + b[11]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[9]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[14]); - t[2] += static_cast(b[14]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[15] * x2 + a[13]; - t[1] = a[14] * x2 + a[12]; - t[2] = b[15] * x2 + b[13]; - t[3] = b[14] * x2 + b[12]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[2] += static_cast(b[11]); - t[3] += static_cast(b[10]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[16] * x2 + a[14]; - t[1] = a[15] * x2 + a[13]; - t[2] = b[16] * x2 + b[14]; - t[3] = b[15] * x2 + b[13]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[11]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[9]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[16]); - t[2] += static_cast(b[16]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_17_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_17_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[8] * x2 + a[6]; + t[1] = a[7] * x2 + a[5]; + t[2] = b[8] * x2 + b[6]; + t[3] = b[7] * x2 + b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[8]); + t[2] += static_cast(b[8]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[2] = b[9] * x2 + b[7]; + t[3] = b[8] * x2 + b[6]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[10] * x2 + a[8]; + t[1] = a[9] * x2 + a[7]; + t[2] = b[10] * x2 + b[8]; + t[3] = b[9] * x2 + b[7]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[10]); + t[2] += static_cast(b[10]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[2] = b[11] * x2 + b[9]; + t[3] = b[10] * x2 + b[8]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[12] * x2 + a[10]; + t[1] = a[11] * x2 + a[9]; + t[2] = b[12] * x2 + b[10]; + t[3] = b[11] * x2 + b[9]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[12]); + t[2] += static_cast(b[12]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[2] = b[13] * x2 + b[11]; + t[3] = b[12] * x2 + b[10]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[14] * x2 + a[12]; + t[1] = a[13] * x2 + a[11]; + t[2] = b[14] * x2 + b[12]; + t[3] = b[13] * x2 + b[11]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[9]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[14]); + t[2] += static_cast(b[14]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[15] * x2 + a[13]; + t[1] = a[14] * x2 + a[12]; + t[2] = b[15] * x2 + b[13]; + t[3] = b[14] * x2 + b[12]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[2] += static_cast(b[11]); + t[3] += static_cast(b[10]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[16] * x2 + a[14]; + t[1] = a[15] * x2 + a[13]; + t[2] = b[16] * x2 + b[14]; + t[3] = b[15] * x2 + b[13]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[11]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[9]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[16]); + t[2] += static_cast(b[16]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_18.hpp b/include/boost/math/tools/detail/rational_horner3_18.hpp index 055e2049c..19e0a5337 100644 --- a/include/boost/math/tools/detail/rational_horner3_18.hpp +++ b/include/boost/math/tools/detail/rational_horner3_18.hpp @@ -1,1308 +1,1308 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_18_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_18_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[8] * x2 + a[6]; - t[1] = a[7] * x2 + a[5]; - t[2] = b[8] * x2 + b[6]; - t[3] = b[7] * x2 + b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[8]); - t[2] += static_cast(b[8]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[2] = b[9] * x2 + b[7]; - t[3] = b[8] * x2 + b[6]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[10] * x2 + a[8]; - t[1] = a[9] * x2 + a[7]; - t[2] = b[10] * x2 + b[8]; - t[3] = b[9] * x2 + b[7]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[10]); - t[2] += static_cast(b[10]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[2] = b[11] * x2 + b[9]; - t[3] = b[10] * x2 + b[8]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[12] * x2 + a[10]; - t[1] = a[11] * x2 + a[9]; - t[2] = b[12] * x2 + b[10]; - t[3] = b[11] * x2 + b[9]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[12]); - t[2] += static_cast(b[12]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[2] = b[13] * x2 + b[11]; - t[3] = b[12] * x2 + b[10]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[14] * x2 + a[12]; - t[1] = a[13] * x2 + a[11]; - t[2] = b[14] * x2 + b[12]; - t[3] = b[13] * x2 + b[11]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[9]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[14]); - t[2] += static_cast(b[14]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[15] * x2 + a[13]; - t[1] = a[14] * x2 + a[12]; - t[2] = b[15] * x2 + b[13]; - t[3] = b[14] * x2 + b[12]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[2] += static_cast(b[11]); - t[3] += static_cast(b[10]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[16] * x2 + a[14]; - t[1] = a[15] * x2 + a[13]; - t[2] = b[16] * x2 + b[14]; - t[3] = b[15] * x2 + b[13]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[11]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[9]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[16]); - t[2] += static_cast(b[16]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[17] * x2 + a[15]; - t[1] = a[16] * x2 + a[14]; - t[2] = b[17] * x2 + b[15]; - t[3] = b[16] * x2 + b[14]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[13]); - t[1] += static_cast(a[12]); - t[2] += static_cast(b[13]); - t[3] += static_cast(b[12]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[2] += static_cast(b[11]); - t[3] += static_cast(b[10]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[16]); - t[1] += static_cast(a[17]); - t[2] += static_cast(b[16]); - t[3] += static_cast(b[17]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_18_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_18_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[8] * x2 + a[6]; + t[1] = a[7] * x2 + a[5]; + t[2] = b[8] * x2 + b[6]; + t[3] = b[7] * x2 + b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[8]); + t[2] += static_cast(b[8]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[2] = b[9] * x2 + b[7]; + t[3] = b[8] * x2 + b[6]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[10] * x2 + a[8]; + t[1] = a[9] * x2 + a[7]; + t[2] = b[10] * x2 + b[8]; + t[3] = b[9] * x2 + b[7]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[10]); + t[2] += static_cast(b[10]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[2] = b[11] * x2 + b[9]; + t[3] = b[10] * x2 + b[8]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[12] * x2 + a[10]; + t[1] = a[11] * x2 + a[9]; + t[2] = b[12] * x2 + b[10]; + t[3] = b[11] * x2 + b[9]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[12]); + t[2] += static_cast(b[12]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[2] = b[13] * x2 + b[11]; + t[3] = b[12] * x2 + b[10]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[14] * x2 + a[12]; + t[1] = a[13] * x2 + a[11]; + t[2] = b[14] * x2 + b[12]; + t[3] = b[13] * x2 + b[11]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[9]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[14]); + t[2] += static_cast(b[14]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[15] * x2 + a[13]; + t[1] = a[14] * x2 + a[12]; + t[2] = b[15] * x2 + b[13]; + t[3] = b[14] * x2 + b[12]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[2] += static_cast(b[11]); + t[3] += static_cast(b[10]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[16] * x2 + a[14]; + t[1] = a[15] * x2 + a[13]; + t[2] = b[16] * x2 + b[14]; + t[3] = b[15] * x2 + b[13]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[11]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[9]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[16]); + t[2] += static_cast(b[16]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[17] * x2 + a[15]; + t[1] = a[16] * x2 + a[14]; + t[2] = b[17] * x2 + b[15]; + t[3] = b[16] * x2 + b[14]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[13]); + t[1] += static_cast(a[12]); + t[2] += static_cast(b[13]); + t[3] += static_cast(b[12]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[2] += static_cast(b[11]); + t[3] += static_cast(b[10]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[16]); + t[1] += static_cast(a[17]); + t[2] += static_cast(b[16]); + t[3] += static_cast(b[17]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_19.hpp b/include/boost/math/tools/detail/rational_horner3_19.hpp index 863c2cde8..ff7156c80 100644 --- a/include/boost/math/tools/detail/rational_horner3_19.hpp +++ b/include/boost/math/tools/detail/rational_horner3_19.hpp @@ -1,1458 +1,1458 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_19_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_19_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[8] * x2 + a[6]; - t[1] = a[7] * x2 + a[5]; - t[2] = b[8] * x2 + b[6]; - t[3] = b[7] * x2 + b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[8]); - t[2] += static_cast(b[8]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[2] = b[9] * x2 + b[7]; - t[3] = b[8] * x2 + b[6]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[10] * x2 + a[8]; - t[1] = a[9] * x2 + a[7]; - t[2] = b[10] * x2 + b[8]; - t[3] = b[9] * x2 + b[7]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[10]); - t[2] += static_cast(b[10]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[2] = b[11] * x2 + b[9]; - t[3] = b[10] * x2 + b[8]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[12] * x2 + a[10]; - t[1] = a[11] * x2 + a[9]; - t[2] = b[12] * x2 + b[10]; - t[3] = b[11] * x2 + b[9]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[12]); - t[2] += static_cast(b[12]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[2] = b[13] * x2 + b[11]; - t[3] = b[12] * x2 + b[10]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[14] * x2 + a[12]; - t[1] = a[13] * x2 + a[11]; - t[2] = b[14] * x2 + b[12]; - t[3] = b[13] * x2 + b[11]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[9]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[14]); - t[2] += static_cast(b[14]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[15] * x2 + a[13]; - t[1] = a[14] * x2 + a[12]; - t[2] = b[15] * x2 + b[13]; - t[3] = b[14] * x2 + b[12]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[2] += static_cast(b[11]); - t[3] += static_cast(b[10]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[16] * x2 + a[14]; - t[1] = a[15] * x2 + a[13]; - t[2] = b[16] * x2 + b[14]; - t[3] = b[15] * x2 + b[13]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[11]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[9]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[16]); - t[2] += static_cast(b[16]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[17] * x2 + a[15]; - t[1] = a[16] * x2 + a[14]; - t[2] = b[17] * x2 + b[15]; - t[3] = b[16] * x2 + b[14]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[13]); - t[1] += static_cast(a[12]); - t[2] += static_cast(b[13]); - t[3] += static_cast(b[12]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[2] += static_cast(b[11]); - t[3] += static_cast(b[10]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[16]); - t[1] += static_cast(a[17]); - t[2] += static_cast(b[16]); - t[3] += static_cast(b[17]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[18] * x2 + a[16]; - t[1] = a[17] * x2 + a[15]; - t[2] = b[18] * x2 + b[16]; - t[3] = b[17] * x2 + b[15]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[13]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[11]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[9]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[16]); - t[1] += static_cast(a[17]); - t[2] += static_cast(b[16]); - t[3] += static_cast(b[17]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[18]); - t[2] += static_cast(b[18]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_19_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_19_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[8] * x2 + a[6]; + t[1] = a[7] * x2 + a[5]; + t[2] = b[8] * x2 + b[6]; + t[3] = b[7] * x2 + b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[8]); + t[2] += static_cast(b[8]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[2] = b[9] * x2 + b[7]; + t[3] = b[8] * x2 + b[6]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[10] * x2 + a[8]; + t[1] = a[9] * x2 + a[7]; + t[2] = b[10] * x2 + b[8]; + t[3] = b[9] * x2 + b[7]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[10]); + t[2] += static_cast(b[10]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[2] = b[11] * x2 + b[9]; + t[3] = b[10] * x2 + b[8]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[12] * x2 + a[10]; + t[1] = a[11] * x2 + a[9]; + t[2] = b[12] * x2 + b[10]; + t[3] = b[11] * x2 + b[9]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[12]); + t[2] += static_cast(b[12]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[2] = b[13] * x2 + b[11]; + t[3] = b[12] * x2 + b[10]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[14] * x2 + a[12]; + t[1] = a[13] * x2 + a[11]; + t[2] = b[14] * x2 + b[12]; + t[3] = b[13] * x2 + b[11]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[9]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[14]); + t[2] += static_cast(b[14]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[15] * x2 + a[13]; + t[1] = a[14] * x2 + a[12]; + t[2] = b[15] * x2 + b[13]; + t[3] = b[14] * x2 + b[12]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[2] += static_cast(b[11]); + t[3] += static_cast(b[10]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[16] * x2 + a[14]; + t[1] = a[15] * x2 + a[13]; + t[2] = b[16] * x2 + b[14]; + t[3] = b[15] * x2 + b[13]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[11]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[9]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[16]); + t[2] += static_cast(b[16]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[17] * x2 + a[15]; + t[1] = a[16] * x2 + a[14]; + t[2] = b[17] * x2 + b[15]; + t[3] = b[16] * x2 + b[14]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[13]); + t[1] += static_cast(a[12]); + t[2] += static_cast(b[13]); + t[3] += static_cast(b[12]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[2] += static_cast(b[11]); + t[3] += static_cast(b[10]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[16]); + t[1] += static_cast(a[17]); + t[2] += static_cast(b[16]); + t[3] += static_cast(b[17]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[18] * x2 + a[16]; + t[1] = a[17] * x2 + a[15]; + t[2] = b[18] * x2 + b[16]; + t[3] = b[17] * x2 + b[15]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[13]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[11]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[9]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[16]); + t[1] += static_cast(a[17]); + t[2] += static_cast(b[16]); + t[3] += static_cast(b[17]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[18]); + t[2] += static_cast(b[18]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_2.hpp b/include/boost/math/tools/detail/rational_horner3_2.hpp index 5373d144f..c5400a0d1 100644 --- a/include/boost/math/tools/detail/rational_horner3_2.hpp +++ b/include/boost/math/tools/detail/rational_horner3_2.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_2_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_2_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_2_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_2_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_20.hpp b/include/boost/math/tools/detail/rational_horner3_20.hpp index 056cac551..a5948d2ff 100644 --- a/include/boost/math/tools/detail/rational_horner3_20.hpp +++ b/include/boost/math/tools/detail/rational_horner3_20.hpp @@ -1,1616 +1,1616 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_20_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_20_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[8] * x2 + a[6]; - t[1] = a[7] * x2 + a[5]; - t[2] = b[8] * x2 + b[6]; - t[3] = b[7] * x2 + b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[8]); - t[2] += static_cast(b[8]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[9] * x2 + a[7]; - t[1] = a[8] * x2 + a[6]; - t[2] = b[9] * x2 + b[7]; - t[3] = b[8] * x2 + b[6]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[10] * x2 + a[8]; - t[1] = a[9] * x2 + a[7]; - t[2] = b[10] * x2 + b[8]; - t[3] = b[9] * x2 + b[7]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[10]); - t[2] += static_cast(b[10]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[11] * x2 + a[9]; - t[1] = a[10] * x2 + a[8]; - t[2] = b[11] * x2 + b[9]; - t[3] = b[10] * x2 + b[8]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[12] * x2 + a[10]; - t[1] = a[11] * x2 + a[9]; - t[2] = b[12] * x2 + b[10]; - t[3] = b[11] * x2 + b[9]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[12]); - t[2] += static_cast(b[12]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[13] * x2 + a[11]; - t[1] = a[12] * x2 + a[10]; - t[2] = b[13] * x2 + b[11]; - t[3] = b[12] * x2 + b[10]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[14] * x2 + a[12]; - t[1] = a[13] * x2 + a[11]; - t[2] = b[14] * x2 + b[12]; - t[3] = b[13] * x2 + b[11]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[9]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[14]); - t[2] += static_cast(b[14]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[15] * x2 + a[13]; - t[1] = a[14] * x2 + a[12]; - t[2] = b[15] * x2 + b[13]; - t[3] = b[14] * x2 + b[12]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[2] += static_cast(b[11]); - t[3] += static_cast(b[10]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[16] * x2 + a[14]; - t[1] = a[15] * x2 + a[13]; - t[2] = b[16] * x2 + b[14]; - t[3] = b[15] * x2 + b[13]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[11]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[9]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[16]); - t[2] += static_cast(b[16]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[17] * x2 + a[15]; - t[1] = a[16] * x2 + a[14]; - t[2] = b[17] * x2 + b[15]; - t[3] = b[16] * x2 + b[14]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[13]); - t[1] += static_cast(a[12]); - t[2] += static_cast(b[13]); - t[3] += static_cast(b[12]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[2] += static_cast(b[11]); - t[3] += static_cast(b[10]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[16]); - t[1] += static_cast(a[17]); - t[2] += static_cast(b[16]); - t[3] += static_cast(b[17]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[18] * x2 + a[16]; - t[1] = a[17] * x2 + a[15]; - t[2] = b[18] * x2 + b[16]; - t[3] = b[17] * x2 + b[15]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[13]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[11]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[9]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[7]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[5]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[16]); - t[1] += static_cast(a[17]); - t[2] += static_cast(b[16]); - t[3] += static_cast(b[17]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[18]); - t[2] += static_cast(b[18]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<20>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[19] * x2 + a[17]; - t[1] = a[18] * x2 + a[16]; - t[2] = b[19] * x2 + b[17]; - t[3] = b[18] * x2 + b[16]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[15]); - t[1] += static_cast(a[14]); - t[2] += static_cast(b[15]); - t[3] += static_cast(b[14]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[13]); - t[1] += static_cast(a[12]); - t[2] += static_cast(b[13]); - t[3] += static_cast(b[12]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[11]); - t[1] += static_cast(a[10]); - t[2] += static_cast(b[11]); - t[3] += static_cast(b[10]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[9]); - t[1] += static_cast(a[8]); - t[2] += static_cast(b[9]); - t[3] += static_cast(b[8]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[7]); - t[1] += static_cast(a[6]); - t[2] += static_cast(b[7]); - t[3] += static_cast(b[6]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[5]); - t[1] += static_cast(a[4]); - t[2] += static_cast(b[5]); - t[3] += static_cast(b[4]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[8]); - t[1] += static_cast(a[9]); - t[2] += static_cast(b[8]); - t[3] += static_cast(b[9]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[10]); - t[1] += static_cast(a[11]); - t[2] += static_cast(b[10]); - t[3] += static_cast(b[11]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[12]); - t[1] += static_cast(a[13]); - t[2] += static_cast(b[12]); - t[3] += static_cast(b[13]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[14]); - t[1] += static_cast(a[15]); - t[2] += static_cast(b[14]); - t[3] += static_cast(b[15]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[16]); - t[1] += static_cast(a[17]); - t[2] += static_cast(b[16]); - t[3] += static_cast(b[17]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[18]); - t[1] += static_cast(a[19]); - t[2] += static_cast(b[18]); - t[3] += static_cast(b[19]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_20_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_20_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[8] * x2 + a[6]; + t[1] = a[7] * x2 + a[5]; + t[2] = b[8] * x2 + b[6]; + t[3] = b[7] * x2 + b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[8]); + t[2] += static_cast(b[8]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[9] * x2 + a[7]; + t[1] = a[8] * x2 + a[6]; + t[2] = b[9] * x2 + b[7]; + t[3] = b[8] * x2 + b[6]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[10] * x2 + a[8]; + t[1] = a[9] * x2 + a[7]; + t[2] = b[10] * x2 + b[8]; + t[3] = b[9] * x2 + b[7]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[10]); + t[2] += static_cast(b[10]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[11] * x2 + a[9]; + t[1] = a[10] * x2 + a[8]; + t[2] = b[11] * x2 + b[9]; + t[3] = b[10] * x2 + b[8]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[12] * x2 + a[10]; + t[1] = a[11] * x2 + a[9]; + t[2] = b[12] * x2 + b[10]; + t[3] = b[11] * x2 + b[9]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[12]); + t[2] += static_cast(b[12]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[13] * x2 + a[11]; + t[1] = a[12] * x2 + a[10]; + t[2] = b[13] * x2 + b[11]; + t[3] = b[12] * x2 + b[10]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[14] * x2 + a[12]; + t[1] = a[13] * x2 + a[11]; + t[2] = b[14] * x2 + b[12]; + t[3] = b[13] * x2 + b[11]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[9]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[14]); + t[2] += static_cast(b[14]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[15] * x2 + a[13]; + t[1] = a[14] * x2 + a[12]; + t[2] = b[15] * x2 + b[13]; + t[3] = b[14] * x2 + b[12]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[2] += static_cast(b[11]); + t[3] += static_cast(b[10]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[16] * x2 + a[14]; + t[1] = a[15] * x2 + a[13]; + t[2] = b[16] * x2 + b[14]; + t[3] = b[15] * x2 + b[13]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[11]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[9]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[16]); + t[2] += static_cast(b[16]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[17] * x2 + a[15]; + t[1] = a[16] * x2 + a[14]; + t[2] = b[17] * x2 + b[15]; + t[3] = b[16] * x2 + b[14]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[13]); + t[1] += static_cast(a[12]); + t[2] += static_cast(b[13]); + t[3] += static_cast(b[12]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[2] += static_cast(b[11]); + t[3] += static_cast(b[10]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[16]); + t[1] += static_cast(a[17]); + t[2] += static_cast(b[16]); + t[3] += static_cast(b[17]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[18] * x2 + a[16]; + t[1] = a[17] * x2 + a[15]; + t[2] = b[18] * x2 + b[16]; + t[3] = b[17] * x2 + b[15]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[13]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[11]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[9]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[7]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[5]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[16]); + t[1] += static_cast(a[17]); + t[2] += static_cast(b[16]); + t[3] += static_cast(b[17]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[18]); + t[2] += static_cast(b[18]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<20>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[19] * x2 + a[17]; + t[1] = a[18] * x2 + a[16]; + t[2] = b[19] * x2 + b[17]; + t[3] = b[18] * x2 + b[16]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[15]); + t[1] += static_cast(a[14]); + t[2] += static_cast(b[15]); + t[3] += static_cast(b[14]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[13]); + t[1] += static_cast(a[12]); + t[2] += static_cast(b[13]); + t[3] += static_cast(b[12]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[11]); + t[1] += static_cast(a[10]); + t[2] += static_cast(b[11]); + t[3] += static_cast(b[10]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[9]); + t[1] += static_cast(a[8]); + t[2] += static_cast(b[9]); + t[3] += static_cast(b[8]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[7]); + t[1] += static_cast(a[6]); + t[2] += static_cast(b[7]); + t[3] += static_cast(b[6]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[5]); + t[1] += static_cast(a[4]); + t[2] += static_cast(b[5]); + t[3] += static_cast(b[4]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[8]); + t[1] += static_cast(a[9]); + t[2] += static_cast(b[8]); + t[3] += static_cast(b[9]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[10]); + t[1] += static_cast(a[11]); + t[2] += static_cast(b[10]); + t[3] += static_cast(b[11]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[12]); + t[1] += static_cast(a[13]); + t[2] += static_cast(b[12]); + t[3] += static_cast(b[13]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[14]); + t[1] += static_cast(a[15]); + t[2] += static_cast(b[14]); + t[3] += static_cast(b[15]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[16]); + t[1] += static_cast(a[17]); + t[2] += static_cast(b[16]); + t[3] += static_cast(b[17]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[18]); + t[1] += static_cast(a[19]); + t[2] += static_cast(b[18]); + t[3] += static_cast(b[19]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_3.hpp b/include/boost/math/tools/detail/rational_horner3_3.hpp index f1897e145..645c3c364 100644 --- a/include/boost/math/tools/detail/rational_horner3_3.hpp +++ b/include/boost/math/tools/detail/rational_horner3_3.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_3_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_3_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_3_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_3_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_4.hpp b/include/boost/math/tools/detail/rational_horner3_4.hpp index e7d6ccd13..781b4c109 100644 --- a/include/boost/math/tools/detail/rational_horner3_4.hpp +++ b/include/boost/math/tools/detail/rational_horner3_4.hpp @@ -1,48 +1,48 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_4_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_4_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_4_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_4_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_5.hpp b/include/boost/math/tools/detail/rational_horner3_5.hpp index abdd80b6d..333b7fd2e 100644 --- a/include/boost/math/tools/detail/rational_horner3_5.hpp +++ b/include/boost/math/tools/detail/rational_horner3_5.hpp @@ -1,86 +1,86 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_5_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_5_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_5_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_5_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_6.hpp b/include/boost/math/tools/detail/rational_horner3_6.hpp index 3b0ed94f6..33e075b6a 100644 --- a/include/boost/math/tools/detail/rational_horner3_6.hpp +++ b/include/boost/math/tools/detail/rational_horner3_6.hpp @@ -1,132 +1,132 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_6_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_6_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_6_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_6_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_7.hpp b/include/boost/math/tools/detail/rational_horner3_7.hpp index e7ab5b6f0..6f886d16d 100644 --- a/include/boost/math/tools/detail/rational_horner3_7.hpp +++ b/include/boost/math/tools/detail/rational_horner3_7.hpp @@ -1,186 +1,186 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_7_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_7_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_7_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_7_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_8.hpp b/include/boost/math/tools/detail/rational_horner3_8.hpp index 11473d39d..062f9d3cb 100644 --- a/include/boost/math/tools/detail/rational_horner3_8.hpp +++ b/include/boost/math/tools/detail/rational_horner3_8.hpp @@ -1,248 +1,248 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_8_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_8_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_8_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_8_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/include/boost/math/tools/detail/rational_horner3_9.hpp b/include/boost/math/tools/detail/rational_horner3_9.hpp index 9a47da896..5c47864eb 100644 --- a/include/boost/math/tools/detail/rational_horner3_9.hpp +++ b/include/boost/math/tools/detail/rational_horner3_9.hpp @@ -1,318 +1,318 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// This file is machine generated, do not edit by hand - -// Polynomial evaluation using second order Horners rule -#ifndef BOOST_MATH_TOOLS_RAT_EVAL_9_HPP -#define BOOST_MATH_TOOLS_RAT_EVAL_9_HPP - -namespace boost{ namespace math{ namespace tools{ namespace detail{ - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) -{ - return static_cast(0); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) -{ - return static_cast(a[0]) / static_cast(b[0]); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) -{ - return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) -{ - return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) -{ - return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[4] * x2 + a[2]; - t[1] = a[3] * x2 + a[1]; - t[2] = b[4] * x2 + b[2]; - t[3] = b[3] * x2 + b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[4]); - t[2] += static_cast(b[4]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[5] * x2 + a[3]; - t[1] = a[4] * x2 + a[2]; - t[2] = b[5] * x2 + b[3]; - t[3] = b[4] * x2 + b[2]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[6] * x2 + a[4]; - t[1] = a[5] * x2 + a[3]; - t[2] = b[6] * x2 + b[4]; - t[3] = b[5] * x2 + b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[6]); - t[2] += static_cast(b[6]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[7] * x2 + a[5]; - t[1] = a[6] * x2 + a[4]; - t[2] = b[7] * x2 + b[5]; - t[3] = b[6] * x2 + b[4]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[3]); - t[1] += static_cast(a[2]); - t[2] += static_cast(b[3]); - t[3] += static_cast(b[2]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[1]); - t[1] += static_cast(a[0]); - t[2] += static_cast(b[1]); - t[3] += static_cast(b[0]); - t[0] *= x; - t[2] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z; - t[2] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - -template -inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[8] * x2 + a[6]; - t[1] = a[7] * x2 + a[5]; - t[2] = b[8] * x2 + b[6]; - t[3] = b[7] * x2 + b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[3]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[3]); - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += static_cast(a[2]); - t[1] += static_cast(a[1]); - t[2] += static_cast(b[2]); - t[3] += static_cast(b[1]); - t[0] *= x2; - t[2] *= x2; - t[0] += static_cast(a[0]); - t[2] += static_cast(b[0]); - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[4]); - t[1] += static_cast(a[5]); - t[2] += static_cast(b[4]); - t[3] += static_cast(b[5]); - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += static_cast(a[6]); - t[1] += static_cast(a[7]); - t[2] += static_cast(b[6]); - t[3] += static_cast(b[7]); - t[0] *= z2; - t[2] *= z2; - t[0] += static_cast(a[8]); - t[2] += static_cast(b[8]); - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - -}}}} // namespaces - -#endif // include guard - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This file is machine generated, do not edit by hand + +// Polynomial evaluation using second order Horners rule +#ifndef BOOST_MATH_TOOLS_RAT_EVAL_9_HPP +#define BOOST_MATH_TOOLS_RAT_EVAL_9_HPP + +namespace boost{ namespace math{ namespace tools{ namespace detail{ + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*) +{ + return static_cast(0); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) +{ + return static_cast(a[0]) / static_cast(b[0]); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) +{ + return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) +{ + return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) +{ + return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0])); +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[4] * x2 + a[2]; + t[1] = a[3] * x2 + a[1]; + t[2] = b[4] * x2 + b[2]; + t[3] = b[3] * x2 + b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[4]); + t[2] += static_cast(b[4]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[5] * x2 + a[3]; + t[1] = a[4] * x2 + a[2]; + t[2] = b[5] * x2 + b[3]; + t[3] = b[4] * x2 + b[2]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[6] * x2 + a[4]; + t[1] = a[5] * x2 + a[3]; + t[2] = b[6] * x2 + b[4]; + t[3] = b[5] * x2 + b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[6]); + t[2] += static_cast(b[6]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[7] * x2 + a[5]; + t[1] = a[6] * x2 + a[4]; + t[2] = b[7] * x2 + b[5]; + t[3] = b[6] * x2 + b[4]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[3]); + t[1] += static_cast(a[2]); + t[2] += static_cast(b[3]); + t[3] += static_cast(b[2]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[1]); + t[1] += static_cast(a[0]); + t[2] += static_cast(b[1]); + t[3] += static_cast(b[0]); + t[0] *= x; + t[2] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z; + t[2] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + +template +inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[8] * x2 + a[6]; + t[1] = a[7] * x2 + a[5]; + t[2] = b[8] * x2 + b[6]; + t[3] = b[7] * x2 + b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[3]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[3]); + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += static_cast(a[2]); + t[1] += static_cast(a[1]); + t[2] += static_cast(b[2]); + t[3] += static_cast(b[1]); + t[0] *= x2; + t[2] *= x2; + t[0] += static_cast(a[0]); + t[2] += static_cast(b[0]); + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[4]); + t[1] += static_cast(a[5]); + t[2] += static_cast(b[4]); + t[3] += static_cast(b[5]); + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += static_cast(a[6]); + t[1] += static_cast(a[7]); + t[2] += static_cast(b[6]); + t[3] += static_cast(b[7]); + t[0] *= z2; + t[2] *= z2; + t[0] += static_cast(a[8]); + t[2] += static_cast(b[8]); + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + +}}}} // namespaces + +#endif // include guard + diff --git a/performance/distributions.cpp b/performance/distributions.cpp index e610b4fe4..b4c44306c 100644 --- a/performance/distributions.cpp +++ b/performance/distributions.cpp @@ -1,446 +1,446 @@ - -#include "performance_measure.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -double probabilities[] = { - 1e-5, - 1e-4, - 1e-3, - 1e-2, - 0.05, - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8, - 0.9, - 0.95, - 1-1e-5, - 1-1e-4, - 1-1e-3, - 1-1e-2 -}; - -int int_values[] = { - 1, - 2, - 3, - 5, - 10, - 20, - 50, - 100, - 1000, - 10000, - 100000 -}; - -double real_values[] = { - 1e-5, - 1e-4, - 1e-2, - 1e-1, - 1, - 10, - 100, - 1000, - 10000, - 100000 -}; - -#define BOOST_MATH_DISTRIBUTION2_TEST(name, param1_table, param2_table, random_variable_table, probability_table) \ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist, name), "dist-" BOOST_STRINGIZE(name) "-cdf")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ - unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned j = 0; j < b_size; ++j)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += cdf(boost::math:: BOOST_JOIN(name, _distribution) <>(param1_table[i], param2_table[j]), random_variable_table[k]);\ - }\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * b_size * c_size);\ - }\ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_pdf_, name), "dist-" BOOST_STRINGIZE(name) "-pdf")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ - unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned j = 0; j < b_size; ++j)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += pdf(boost::math:: BOOST_JOIN(name, _distribution) <>(param1_table[i], param2_table[j]), random_variable_table[k]);\ - }\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * b_size * c_size);\ - }\ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_quant, name), "dist-" BOOST_STRINGIZE(name) "-quantile")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ - unsigned c_size = sizeof(probability_table)/sizeof(probability_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned j = 0; j < b_size; ++j)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += quantile(boost::math:: BOOST_JOIN(name, _distribution) <>(param1_table[i], param2_table[j]), probability_table[k]);\ - }\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * b_size * c_size);\ - } - -#define BOOST_MATH_DISTRIBUTION1_TEST(name, param1_table, random_variable_table, probability_table) \ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist, name), "dist-" BOOST_STRINGIZE(name) "-cdf")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += cdf(boost::math:: BOOST_JOIN(name, _distribution) <>(param1_table[i]), random_variable_table[k]);\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * c_size);\ - }\ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_pdf_, name), "dist-" BOOST_STRINGIZE(name) "-pdf")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += pdf(boost::math:: BOOST_JOIN(name, _distribution) <>(param1_table[i]), random_variable_table[k]);\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * c_size);\ - }\ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_quant, name), "dist-" BOOST_STRINGIZE(name) "-quantile")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned c_size = sizeof(probability_table)/sizeof(probability_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += quantile(boost::math:: BOOST_JOIN(name, _distribution) <>(param1_table[i]), probability_table[k]);\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * c_size);\ - } - -BOOST_MATH_DISTRIBUTION2_TEST(beta, probabilities, probabilities, probabilities, probabilities) -BOOST_MATH_DISTRIBUTION2_TEST(binomial, int_values, probabilities, int_values, probabilities) -BOOST_MATH_DISTRIBUTION2_TEST(cauchy, int_values, real_values, int_values, probabilities) -BOOST_MATH_DISTRIBUTION1_TEST(chi_squared, int_values, real_values, probabilities) -BOOST_MATH_DISTRIBUTION1_TEST(exponential, real_values, real_values, probabilities) -BOOST_MATH_DISTRIBUTION2_TEST(fisher_f, int_values, int_values, real_values, probabilities) -BOOST_MATH_DISTRIBUTION2_TEST(gamma, real_values, real_values, real_values, probabilities) -BOOST_MATH_DISTRIBUTION2_TEST(lognormal, real_values, real_values, real_values, probabilities) -BOOST_MATH_DISTRIBUTION2_TEST(negative_binomial, int_values, probabilities, int_values, probabilities) -BOOST_MATH_DISTRIBUTION2_TEST(normal, real_values, real_values, real_values, probabilities) -BOOST_MATH_DISTRIBUTION1_TEST(poisson, real_values, int_values, probabilities) -BOOST_MATH_DISTRIBUTION1_TEST(students_t, int_values, real_values, probabilities) -BOOST_MATH_DISTRIBUTION2_TEST(weibull, real_values, real_values, real_values, probabilities) - -#ifdef TEST_R - -#define MATHLIB_STANDALONE 1 - -extern "C" { -#include "Rmath.h" -} - -#define BOOST_MATH_R_DISTRIBUTION2_TEST(name, param1_table, param2_table, random_variable_table, probability_table) \ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist, name), "dist-" #name "-R-cdf")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ - unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned j = 0; j < b_size; ++j)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += p##name (random_variable_table[k], param1_table[i], param2_table[j], 1, 0);\ - }\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * b_size * c_size);\ - }\ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_pdf_, name), "dist-" #name "-R-pdf")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ - unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned j = 0; j < b_size; ++j)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += d##name (random_variable_table[k], param1_table[i], param2_table[j], 0);\ - }\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * b_size * c_size);\ - }\ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_quant, name), "dist-" #name "-R-quantile")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ - unsigned c_size = sizeof(probability_table)/sizeof(probability_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned j = 0; j < b_size; ++j)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += q##name (probability_table[k], param1_table[i], param2_table[j], 1, 0);\ - }\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * b_size * c_size);\ - } - -#define BOOST_MATH_R_DISTRIBUTION1_TEST(name, param1_table, random_variable_table, probability_table) \ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist, name), "dist-" #name "-R-cdf")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += p##name (random_variable_table[k], param1_table[i], 1, 0);\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * c_size);\ - }\ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_pdf_, name), "dist-" #name "-R-pdf")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += d##name (random_variable_table[k], param1_table[i], 0);\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * c_size);\ - }\ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_quant, name), "dist-" #name "-R-quantile")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned c_size = sizeof(probability_table)/sizeof(probability_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += q##name (probability_table[k], param1_table[i], 1, 0);\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * c_size);\ - } - -BOOST_MATH_R_DISTRIBUTION2_TEST(beta, probabilities, probabilities, probabilities, probabilities) -BOOST_MATH_R_DISTRIBUTION2_TEST(binom, int_values, probabilities, int_values, probabilities) -BOOST_MATH_R_DISTRIBUTION2_TEST(cauchy, int_values, real_values, int_values, probabilities) -BOOST_MATH_R_DISTRIBUTION1_TEST(chisq, int_values, real_values, probabilities) -BOOST_MATH_R_DISTRIBUTION1_TEST(exp, real_values, real_values, probabilities) -BOOST_MATH_R_DISTRIBUTION2_TEST(f, int_values, int_values, real_values, probabilities) -BOOST_MATH_R_DISTRIBUTION2_TEST(gamma, real_values, real_values, real_values, probabilities) -BOOST_MATH_R_DISTRIBUTION2_TEST(lnorm, real_values, real_values, real_values, probabilities) -BOOST_MATH_R_DISTRIBUTION2_TEST(nbinom, int_values, probabilities, int_values, probabilities) -BOOST_MATH_R_DISTRIBUTION2_TEST(norm, real_values, real_values, real_values, probabilities) -BOOST_MATH_R_DISTRIBUTION1_TEST(pois, real_values, int_values, probabilities) -BOOST_MATH_R_DISTRIBUTION1_TEST(t, int_values, real_values, probabilities) -BOOST_MATH_R_DISTRIBUTION2_TEST(weibull, real_values, real_values, real_values, probabilities) - -#endif - -#ifdef TEST_CEPHES - -extern "C"{ - -double bdtr(int k, int n, double p); -double bdtri(int k, int n, double p); - -double chdtr(double df, double x); -double chdtri(double df, double p); - -double fdtr(int k, int n, double p); -double fdtri(int k, int n, double p); - -double nbdtr(int k, int n, double p); -double nbdtri(int k, int n, double p); - -} - -#define BOOST_MATH_CEPHES_DISTRIBUTION2_TEST(name, param1_table, param2_table, random_variable_table, probability_table) \ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist, name), "dist-" #name "-cephes-cdf")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ - unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned j = 0; j < b_size; ++j)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += name##dtr (param1_table[i], param2_table[j], random_variable_table[k]);\ - }\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * b_size * c_size);\ - }\ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_quant, name), "dist-" #name "-cephes-quantile")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ - unsigned c_size = sizeof(probability_table)/sizeof(probability_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned j = 0; j < b_size; ++j)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += name##dtri (param1_table[i], param2_table[j], probability_table[k]);\ - }\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * b_size * c_size);\ - } - -#define BOOST_MATH_CEPHES_DISTRIBUTION1_TEST(name, param1_table, random_variable_table, probability_table) \ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist, name), "dist-" #name "-cephes-cdf")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += name##dtr (param1_table[i], random_variable_table[k]);\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * c_size);\ - }\ - BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_quant, name), "dist-" #name "-cephes-quantile")\ - {\ - double result = 0;\ - unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ - unsigned c_size = sizeof(probability_table)/sizeof(probability_table[0]);\ - \ - for(unsigned i = 0; i < a_size; ++i)\ - {\ - for(unsigned k = 0; k < c_size; ++k)\ - {\ - result += name##dtri (param1_table[i], probability_table[k]);\ - }\ - }\ - \ - consume_result(result);\ - set_call_count(a_size * c_size);\ - } -// Cephes inverse doesn't actually calculate the quantile!!! -// BOOST_MATH_CEPHES_DISTRIBUTION2_TEST(b, int_values, int_values, probabilities, probabilities) -BOOST_MATH_CEPHES_DISTRIBUTION1_TEST(ch, int_values, real_values, probabilities) -BOOST_MATH_CEPHES_DISTRIBUTION2_TEST(f, int_values, int_values, real_values, probabilities) -// Cephes inverse doesn't calculate the quantile!!! -// BOOST_MATH_CEPHES_DISTRIBUTION2_TEST(nb, int_values, int_values, probabilities, probabilities) - -#endif - + +#include "performance_measure.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +double probabilities[] = { + 1e-5, + 1e-4, + 1e-3, + 1e-2, + 0.05, + 0.1, + 0.2, + 0.3, + 0.4, + 0.5, + 0.6, + 0.7, + 0.8, + 0.9, + 0.95, + 1-1e-5, + 1-1e-4, + 1-1e-3, + 1-1e-2 +}; + +int int_values[] = { + 1, + 2, + 3, + 5, + 10, + 20, + 50, + 100, + 1000, + 10000, + 100000 +}; + +double real_values[] = { + 1e-5, + 1e-4, + 1e-2, + 1e-1, + 1, + 10, + 100, + 1000, + 10000, + 100000 +}; + +#define BOOST_MATH_DISTRIBUTION2_TEST(name, param1_table, param2_table, random_variable_table, probability_table) \ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist, name), "dist-" BOOST_STRINGIZE(name) "-cdf")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ + unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned j = 0; j < b_size; ++j)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += cdf(boost::math:: BOOST_JOIN(name, _distribution) <>(param1_table[i], param2_table[j]), random_variable_table[k]);\ + }\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * b_size * c_size);\ + }\ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_pdf_, name), "dist-" BOOST_STRINGIZE(name) "-pdf")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ + unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned j = 0; j < b_size; ++j)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += pdf(boost::math:: BOOST_JOIN(name, _distribution) <>(param1_table[i], param2_table[j]), random_variable_table[k]);\ + }\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * b_size * c_size);\ + }\ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_quant, name), "dist-" BOOST_STRINGIZE(name) "-quantile")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ + unsigned c_size = sizeof(probability_table)/sizeof(probability_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned j = 0; j < b_size; ++j)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += quantile(boost::math:: BOOST_JOIN(name, _distribution) <>(param1_table[i], param2_table[j]), probability_table[k]);\ + }\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * b_size * c_size);\ + } + +#define BOOST_MATH_DISTRIBUTION1_TEST(name, param1_table, random_variable_table, probability_table) \ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist, name), "dist-" BOOST_STRINGIZE(name) "-cdf")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += cdf(boost::math:: BOOST_JOIN(name, _distribution) <>(param1_table[i]), random_variable_table[k]);\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * c_size);\ + }\ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_pdf_, name), "dist-" BOOST_STRINGIZE(name) "-pdf")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += pdf(boost::math:: BOOST_JOIN(name, _distribution) <>(param1_table[i]), random_variable_table[k]);\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * c_size);\ + }\ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_quant, name), "dist-" BOOST_STRINGIZE(name) "-quantile")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned c_size = sizeof(probability_table)/sizeof(probability_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += quantile(boost::math:: BOOST_JOIN(name, _distribution) <>(param1_table[i]), probability_table[k]);\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * c_size);\ + } + +BOOST_MATH_DISTRIBUTION2_TEST(beta, probabilities, probabilities, probabilities, probabilities) +BOOST_MATH_DISTRIBUTION2_TEST(binomial, int_values, probabilities, int_values, probabilities) +BOOST_MATH_DISTRIBUTION2_TEST(cauchy, int_values, real_values, int_values, probabilities) +BOOST_MATH_DISTRIBUTION1_TEST(chi_squared, int_values, real_values, probabilities) +BOOST_MATH_DISTRIBUTION1_TEST(exponential, real_values, real_values, probabilities) +BOOST_MATH_DISTRIBUTION2_TEST(fisher_f, int_values, int_values, real_values, probabilities) +BOOST_MATH_DISTRIBUTION2_TEST(gamma, real_values, real_values, real_values, probabilities) +BOOST_MATH_DISTRIBUTION2_TEST(lognormal, real_values, real_values, real_values, probabilities) +BOOST_MATH_DISTRIBUTION2_TEST(negative_binomial, int_values, probabilities, int_values, probabilities) +BOOST_MATH_DISTRIBUTION2_TEST(normal, real_values, real_values, real_values, probabilities) +BOOST_MATH_DISTRIBUTION1_TEST(poisson, real_values, int_values, probabilities) +BOOST_MATH_DISTRIBUTION1_TEST(students_t, int_values, real_values, probabilities) +BOOST_MATH_DISTRIBUTION2_TEST(weibull, real_values, real_values, real_values, probabilities) + +#ifdef TEST_R + +#define MATHLIB_STANDALONE 1 + +extern "C" { +#include "Rmath.h" +} + +#define BOOST_MATH_R_DISTRIBUTION2_TEST(name, param1_table, param2_table, random_variable_table, probability_table) \ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist, name), "dist-" #name "-R-cdf")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ + unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned j = 0; j < b_size; ++j)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += p##name (random_variable_table[k], param1_table[i], param2_table[j], 1, 0);\ + }\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * b_size * c_size);\ + }\ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_pdf_, name), "dist-" #name "-R-pdf")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ + unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned j = 0; j < b_size; ++j)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += d##name (random_variable_table[k], param1_table[i], param2_table[j], 0);\ + }\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * b_size * c_size);\ + }\ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_quant, name), "dist-" #name "-R-quantile")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ + unsigned c_size = sizeof(probability_table)/sizeof(probability_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned j = 0; j < b_size; ++j)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += q##name (probability_table[k], param1_table[i], param2_table[j], 1, 0);\ + }\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * b_size * c_size);\ + } + +#define BOOST_MATH_R_DISTRIBUTION1_TEST(name, param1_table, random_variable_table, probability_table) \ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist, name), "dist-" #name "-R-cdf")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += p##name (random_variable_table[k], param1_table[i], 1, 0);\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * c_size);\ + }\ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_pdf_, name), "dist-" #name "-R-pdf")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += d##name (random_variable_table[k], param1_table[i], 0);\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * c_size);\ + }\ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_quant, name), "dist-" #name "-R-quantile")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned c_size = sizeof(probability_table)/sizeof(probability_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += q##name (probability_table[k], param1_table[i], 1, 0);\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * c_size);\ + } + +BOOST_MATH_R_DISTRIBUTION2_TEST(beta, probabilities, probabilities, probabilities, probabilities) +BOOST_MATH_R_DISTRIBUTION2_TEST(binom, int_values, probabilities, int_values, probabilities) +BOOST_MATH_R_DISTRIBUTION2_TEST(cauchy, int_values, real_values, int_values, probabilities) +BOOST_MATH_R_DISTRIBUTION1_TEST(chisq, int_values, real_values, probabilities) +BOOST_MATH_R_DISTRIBUTION1_TEST(exp, real_values, real_values, probabilities) +BOOST_MATH_R_DISTRIBUTION2_TEST(f, int_values, int_values, real_values, probabilities) +BOOST_MATH_R_DISTRIBUTION2_TEST(gamma, real_values, real_values, real_values, probabilities) +BOOST_MATH_R_DISTRIBUTION2_TEST(lnorm, real_values, real_values, real_values, probabilities) +BOOST_MATH_R_DISTRIBUTION2_TEST(nbinom, int_values, probabilities, int_values, probabilities) +BOOST_MATH_R_DISTRIBUTION2_TEST(norm, real_values, real_values, real_values, probabilities) +BOOST_MATH_R_DISTRIBUTION1_TEST(pois, real_values, int_values, probabilities) +BOOST_MATH_R_DISTRIBUTION1_TEST(t, int_values, real_values, probabilities) +BOOST_MATH_R_DISTRIBUTION2_TEST(weibull, real_values, real_values, real_values, probabilities) + +#endif + +#ifdef TEST_CEPHES + +extern "C"{ + +double bdtr(int k, int n, double p); +double bdtri(int k, int n, double p); + +double chdtr(double df, double x); +double chdtri(double df, double p); + +double fdtr(int k, int n, double p); +double fdtri(int k, int n, double p); + +double nbdtr(int k, int n, double p); +double nbdtri(int k, int n, double p); + +} + +#define BOOST_MATH_CEPHES_DISTRIBUTION2_TEST(name, param1_table, param2_table, random_variable_table, probability_table) \ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist, name), "dist-" #name "-cephes-cdf")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ + unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned j = 0; j < b_size; ++j)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += name##dtr (param1_table[i], param2_table[j], random_variable_table[k]);\ + }\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * b_size * c_size);\ + }\ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_quant, name), "dist-" #name "-cephes-quantile")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned b_size = sizeof(param2_table)/sizeof(param2_table[0]);\ + unsigned c_size = sizeof(probability_table)/sizeof(probability_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned j = 0; j < b_size; ++j)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += name##dtri (param1_table[i], param2_table[j], probability_table[k]);\ + }\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * b_size * c_size);\ + } + +#define BOOST_MATH_CEPHES_DISTRIBUTION1_TEST(name, param1_table, random_variable_table, probability_table) \ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist, name), "dist-" #name "-cephes-cdf")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned c_size = sizeof(random_variable_table)/sizeof(random_variable_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += name##dtr (param1_table[i], random_variable_table[k]);\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * c_size);\ + }\ + BOOST_MATH_PERFORMANCE_TEST(BOOST_JOIN(dist_quant, name), "dist-" #name "-cephes-quantile")\ + {\ + double result = 0;\ + unsigned a_size = sizeof(param1_table)/sizeof(param1_table[0]);\ + unsigned c_size = sizeof(probability_table)/sizeof(probability_table[0]);\ + \ + for(unsigned i = 0; i < a_size; ++i)\ + {\ + for(unsigned k = 0; k < c_size; ++k)\ + {\ + result += name##dtri (param1_table[i], probability_table[k]);\ + }\ + }\ + \ + consume_result(result);\ + set_call_count(a_size * c_size);\ + } +// Cephes inverse doesn't actually calculate the quantile!!! +// BOOST_MATH_CEPHES_DISTRIBUTION2_TEST(b, int_values, int_values, probabilities, probabilities) +BOOST_MATH_CEPHES_DISTRIBUTION1_TEST(ch, int_values, real_values, probabilities) +BOOST_MATH_CEPHES_DISTRIBUTION2_TEST(f, int_values, int_values, real_values, probabilities) +// Cephes inverse doesn't calculate the quantile!!! +// BOOST_MATH_CEPHES_DISTRIBUTION2_TEST(nb, int_values, int_values, probabilities, probabilities) + +#endif + diff --git a/performance/main.cpp b/performance/main.cpp index f52bb60d5..e117fea22 100644 --- a/performance/main.cpp +++ b/performance/main.cpp @@ -1,135 +1,135 @@ - -#include -#include -#include -#include -#include -#include -#include "performance_measure.hpp" - -extern void reference_evaluate(); - -std::map times; -std::set tests; -double total = 0; -int call_count = 0; - -std::set& all_tests() -{ - static std::set i; - return i; -} - -void add_new_test(test_info i) -{ - all_tests().insert(i); -} - -void set_call_count(int i) -{ - call_count = i; -} - -void show_help() -{ - std::cout << "Specify on the command line which functions to test.\n" - "Available options are:\n"; - std::set::const_iterator i(all_tests().begin()), j(all_tests().end()); - while(i != j) - { - std::cout << " --" << (*i).name << std::endl; - ++i; - } - std::cout << "Or use --all to test everything." << std::endl; -} - -void run_tests() -{ - // Get time for empty proceedure: - double reference_time = performance_measure(reference_evaluate); - - std::set::const_iterator i, j; - for(i = tests.begin(), j = tests.end(); i != j; ++i) - { - set_call_count(1); - std::cout << "Testing " << std::left << std::setw(40) << i->name << std::flush; - double time = performance_measure(i->proc) - reference_time; - time /= call_count; - std::cout << std::setprecision(3) << std::scientific << time << std::endl; - } -} - -int main(int argc, const char** argv) -{ - try{ - - if(argc >= 2) - { - for(int i = 1; i < argc; ++i) - { - if(std::strcmp(argv[i], "--help") == 0) - { - show_help(); - } - else if(std::strcmp(argv[i], "--all") == 0) - { - std::set::const_iterator a(all_tests().begin()), b(all_tests().end()); - while(a != b) - { - tests.insert(*a); - ++a; - } - } - else - { - bool found = false; - if((argv[i][0] == '-') && (argv[i][1] == '-')) - { - std::set::const_iterator a(all_tests().begin()), b(all_tests().end()); - while(a != b) - { - if(std::strcmp(argv[i] + 2, (*a).name) == 0) - { - found = true; - tests.insert(*a); - break; - } - ++a; - } - } - if(!found) - { - std::cerr << "Unknown option: " << argv[i] << std::endl; - return 1; - } - } - } - run_tests(); - } - else - { - show_help(); - } - // - // This is just to confuse the optimisers: - // - if(argc == 100000) - { - std::cerr << total << std::endl; - } - - } - catch(const std::exception& e) - { - std::cerr << e.what() << std::endl; - } - - return 0; -} - -void consume_result(double x) -{ - // Do nothing proceedure, don't let whole program optimisation - // optimise this away - doing so may cause false readings.... - total += x; -} + +#include +#include +#include +#include +#include +#include +#include "performance_measure.hpp" + +extern void reference_evaluate(); + +std::map times; +std::set tests; +double total = 0; +int call_count = 0; + +std::set& all_tests() +{ + static std::set i; + return i; +} + +void add_new_test(test_info i) +{ + all_tests().insert(i); +} + +void set_call_count(int i) +{ + call_count = i; +} + +void show_help() +{ + std::cout << "Specify on the command line which functions to test.\n" + "Available options are:\n"; + std::set::const_iterator i(all_tests().begin()), j(all_tests().end()); + while(i != j) + { + std::cout << " --" << (*i).name << std::endl; + ++i; + } + std::cout << "Or use --all to test everything." << std::endl; +} + +void run_tests() +{ + // Get time for empty proceedure: + double reference_time = performance_measure(reference_evaluate); + + std::set::const_iterator i, j; + for(i = tests.begin(), j = tests.end(); i != j; ++i) + { + set_call_count(1); + std::cout << "Testing " << std::left << std::setw(40) << i->name << std::flush; + double time = performance_measure(i->proc) - reference_time; + time /= call_count; + std::cout << std::setprecision(3) << std::scientific << time << std::endl; + } +} + +int main(int argc, const char** argv) +{ + try{ + + if(argc >= 2) + { + for(int i = 1; i < argc; ++i) + { + if(std::strcmp(argv[i], "--help") == 0) + { + show_help(); + } + else if(std::strcmp(argv[i], "--all") == 0) + { + std::set::const_iterator a(all_tests().begin()), b(all_tests().end()); + while(a != b) + { + tests.insert(*a); + ++a; + } + } + else + { + bool found = false; + if((argv[i][0] == '-') && (argv[i][1] == '-')) + { + std::set::const_iterator a(all_tests().begin()), b(all_tests().end()); + while(a != b) + { + if(std::strcmp(argv[i] + 2, (*a).name) == 0) + { + found = true; + tests.insert(*a); + break; + } + ++a; + } + } + if(!found) + { + std::cerr << "Unknown option: " << argv[i] << std::endl; + return 1; + } + } + } + run_tests(); + } + else + { + show_help(); + } + // + // This is just to confuse the optimisers: + // + if(argc == 100000) + { + std::cerr << total << std::endl; + } + + } + catch(const std::exception& e) + { + std::cerr << e.what() << std::endl; + } + + return 0; +} + +void consume_result(double x) +{ + // Do nothing proceedure, don't let whole program optimisation + // optimise this away - doing so may cause false readings.... + total += x; +} diff --git a/performance/performance_measure.hpp b/performance/performance_measure.hpp index ab7ddf768..eb8f76e2f 100644 --- a/performance/performance_measure.hpp +++ b/performance/performance_measure.hpp @@ -1,81 +1,81 @@ - -#ifndef BOOST_MATH_PERFORMANCE_MEASURE_HPP -#define BOOST_MATH_PERFORMANCE_MEASURE_HPP - -#include -#include -#include - -template -double performance_measure(F f) -{ - unsigned count = 1; - double time, result; - // - // Begin by figuring out how many times to repeat - // the function call in order to get a measureable time: - // - do - { - boost::timer t; - for(unsigned i = 0; i < count; ++i) - f(); - time = t.elapsed(); - count *= 2; - t.restart(); - }while(time < 0.5); - - count /= 2; - result = time; - // - // Now repeat the measurement over and over - // and take the shortest measured time as the - // result, generally speaking this gives us - // consistent results: - // - for(unsigned i = 0; i < 10u;++i) - { - boost::timer t; - for(unsigned i = 0; i < count; ++i) - f(); - time = t.elapsed(); - if(time < result) - result = time; - t.restart(); - } - return result / count; -} - -struct test_info -{ - test_info(const char* n, void (*p)()); - const char* name; - void (*proc)(); -}; - -inline bool operator < (const test_info& a, const test_info& b) -{ - return std::strcmp(a.name, b.name) < 0; -} - -extern void consume_result(double); -extern void set_call_count(int i); -extern void add_new_test(test_info i); - -inline test_info::test_info(const char* n, void (*p)()) -{ - name = n; - proc = p; - add_new_test(*this); -} - -#define BOOST_MATH_PERFORMANCE_TEST(name, string) \ - void BOOST_JOIN(name, __LINE__) ();\ - namespace{\ - test_info BOOST_JOIN(BOOST_JOIN(name, _init), __LINE__)(string, BOOST_JOIN(name, __LINE__));\ - }\ - void BOOST_JOIN(name, __LINE__) () - - - -#endif // BOOST_MATH_PERFORMANCE_MEASURE_HPP + +#ifndef BOOST_MATH_PERFORMANCE_MEASURE_HPP +#define BOOST_MATH_PERFORMANCE_MEASURE_HPP + +#include +#include +#include + +template +double performance_measure(F f) +{ + unsigned count = 1; + double time, result; + // + // Begin by figuring out how many times to repeat + // the function call in order to get a measureable time: + // + do + { + boost::timer t; + for(unsigned i = 0; i < count; ++i) + f(); + time = t.elapsed(); + count *= 2; + t.restart(); + }while(time < 0.5); + + count /= 2; + result = time; + // + // Now repeat the measurement over and over + // and take the shortest measured time as the + // result, generally speaking this gives us + // consistent results: + // + for(unsigned i = 0; i < 10u;++i) + { + boost::timer t; + for(unsigned i = 0; i < count; ++i) + f(); + time = t.elapsed(); + if(time < result) + result = time; + t.restart(); + } + return result / count; +} + +struct test_info +{ + test_info(const char* n, void (*p)()); + const char* name; + void (*proc)(); +}; + +inline bool operator < (const test_info& a, const test_info& b) +{ + return std::strcmp(a.name, b.name) < 0; +} + +extern void consume_result(double); +extern void set_call_count(int i); +extern void add_new_test(test_info i); + +inline test_info::test_info(const char* n, void (*p)()) +{ + name = n; + proc = p; + add_new_test(*this); +} + +#define BOOST_MATH_PERFORMANCE_TEST(name, string) \ + void BOOST_JOIN(name, __LINE__) ();\ + namespace{\ + test_info BOOST_JOIN(BOOST_JOIN(name, _init), __LINE__)(string, BOOST_JOIN(name, __LINE__));\ + }\ + void BOOST_JOIN(name, __LINE__) () + + + +#endif // BOOST_MATH_PERFORMANCE_MEASURE_HPP diff --git a/performance/test_erf.cpp b/performance/test_erf.cpp index 81e787f77..dc834cae5 100644 --- a/performance/test_erf.cpp +++ b/performance/test_erf.cpp @@ -1,104 +1,104 @@ - -#include "performance_measure.hpp" - -#include -#include - -#define T double -#include "../test/erf_data.ipp" -#include "../test/erf_large_data.ipp" -#include "../test/erf_small_data.ipp" - -template -double erf_evaluate2(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += boost::math::erf(data[i][0]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(erf_test, "erf") -{ - double result = erf_evaluate2(erf_data); - result += erf_evaluate2(erf_large_data); - result += erf_evaluate2(erf_small_data); - - consume_result(result); - set_call_count((sizeof(erf_data) + sizeof(erf_large_data) + sizeof(erf_small_data)) / sizeof(erf_data[0])); -} - -template -double erf_inv_evaluate2(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += boost::math::erf_inv(data[i][1]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(erf_inv_test, "erf_inv") -{ - double result = erf_inv_evaluate2(erf_data); - result += erf_inv_evaluate2(erf_large_data); - result += erf_inv_evaluate2(erf_small_data); - - consume_result(result); - set_call_count((sizeof(erf_data) + sizeof(erf_large_data) + sizeof(erf_small_data)) / sizeof(erf_data[0])); -} - -#ifdef TEST_CEPHES - -extern "C" { - -double erf(double); - -} - -template -double erf_evaluate_cephes(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += erf(data[i][0]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(erf_test, "erf-cephes") -{ - double result = erf_evaluate_cephes(erf_data); - result += erf_evaluate_cephes(erf_large_data); - result += erf_evaluate_cephes(erf_small_data); - - consume_result(result); - set_call_count((sizeof(erf_data) + sizeof(erf_large_data) + sizeof(erf_small_data)) / sizeof(erf_data[0])); -} - -#endif - -#ifdef TEST_GSL - -#include - -template -double erf_evaluate_gsl(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += gsl_sf_erf (data[i][0]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(erf_test, "erf-gsl") -{ - double result = erf_evaluate_gsl(erf_data); - result += erf_evaluate_gsl(erf_large_data); - result += erf_evaluate_gsl(erf_small_data); - - consume_result(result); - set_call_count((sizeof(erf_data) + sizeof(erf_large_data) + sizeof(erf_small_data)) / sizeof(erf_data[0])); -} - -#endif - - + +#include "performance_measure.hpp" + +#include +#include + +#define T double +#include "../test/erf_data.ipp" +#include "../test/erf_large_data.ipp" +#include "../test/erf_small_data.ipp" + +template +double erf_evaluate2(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += boost::math::erf(data[i][0]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(erf_test, "erf") +{ + double result = erf_evaluate2(erf_data); + result += erf_evaluate2(erf_large_data); + result += erf_evaluate2(erf_small_data); + + consume_result(result); + set_call_count((sizeof(erf_data) + sizeof(erf_large_data) + sizeof(erf_small_data)) / sizeof(erf_data[0])); +} + +template +double erf_inv_evaluate2(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += boost::math::erf_inv(data[i][1]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(erf_inv_test, "erf_inv") +{ + double result = erf_inv_evaluate2(erf_data); + result += erf_inv_evaluate2(erf_large_data); + result += erf_inv_evaluate2(erf_small_data); + + consume_result(result); + set_call_count((sizeof(erf_data) + sizeof(erf_large_data) + sizeof(erf_small_data)) / sizeof(erf_data[0])); +} + +#ifdef TEST_CEPHES + +extern "C" { + +double erf(double); + +} + +template +double erf_evaluate_cephes(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += erf(data[i][0]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(erf_test, "erf-cephes") +{ + double result = erf_evaluate_cephes(erf_data); + result += erf_evaluate_cephes(erf_large_data); + result += erf_evaluate_cephes(erf_small_data); + + consume_result(result); + set_call_count((sizeof(erf_data) + sizeof(erf_large_data) + sizeof(erf_small_data)) / sizeof(erf_data[0])); +} + +#endif + +#ifdef TEST_GSL + +#include + +template +double erf_evaluate_gsl(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += gsl_sf_erf (data[i][0]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(erf_test, "erf-gsl") +{ + double result = erf_evaluate_gsl(erf_data); + result += erf_evaluate_gsl(erf_large_data); + result += erf_evaluate_gsl(erf_small_data); + + consume_result(result); + set_call_count((sizeof(erf_data) + sizeof(erf_large_data) + sizeof(erf_small_data)) / sizeof(erf_data[0])); +} + +#endif + + diff --git a/performance/test_gamma.cpp b/performance/test_gamma.cpp index 61e47c317..7c9e0f788 100644 --- a/performance/test_gamma.cpp +++ b/performance/test_gamma.cpp @@ -1,194 +1,194 @@ - -#include "performance_measure.hpp" - -#include -#include - -#define T double -#include "../test/test_gamma_data.ipp" - -template -double gamma_evaluate2(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += boost::math::tgamma(data[i][0]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(gamma_test, "gamma") -{ - double result = gamma_evaluate2(factorials); - result += gamma_evaluate2(near_1); - result += gamma_evaluate2(near_2); - result += gamma_evaluate2(near_0); - result += gamma_evaluate2(near_m10); - result += gamma_evaluate2(near_m55); - - consume_result(result); - set_call_count( - (sizeof(factorials) - + sizeof(near_1) - + sizeof(near_2) - + sizeof(near_0) - + sizeof(near_m10) - + sizeof(near_m55)) / sizeof(factorials[0])); -} - -template -double lgamma_evaluate2(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += boost::math::lgamma(data[i][0]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(lgamma_test, "lgamma") -{ - double result = lgamma_evaluate2(factorials); - result += lgamma_evaluate2(near_1); - result += lgamma_evaluate2(near_2); - result += lgamma_evaluate2(near_0); - result += lgamma_evaluate2(near_m10); - result += lgamma_evaluate2(near_m55); - - consume_result(result); - set_call_count( - (sizeof(factorials) - + sizeof(near_1) - + sizeof(near_2) - + sizeof(near_0) - + sizeof(near_m10) - + sizeof(near_m55)) / sizeof(factorials[0])); -} - -#ifdef TEST_CEPHES - -extern "C" { - -double gamma(double); -double lgam(double); - -} - -template -double gamma_evaluate_cephes(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += gamma(data[i][0]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(gamma_test, "gamma-cephes") -{ - double result = gamma_evaluate_cephes(factorials); - result += gamma_evaluate_cephes(near_1); - result += gamma_evaluate_cephes(near_2); - result += gamma_evaluate_cephes(near_0); - result += gamma_evaluate_cephes(near_m10); - result += gamma_evaluate_cephes(near_m55); - - consume_result(result); - set_call_count( - (sizeof(factorials) - + sizeof(near_1) - + sizeof(near_2) - + sizeof(near_0) - + sizeof(near_m10) - + sizeof(near_m55)) / sizeof(factorials[0])); -} - -template -double lgamma_evaluate_cephes(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += lgam(data[i][0]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(lgamma_test, "lgamma-cephes") -{ - double result = lgamma_evaluate_cephes(factorials); - result += lgamma_evaluate_cephes(near_1); - result += lgamma_evaluate_cephes(near_2); - result += lgamma_evaluate_cephes(near_0); - result += lgamma_evaluate_cephes(near_m10); - result += lgamma_evaluate_cephes(near_m55); - - consume_result(result); - set_call_count( - (sizeof(factorials) - + sizeof(near_1) - + sizeof(near_2) - + sizeof(near_0) - + sizeof(near_m10) - + sizeof(near_m55)) / sizeof(factorials[0])); -} - -#endif - -#ifdef TEST_GSL - -#include - -template -double gamma_evaluate_gsl(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += gsl_sf_gamma(data[i][0]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(gamma_test, "gamma-gsl") -{ - double result = gamma_evaluate_gsl(factorials); - result += gamma_evaluate_gsl(near_1); - result += gamma_evaluate_gsl(near_2); - result += gamma_evaluate_gsl(near_0); - result += gamma_evaluate_gsl(near_m10); - result += gamma_evaluate_gsl(near_m55); - - consume_result(result); - set_call_count( - (sizeof(factorials) - + sizeof(near_1) - + sizeof(near_2) - + sizeof(near_0) - + sizeof(near_m10) - + sizeof(near_m55)) / sizeof(factorials[0])); -} - -template -double lgamma_evaluate_gsl(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += gsl_sf_lngamma(data[i][0]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(lgamma_test, "lgamma-gsl") -{ - double result = lgamma_evaluate_gsl(factorials); - result += lgamma_evaluate_gsl(near_1); - result += lgamma_evaluate_gsl(near_2); - result += lgamma_evaluate_gsl(near_0); - result += lgamma_evaluate_gsl(near_m10); - result += lgamma_evaluate_gsl(near_m55); - - consume_result(result); - set_call_count( - (sizeof(factorials) - + sizeof(near_1) - + sizeof(near_2) - + sizeof(near_0) - + sizeof(near_m10) - + sizeof(near_m55)) / sizeof(factorials[0])); -} - -#endif - + +#include "performance_measure.hpp" + +#include +#include + +#define T double +#include "../test/test_gamma_data.ipp" + +template +double gamma_evaluate2(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += boost::math::tgamma(data[i][0]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(gamma_test, "gamma") +{ + double result = gamma_evaluate2(factorials); + result += gamma_evaluate2(near_1); + result += gamma_evaluate2(near_2); + result += gamma_evaluate2(near_0); + result += gamma_evaluate2(near_m10); + result += gamma_evaluate2(near_m55); + + consume_result(result); + set_call_count( + (sizeof(factorials) + + sizeof(near_1) + + sizeof(near_2) + + sizeof(near_0) + + sizeof(near_m10) + + sizeof(near_m55)) / sizeof(factorials[0])); +} + +template +double lgamma_evaluate2(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += boost::math::lgamma(data[i][0]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(lgamma_test, "lgamma") +{ + double result = lgamma_evaluate2(factorials); + result += lgamma_evaluate2(near_1); + result += lgamma_evaluate2(near_2); + result += lgamma_evaluate2(near_0); + result += lgamma_evaluate2(near_m10); + result += lgamma_evaluate2(near_m55); + + consume_result(result); + set_call_count( + (sizeof(factorials) + + sizeof(near_1) + + sizeof(near_2) + + sizeof(near_0) + + sizeof(near_m10) + + sizeof(near_m55)) / sizeof(factorials[0])); +} + +#ifdef TEST_CEPHES + +extern "C" { + +double gamma(double); +double lgam(double); + +} + +template +double gamma_evaluate_cephes(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += gamma(data[i][0]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(gamma_test, "gamma-cephes") +{ + double result = gamma_evaluate_cephes(factorials); + result += gamma_evaluate_cephes(near_1); + result += gamma_evaluate_cephes(near_2); + result += gamma_evaluate_cephes(near_0); + result += gamma_evaluate_cephes(near_m10); + result += gamma_evaluate_cephes(near_m55); + + consume_result(result); + set_call_count( + (sizeof(factorials) + + sizeof(near_1) + + sizeof(near_2) + + sizeof(near_0) + + sizeof(near_m10) + + sizeof(near_m55)) / sizeof(factorials[0])); +} + +template +double lgamma_evaluate_cephes(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += lgam(data[i][0]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(lgamma_test, "lgamma-cephes") +{ + double result = lgamma_evaluate_cephes(factorials); + result += lgamma_evaluate_cephes(near_1); + result += lgamma_evaluate_cephes(near_2); + result += lgamma_evaluate_cephes(near_0); + result += lgamma_evaluate_cephes(near_m10); + result += lgamma_evaluate_cephes(near_m55); + + consume_result(result); + set_call_count( + (sizeof(factorials) + + sizeof(near_1) + + sizeof(near_2) + + sizeof(near_0) + + sizeof(near_m10) + + sizeof(near_m55)) / sizeof(factorials[0])); +} + +#endif + +#ifdef TEST_GSL + +#include + +template +double gamma_evaluate_gsl(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += gsl_sf_gamma(data[i][0]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(gamma_test, "gamma-gsl") +{ + double result = gamma_evaluate_gsl(factorials); + result += gamma_evaluate_gsl(near_1); + result += gamma_evaluate_gsl(near_2); + result += gamma_evaluate_gsl(near_0); + result += gamma_evaluate_gsl(near_m10); + result += gamma_evaluate_gsl(near_m55); + + consume_result(result); + set_call_count( + (sizeof(factorials) + + sizeof(near_1) + + sizeof(near_2) + + sizeof(near_0) + + sizeof(near_m10) + + sizeof(near_m55)) / sizeof(factorials[0])); +} + +template +double lgamma_evaluate_gsl(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += gsl_sf_lngamma(data[i][0]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(lgamma_test, "lgamma-gsl") +{ + double result = lgamma_evaluate_gsl(factorials); + result += lgamma_evaluate_gsl(near_1); + result += lgamma_evaluate_gsl(near_2); + result += lgamma_evaluate_gsl(near_0); + result += lgamma_evaluate_gsl(near_m10); + result += lgamma_evaluate_gsl(near_m55); + + consume_result(result); + set_call_count( + (sizeof(factorials) + + sizeof(near_1) + + sizeof(near_2) + + sizeof(near_0) + + sizeof(near_m10) + + sizeof(near_m55)) / sizeof(factorials[0])); +} + +#endif + diff --git a/performance/test_ibeta.cpp b/performance/test_ibeta.cpp index 6f254e082..f1b7d99a4 100644 --- a/performance/test_ibeta.cpp +++ b/performance/test_ibeta.cpp @@ -1,181 +1,181 @@ - -#include "performance_measure.hpp" - -#include -#include - -#define T double -#include "../test/ibeta_data.ipp" -#include "../test/ibeta_int_data.ipp" -#include "../test/ibeta_large_data.ipp" -#include "../test/ibeta_small_data.ipp" - -template -double ibeta_evaluate2(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += boost::math::ibeta(data[i][0], data[i][1], data[i][2]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(ibeta_test, "ibeta") -{ - double result = ibeta_evaluate2(ibeta_data); - result += ibeta_evaluate2(ibeta_int_data); - result += ibeta_evaluate2(ibeta_large_data); - result += ibeta_evaluate2(ibeta_small_data); - - consume_result(result); - set_call_count( - (sizeof(ibeta_data) - + sizeof(ibeta_int_data) - + sizeof(ibeta_large_data) - + sizeof(ibeta_small_data)) / sizeof(ibeta_data[0])); -} - -template -double ibeta_inv_evaluate2(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += boost::math::ibeta_inv(data[i][0], data[i][1], data[i][5]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(ibeta_inv_test, "ibeta_inv") -{ - double result = ibeta_inv_evaluate2(ibeta_data); - result += ibeta_inv_evaluate2(ibeta_int_data); - result += ibeta_inv_evaluate2(ibeta_large_data); - result += ibeta_inv_evaluate2(ibeta_small_data); - - consume_result(result); - set_call_count( - (sizeof(ibeta_data) - + sizeof(ibeta_int_data) - + sizeof(ibeta_large_data) - + sizeof(ibeta_small_data)) / sizeof(ibeta_data[0])); -} - -template -double ibeta_invab_evaluate2(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - { - result += boost::math::ibeta_inva(data[i][1], data[i][2], data[i][5]); - result += boost::math::ibeta_invb(data[i][0], data[i][2], data[i][5]); - result += boost::math::ibetac_inva(data[i][1], data[i][2], data[i][6]); - result += boost::math::ibetac_invb(data[i][0], data[i][2], data[i][6]); - } - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(ibeta_test, "ibeta_invab") -{ - double result = ibeta_invab_evaluate2(ibeta_data); - result += ibeta_invab_evaluate2(ibeta_int_data); - result += ibeta_invab_evaluate2(ibeta_large_data); - result += ibeta_invab_evaluate2(ibeta_small_data); - - consume_result(result); - set_call_count( - 4 * (sizeof(ibeta_data) - + sizeof(ibeta_int_data) - + sizeof(ibeta_large_data) - + sizeof(ibeta_small_data)) / sizeof(ibeta_data[0])); -} - -#ifdef TEST_CEPHES - -extern "C" { - -double incbet(double a, double b, double x); -double incbi(double a, double b, double y); - -} - -template -double ibeta_evaluate_cephes(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += incbet(data[i][0], data[i][1], data[i][2]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(ibeta_test, "ibeta-cephes") -{ - double result = ibeta_evaluate_cephes(ibeta_data); - result += ibeta_evaluate_cephes(ibeta_int_data); - result += ibeta_evaluate_cephes(ibeta_large_data); - result += ibeta_evaluate_cephes(ibeta_small_data); - - consume_result(result); - set_call_count( - (sizeof(ibeta_data) - + sizeof(ibeta_int_data) - + sizeof(ibeta_large_data) - + sizeof(ibeta_small_data)) / sizeof(ibeta_data[0])); -} - -template -double ibeta_inv_evaluate_cephes(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += incbi(data[i][0], data[i][1], data[i][5]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(ibeta_inv_test, "ibeta_inv-cephes") -{ - double result = ibeta_inv_evaluate_cephes(ibeta_data); - result += ibeta_inv_evaluate_cephes(ibeta_int_data); - result += ibeta_inv_evaluate_cephes(ibeta_large_data); - result += ibeta_inv_evaluate_cephes(ibeta_small_data); - - consume_result(result); - set_call_count( - (sizeof(ibeta_data) - + sizeof(ibeta_int_data) - + sizeof(ibeta_large_data) - + sizeof(ibeta_small_data)) / sizeof(ibeta_data[0])); -} - -#endif - -#ifdef TEST_GSL___ -// -// This test segfaults inside GSL.... -// - -#include - -template -double ibeta_evaluate_gsl(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += gsl_sf_beta_inc(data[i][0], data[i][1], data[i][2]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(ibeta_test, "ibeta-gsl") -{ - double result = ibeta_evaluate_gsl(ibeta_data); - result += ibeta_evaluate_gsl(ibeta_int_data); - result += ibeta_evaluate_gsl(ibeta_large_data); - result += ibeta_evaluate_gsl(ibeta_small_data); - - consume_result(result); - set_call_count( - (sizeof(ibeta_data) - + sizeof(ibeta_int_data) - + sizeof(ibeta_large_data) - + sizeof(ibeta_small_data)) / sizeof(ibeta_data[0])); -} - -#endif - + +#include "performance_measure.hpp" + +#include +#include + +#define T double +#include "../test/ibeta_data.ipp" +#include "../test/ibeta_int_data.ipp" +#include "../test/ibeta_large_data.ipp" +#include "../test/ibeta_small_data.ipp" + +template +double ibeta_evaluate2(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += boost::math::ibeta(data[i][0], data[i][1], data[i][2]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(ibeta_test, "ibeta") +{ + double result = ibeta_evaluate2(ibeta_data); + result += ibeta_evaluate2(ibeta_int_data); + result += ibeta_evaluate2(ibeta_large_data); + result += ibeta_evaluate2(ibeta_small_data); + + consume_result(result); + set_call_count( + (sizeof(ibeta_data) + + sizeof(ibeta_int_data) + + sizeof(ibeta_large_data) + + sizeof(ibeta_small_data)) / sizeof(ibeta_data[0])); +} + +template +double ibeta_inv_evaluate2(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += boost::math::ibeta_inv(data[i][0], data[i][1], data[i][5]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(ibeta_inv_test, "ibeta_inv") +{ + double result = ibeta_inv_evaluate2(ibeta_data); + result += ibeta_inv_evaluate2(ibeta_int_data); + result += ibeta_inv_evaluate2(ibeta_large_data); + result += ibeta_inv_evaluate2(ibeta_small_data); + + consume_result(result); + set_call_count( + (sizeof(ibeta_data) + + sizeof(ibeta_int_data) + + sizeof(ibeta_large_data) + + sizeof(ibeta_small_data)) / sizeof(ibeta_data[0])); +} + +template +double ibeta_invab_evaluate2(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + { + result += boost::math::ibeta_inva(data[i][1], data[i][2], data[i][5]); + result += boost::math::ibeta_invb(data[i][0], data[i][2], data[i][5]); + result += boost::math::ibetac_inva(data[i][1], data[i][2], data[i][6]); + result += boost::math::ibetac_invb(data[i][0], data[i][2], data[i][6]); + } + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(ibeta_test, "ibeta_invab") +{ + double result = ibeta_invab_evaluate2(ibeta_data); + result += ibeta_invab_evaluate2(ibeta_int_data); + result += ibeta_invab_evaluate2(ibeta_large_data); + result += ibeta_invab_evaluate2(ibeta_small_data); + + consume_result(result); + set_call_count( + 4 * (sizeof(ibeta_data) + + sizeof(ibeta_int_data) + + sizeof(ibeta_large_data) + + sizeof(ibeta_small_data)) / sizeof(ibeta_data[0])); +} + +#ifdef TEST_CEPHES + +extern "C" { + +double incbet(double a, double b, double x); +double incbi(double a, double b, double y); + +} + +template +double ibeta_evaluate_cephes(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += incbet(data[i][0], data[i][1], data[i][2]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(ibeta_test, "ibeta-cephes") +{ + double result = ibeta_evaluate_cephes(ibeta_data); + result += ibeta_evaluate_cephes(ibeta_int_data); + result += ibeta_evaluate_cephes(ibeta_large_data); + result += ibeta_evaluate_cephes(ibeta_small_data); + + consume_result(result); + set_call_count( + (sizeof(ibeta_data) + + sizeof(ibeta_int_data) + + sizeof(ibeta_large_data) + + sizeof(ibeta_small_data)) / sizeof(ibeta_data[0])); +} + +template +double ibeta_inv_evaluate_cephes(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += incbi(data[i][0], data[i][1], data[i][5]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(ibeta_inv_test, "ibeta_inv-cephes") +{ + double result = ibeta_inv_evaluate_cephes(ibeta_data); + result += ibeta_inv_evaluate_cephes(ibeta_int_data); + result += ibeta_inv_evaluate_cephes(ibeta_large_data); + result += ibeta_inv_evaluate_cephes(ibeta_small_data); + + consume_result(result); + set_call_count( + (sizeof(ibeta_data) + + sizeof(ibeta_int_data) + + sizeof(ibeta_large_data) + + sizeof(ibeta_small_data)) / sizeof(ibeta_data[0])); +} + +#endif + +#ifdef TEST_GSL___ +// +// This test segfaults inside GSL.... +// + +#include + +template +double ibeta_evaluate_gsl(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += gsl_sf_beta_inc(data[i][0], data[i][1], data[i][2]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(ibeta_test, "ibeta-gsl") +{ + double result = ibeta_evaluate_gsl(ibeta_data); + result += ibeta_evaluate_gsl(ibeta_int_data); + result += ibeta_evaluate_gsl(ibeta_large_data); + result += ibeta_evaluate_gsl(ibeta_small_data); + + consume_result(result); + set_call_count( + (sizeof(ibeta_data) + + sizeof(ibeta_int_data) + + sizeof(ibeta_large_data) + + sizeof(ibeta_small_data)) / sizeof(ibeta_data[0])); +} + +#endif + diff --git a/performance/test_igamma.cpp b/performance/test_igamma.cpp index 55cce01b6..b04d51f98 100644 --- a/performance/test_igamma.cpp +++ b/performance/test_igamma.cpp @@ -1,185 +1,185 @@ - -#include "performance_measure.hpp" - -#include -#include - -#define T double -#include "../test/igamma_big_data.ipp" -#include "../test/igamma_int_data.ipp" -#include "../test/igamma_med_data.ipp" -#include "../test/igamma_small_data.ipp" - -template -double igamma_evaluate2(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - { - result += boost::math::gamma_p(data[i][0], data[i][1]); - result += boost::math::gamma_q(data[i][0], data[i][1]); - } - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(igamma_test, "igamma") -{ - double result = igamma_evaluate2(igamma_big_data); - result += igamma_evaluate2(igamma_int_data); - result += igamma_evaluate2(igamma_med_data); - result += igamma_evaluate2(igamma_small_data); - - consume_result(result); - set_call_count( - 2 * (sizeof(igamma_big_data) - + sizeof(igamma_int_data) - + sizeof(igamma_med_data) - + sizeof(igamma_small_data)) / sizeof(igamma_big_data[0])); -} - -template -double igamma_inv_evaluate2(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - { - result += boost::math::gamma_p_inv(data[i][0], data[i][5]); - result += boost::math::gamma_q_inv(data[i][0], data[i][3]); - } - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(igamma_inv_test, "igamma_inv") -{ - double result = igamma_inv_evaluate2(igamma_big_data); - result += igamma_inv_evaluate2(igamma_int_data); - result += igamma_inv_evaluate2(igamma_med_data); - result += igamma_inv_evaluate2(igamma_small_data); - - consume_result(result); - set_call_count( - 2 * (sizeof(igamma_big_data) - + sizeof(igamma_int_data) - + sizeof(igamma_med_data) - + sizeof(igamma_small_data)) / sizeof(igamma_big_data[0])); -} - -template -double igamma_inva_evaluate2(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - { - result += boost::math::gamma_p_inva(data[i][1], data[i][5]); - result += boost::math::gamma_q_inva(data[i][1], data[i][3]); - } - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(igamma_inva_test, "igamma_inva") -{ - double result = igamma_inva_evaluate2(igamma_big_data); - result += igamma_inva_evaluate2(igamma_int_data); - result += igamma_inva_evaluate2(igamma_med_data); - result += igamma_inva_evaluate2(igamma_small_data); - - consume_result(result); - set_call_count( - 2 * (sizeof(igamma_big_data) - + sizeof(igamma_int_data) - + sizeof(igamma_med_data) - + sizeof(igamma_small_data)) / sizeof(igamma_big_data[0])); -} - -#ifdef TEST_CEPHES - -extern "C" { - -double igam(double, double); -double igami(double, double); - -} - -template -double igamma_evaluate_cephes(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += igam(data[i][0], data[i][1]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(igamma_test, "igamma-cephes") -{ - double result = igamma_evaluate_cephes(igamma_big_data); - result += igamma_evaluate_cephes(igamma_int_data); - result += igamma_evaluate_cephes(igamma_med_data); - result += igamma_evaluate_cephes(igamma_small_data); - - consume_result(result); - set_call_count( - (sizeof(igamma_big_data) - + sizeof(igamma_int_data) - + sizeof(igamma_med_data) - + sizeof(igamma_small_data)) / sizeof(igamma_big_data[0])); -} - -template -double igamma_inv_evaluate_cephes(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += igami(data[i][0], data[i][3]); // note needs complement of probability!! - return result; -} -/* -// -// This test does not run to completion, gets stuck -// in infinite loop inside cephes.... -// -BOOST_MATH_PERFORMANCE_TEST(igamma_inv_test, "igamma_inv-cephes") -{ - double result = igamma_inv_evaluate_cephes(igamma_big_data); - result += igamma_inv_evaluate_cephes(igamma_int_data); - result += igamma_inv_evaluate_cephes(igamma_med_data); - result += igamma_inv_evaluate_cephes(igamma_small_data); - - consume_result(result); - set_call_count( - (sizeof(igamma_big_data) - + sizeof(igamma_int_data) - + sizeof(igamma_med_data) - + sizeof(igamma_small_data)) / sizeof(igamma_big_data[0])); -} -*/ -#endif - -#ifdef TEST_GSL - -#include - -template -double igamma_evaluate_gsl(const boost::array, N>& data) -{ - double result = 0; - for(unsigned i = 0; i < N; ++i) - result += gsl_sf_gamma_inc_P(data[i][0], data[i][1]); - return result; -} - -BOOST_MATH_PERFORMANCE_TEST(igamma_test, "igamma-gsl") -{ - double result = igamma_evaluate_gsl(igamma_big_data); - result += igamma_evaluate_gsl(igamma_int_data); - result += igamma_evaluate_gsl(igamma_med_data); - result += igamma_evaluate_gsl(igamma_small_data); - - consume_result(result); - set_call_count( - (sizeof(igamma_big_data) - + sizeof(igamma_int_data) - + sizeof(igamma_med_data) - + sizeof(igamma_small_data)) / sizeof(igamma_big_data[0])); -} - + +#include "performance_measure.hpp" + +#include +#include + +#define T double +#include "../test/igamma_big_data.ipp" +#include "../test/igamma_int_data.ipp" +#include "../test/igamma_med_data.ipp" +#include "../test/igamma_small_data.ipp" + +template +double igamma_evaluate2(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + { + result += boost::math::gamma_p(data[i][0], data[i][1]); + result += boost::math::gamma_q(data[i][0], data[i][1]); + } + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(igamma_test, "igamma") +{ + double result = igamma_evaluate2(igamma_big_data); + result += igamma_evaluate2(igamma_int_data); + result += igamma_evaluate2(igamma_med_data); + result += igamma_evaluate2(igamma_small_data); + + consume_result(result); + set_call_count( + 2 * (sizeof(igamma_big_data) + + sizeof(igamma_int_data) + + sizeof(igamma_med_data) + + sizeof(igamma_small_data)) / sizeof(igamma_big_data[0])); +} + +template +double igamma_inv_evaluate2(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + { + result += boost::math::gamma_p_inv(data[i][0], data[i][5]); + result += boost::math::gamma_q_inv(data[i][0], data[i][3]); + } + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(igamma_inv_test, "igamma_inv") +{ + double result = igamma_inv_evaluate2(igamma_big_data); + result += igamma_inv_evaluate2(igamma_int_data); + result += igamma_inv_evaluate2(igamma_med_data); + result += igamma_inv_evaluate2(igamma_small_data); + + consume_result(result); + set_call_count( + 2 * (sizeof(igamma_big_data) + + sizeof(igamma_int_data) + + sizeof(igamma_med_data) + + sizeof(igamma_small_data)) / sizeof(igamma_big_data[0])); +} + +template +double igamma_inva_evaluate2(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + { + result += boost::math::gamma_p_inva(data[i][1], data[i][5]); + result += boost::math::gamma_q_inva(data[i][1], data[i][3]); + } + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(igamma_inva_test, "igamma_inva") +{ + double result = igamma_inva_evaluate2(igamma_big_data); + result += igamma_inva_evaluate2(igamma_int_data); + result += igamma_inva_evaluate2(igamma_med_data); + result += igamma_inva_evaluate2(igamma_small_data); + + consume_result(result); + set_call_count( + 2 * (sizeof(igamma_big_data) + + sizeof(igamma_int_data) + + sizeof(igamma_med_data) + + sizeof(igamma_small_data)) / sizeof(igamma_big_data[0])); +} + +#ifdef TEST_CEPHES + +extern "C" { + +double igam(double, double); +double igami(double, double); + +} + +template +double igamma_evaluate_cephes(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += igam(data[i][0], data[i][1]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(igamma_test, "igamma-cephes") +{ + double result = igamma_evaluate_cephes(igamma_big_data); + result += igamma_evaluate_cephes(igamma_int_data); + result += igamma_evaluate_cephes(igamma_med_data); + result += igamma_evaluate_cephes(igamma_small_data); + + consume_result(result); + set_call_count( + (sizeof(igamma_big_data) + + sizeof(igamma_int_data) + + sizeof(igamma_med_data) + + sizeof(igamma_small_data)) / sizeof(igamma_big_data[0])); +} + +template +double igamma_inv_evaluate_cephes(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += igami(data[i][0], data[i][3]); // note needs complement of probability!! + return result; +} +/* +// +// This test does not run to completion, gets stuck +// in infinite loop inside cephes.... +// +BOOST_MATH_PERFORMANCE_TEST(igamma_inv_test, "igamma_inv-cephes") +{ + double result = igamma_inv_evaluate_cephes(igamma_big_data); + result += igamma_inv_evaluate_cephes(igamma_int_data); + result += igamma_inv_evaluate_cephes(igamma_med_data); + result += igamma_inv_evaluate_cephes(igamma_small_data); + + consume_result(result); + set_call_count( + (sizeof(igamma_big_data) + + sizeof(igamma_int_data) + + sizeof(igamma_med_data) + + sizeof(igamma_small_data)) / sizeof(igamma_big_data[0])); +} +*/ +#endif + +#ifdef TEST_GSL + +#include + +template +double igamma_evaluate_gsl(const boost::array, N>& data) +{ + double result = 0; + for(unsigned i = 0; i < N; ++i) + result += gsl_sf_gamma_inc_P(data[i][0], data[i][1]); + return result; +} + +BOOST_MATH_PERFORMANCE_TEST(igamma_test, "igamma-gsl") +{ + double result = igamma_evaluate_gsl(igamma_big_data); + result += igamma_evaluate_gsl(igamma_int_data); + result += igamma_evaluate_gsl(igamma_med_data); + result += igamma_evaluate_gsl(igamma_small_data); + + consume_result(result); + set_call_count( + (sizeof(igamma_big_data) + + sizeof(igamma_int_data) + + sizeof(igamma_med_data) + + sizeof(igamma_small_data)) / sizeof(igamma_big_data[0])); +} + #endif \ No newline at end of file diff --git a/performance/test_polynomial.cpp b/performance/test_polynomial.cpp index 6ef4ad628..2e2e51281 100644 --- a/performance/test_polynomial.cpp +++ b/performance/test_polynomial.cpp @@ -1,166 +1,166 @@ - -#include "performance_measure.hpp" - -#include -#include - -BOOST_MATH_PERFORMANCE_TEST(poly_test, "polynomial") -{ - typedef double T; - static const T num[13] = { - static_cast(56906521.91347156388090791033559122686859L), - static_cast(103794043.1163445451906271053616070238554L), - static_cast(86363131.28813859145546927288977868422342L), - static_cast(43338889.32467613834773723740590533316085L), - static_cast(14605578.08768506808414169982791359218571L), - static_cast(3481712.15498064590882071018964774556468L), - static_cast(601859.6171681098786670226533699352302507L), - static_cast(75999.29304014542649875303443598909137092L), - static_cast(6955.999602515376140356310115515198987526L), - static_cast(449.9445569063168119446858607650988409623L), - static_cast(19.51992788247617482847860966235652136208L), - static_cast(0.5098416655656676188125178644804694509993L), - static_cast(0.006061842346248906525783753964555936883222L) - }; - static const double denom[13] = { - static_cast(0u), - static_cast(39916800u), - static_cast(120543840u), - static_cast(150917976u), - static_cast(105258076u), - static_cast(45995730u), - static_cast(13339535u), - static_cast(2637558u), - static_cast(357423u), - static_cast(32670u), - static_cast(1925u), - static_cast(66u), - static_cast(1u) - }; - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += boost::math::tools::evaluate_polynomial(num, i) / boost::math::tools::evaluate_polynomial(denom, i); - consume_result(result); - set_call_count(200); -} - -BOOST_MATH_PERFORMANCE_TEST(poly_mixed_test, "polynomial-mixed") -{ - typedef double T; - static const T num[13] = { - static_cast(56906521.91347156388090791033559122686859L), - static_cast(103794043.1163445451906271053616070238554L), - static_cast(86363131.28813859145546927288977868422342L), - static_cast(43338889.32467613834773723740590533316085L), - static_cast(14605578.08768506808414169982791359218571L), - static_cast(3481712.15498064590882071018964774556468L), - static_cast(601859.6171681098786670226533699352302507L), - static_cast(75999.29304014542649875303443598909137092L), - static_cast(6955.999602515376140356310115515198987526L), - static_cast(449.9445569063168119446858607650988409623L), - static_cast(19.51992788247617482847860966235652136208L), - static_cast(0.5098416655656676188125178644804694509993L), - static_cast(0.006061842346248906525783753964555936883222L) - }; - static const boost::uint32_t denom[13] = { - static_cast(0u), - static_cast(39916800u), - static_cast(120543840u), - static_cast(150917976u), - static_cast(105258076u), - static_cast(45995730u), - static_cast(13339535u), - static_cast(2637558u), - static_cast(357423u), - static_cast(32670u), - static_cast(1925u), - static_cast(66u), - static_cast(1u) - }; - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += boost::math::tools::evaluate_polynomial(num, i) / boost::math::tools::evaluate_polynomial(denom, i); - consume_result(result); - set_call_count(200); -} - -BOOST_MATH_PERFORMANCE_TEST(rat_test, "rational") -{ - typedef double T; - static const T num[13] = { - static_cast(56906521.91347156388090791033559122686859L), - static_cast(103794043.1163445451906271053616070238554L), - static_cast(86363131.28813859145546927288977868422342L), - static_cast(43338889.32467613834773723740590533316085L), - static_cast(14605578.08768506808414169982791359218571L), - static_cast(3481712.15498064590882071018964774556468L), - static_cast(601859.6171681098786670226533699352302507L), - static_cast(75999.29304014542649875303443598909137092L), - static_cast(6955.999602515376140356310115515198987526L), - static_cast(449.9445569063168119446858607650988409623L), - static_cast(19.51992788247617482847860966235652136208L), - static_cast(0.5098416655656676188125178644804694509993L), - static_cast(0.006061842346248906525783753964555936883222L) - }; - static const double denom[13] = { - static_cast(0u), - static_cast(39916800u), - static_cast(120543840u), - static_cast(150917976u), - static_cast(105258076u), - static_cast(45995730u), - static_cast(13339535u), - static_cast(2637558u), - static_cast(357423u), - static_cast(32670u), - static_cast(1925u), - static_cast(66u), - static_cast(1u) - }; - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += boost::math::tools::evaluate_rational(num, denom, i); - consume_result(result); - set_call_count(100); -} - -BOOST_MATH_PERFORMANCE_TEST(rat_mixed_test, "rational-mixed") -{ - typedef double T; - static const T num[13] = { - static_cast(56906521.91347156388090791033559122686859L), - static_cast(103794043.1163445451906271053616070238554L), - static_cast(86363131.28813859145546927288977868422342L), - static_cast(43338889.32467613834773723740590533316085L), - static_cast(14605578.08768506808414169982791359218571L), - static_cast(3481712.15498064590882071018964774556468L), - static_cast(601859.6171681098786670226533699352302507L), - static_cast(75999.29304014542649875303443598909137092L), - static_cast(6955.999602515376140356310115515198987526L), - static_cast(449.9445569063168119446858607650988409623L), - static_cast(19.51992788247617482847860966235652136208L), - static_cast(0.5098416655656676188125178644804694509993L), - static_cast(0.006061842346248906525783753964555936883222L) - }; - static const boost::uint32_t denom[13] = { - static_cast(0u), - static_cast(39916800u), - static_cast(120543840u), - static_cast(150917976u), - static_cast(105258076u), - static_cast(45995730u), - static_cast(13339535u), - static_cast(2637558u), - static_cast(357423u), - static_cast(32670u), - static_cast(1925u), - static_cast(66u), - static_cast(1u) - }; - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += boost::math::tools::evaluate_rational(num, denom, i); - consume_result(result); - set_call_count(100); -} - + +#include "performance_measure.hpp" + +#include +#include + +BOOST_MATH_PERFORMANCE_TEST(poly_test, "polynomial") +{ + typedef double T; + static const T num[13] = { + static_cast(56906521.91347156388090791033559122686859L), + static_cast(103794043.1163445451906271053616070238554L), + static_cast(86363131.28813859145546927288977868422342L), + static_cast(43338889.32467613834773723740590533316085L), + static_cast(14605578.08768506808414169982791359218571L), + static_cast(3481712.15498064590882071018964774556468L), + static_cast(601859.6171681098786670226533699352302507L), + static_cast(75999.29304014542649875303443598909137092L), + static_cast(6955.999602515376140356310115515198987526L), + static_cast(449.9445569063168119446858607650988409623L), + static_cast(19.51992788247617482847860966235652136208L), + static_cast(0.5098416655656676188125178644804694509993L), + static_cast(0.006061842346248906525783753964555936883222L) + }; + static const double denom[13] = { + static_cast(0u), + static_cast(39916800u), + static_cast(120543840u), + static_cast(150917976u), + static_cast(105258076u), + static_cast(45995730u), + static_cast(13339535u), + static_cast(2637558u), + static_cast(357423u), + static_cast(32670u), + static_cast(1925u), + static_cast(66u), + static_cast(1u) + }; + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += boost::math::tools::evaluate_polynomial(num, i) / boost::math::tools::evaluate_polynomial(denom, i); + consume_result(result); + set_call_count(200); +} + +BOOST_MATH_PERFORMANCE_TEST(poly_mixed_test, "polynomial-mixed") +{ + typedef double T; + static const T num[13] = { + static_cast(56906521.91347156388090791033559122686859L), + static_cast(103794043.1163445451906271053616070238554L), + static_cast(86363131.28813859145546927288977868422342L), + static_cast(43338889.32467613834773723740590533316085L), + static_cast(14605578.08768506808414169982791359218571L), + static_cast(3481712.15498064590882071018964774556468L), + static_cast(601859.6171681098786670226533699352302507L), + static_cast(75999.29304014542649875303443598909137092L), + static_cast(6955.999602515376140356310115515198987526L), + static_cast(449.9445569063168119446858607650988409623L), + static_cast(19.51992788247617482847860966235652136208L), + static_cast(0.5098416655656676188125178644804694509993L), + static_cast(0.006061842346248906525783753964555936883222L) + }; + static const boost::uint32_t denom[13] = { + static_cast(0u), + static_cast(39916800u), + static_cast(120543840u), + static_cast(150917976u), + static_cast(105258076u), + static_cast(45995730u), + static_cast(13339535u), + static_cast(2637558u), + static_cast(357423u), + static_cast(32670u), + static_cast(1925u), + static_cast(66u), + static_cast(1u) + }; + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += boost::math::tools::evaluate_polynomial(num, i) / boost::math::tools::evaluate_polynomial(denom, i); + consume_result(result); + set_call_count(200); +} + +BOOST_MATH_PERFORMANCE_TEST(rat_test, "rational") +{ + typedef double T; + static const T num[13] = { + static_cast(56906521.91347156388090791033559122686859L), + static_cast(103794043.1163445451906271053616070238554L), + static_cast(86363131.28813859145546927288977868422342L), + static_cast(43338889.32467613834773723740590533316085L), + static_cast(14605578.08768506808414169982791359218571L), + static_cast(3481712.15498064590882071018964774556468L), + static_cast(601859.6171681098786670226533699352302507L), + static_cast(75999.29304014542649875303443598909137092L), + static_cast(6955.999602515376140356310115515198987526L), + static_cast(449.9445569063168119446858607650988409623L), + static_cast(19.51992788247617482847860966235652136208L), + static_cast(0.5098416655656676188125178644804694509993L), + static_cast(0.006061842346248906525783753964555936883222L) + }; + static const double denom[13] = { + static_cast(0u), + static_cast(39916800u), + static_cast(120543840u), + static_cast(150917976u), + static_cast(105258076u), + static_cast(45995730u), + static_cast(13339535u), + static_cast(2637558u), + static_cast(357423u), + static_cast(32670u), + static_cast(1925u), + static_cast(66u), + static_cast(1u) + }; + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += boost::math::tools::evaluate_rational(num, denom, i); + consume_result(result); + set_call_count(100); +} + +BOOST_MATH_PERFORMANCE_TEST(rat_mixed_test, "rational-mixed") +{ + typedef double T; + static const T num[13] = { + static_cast(56906521.91347156388090791033559122686859L), + static_cast(103794043.1163445451906271053616070238554L), + static_cast(86363131.28813859145546927288977868422342L), + static_cast(43338889.32467613834773723740590533316085L), + static_cast(14605578.08768506808414169982791359218571L), + static_cast(3481712.15498064590882071018964774556468L), + static_cast(601859.6171681098786670226533699352302507L), + static_cast(75999.29304014542649875303443598909137092L), + static_cast(6955.999602515376140356310115515198987526L), + static_cast(449.9445569063168119446858607650988409623L), + static_cast(19.51992788247617482847860966235652136208L), + static_cast(0.5098416655656676188125178644804694509993L), + static_cast(0.006061842346248906525783753964555936883222L) + }; + static const boost::uint32_t denom[13] = { + static_cast(0u), + static_cast(39916800u), + static_cast(120543840u), + static_cast(150917976u), + static_cast(105258076u), + static_cast(45995730u), + static_cast(13339535u), + static_cast(2637558u), + static_cast(357423u), + static_cast(32670u), + static_cast(1925u), + static_cast(66u), + static_cast(1u) + }; + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += boost::math::tools::evaluate_rational(num, denom, i); + consume_result(result); + set_call_count(100); +} + diff --git a/performance/test_reference.cpp b/performance/test_reference.cpp index 33f03abaf..17fcbaf94 100644 --- a/performance/test_reference.cpp +++ b/performance/test_reference.cpp @@ -1,10 +1,10 @@ - -#include "performance_measure.hpp" - -void reference_evaluate() -{ - consume_result(2.0); - set_call_count(1); -} - - + +#include "performance_measure.hpp" + +void reference_evaluate() +{ + consume_result(2.0); + set_call_count(1); +} + + diff --git a/test/test_rational.hpp b/test/test_rational.hpp index 7fce818cb..82aa64d06 100644 --- a/test/test_rational.hpp +++ b/test/test_rational.hpp @@ -1,5296 +1,5296 @@ - -#ifndef BOOST_MATH_TEST_RATIONAL_HPP -#define BOOST_MATH_TEST_RATIONAL_HPP - -#include - -template -void do_test_spots(T, U) -{ - // - // Tolerance is 4 eps expressed as a persentage: - // - T tolerance = boost::math::tools::epsilon() * 4 * 100; - - // - // Everything past this point is generated by the program - // ../tools/generate_rational_test.cpp - // - - // - // Polynomials of order 0 - // - static const U n1c[1] = { 2 }; - static const boost::array n1a = { 2 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1c, static_cast(0.125), 1), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1c, static_cast(0.25), 1), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1c, static_cast(0.75), 1), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1c, static_cast(1.0f - 1.0f/64.0f), 1), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1c, static_cast(6.5), 1), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1c, static_cast(10247.25), 1), - static_cast(0.2e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1c, static_cast(0.125)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1c, static_cast(0.25)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1c, static_cast(0.75)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1c, static_cast(6.5)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1c, static_cast(10247.25)), - static_cast(0.2e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1a, static_cast(0.125)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1a, static_cast(0.25)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1a, static_cast(0.75)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1a, static_cast(6.5)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n1a, static_cast(10247.25)), - static_cast(0.2e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1c, static_cast(0.125), 1), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1c, static_cast(0.25), 1), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1c, static_cast(0.75), 1), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1c, static_cast(1.0f - 1.0f/64.0f), 1), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1c, static_cast(6.5f), 1), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1c, static_cast(10247.25f), 1), - static_cast(0.2e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1c, static_cast(0.125)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1c, static_cast(0.25)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1c, static_cast(0.75)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1c, static_cast(6.5f)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1c, static_cast(10247.25f)), - static_cast(0.2e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1a, static_cast(0.125)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1a, static_cast(0.25)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1a, static_cast(0.75)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1a, static_cast(6.5f)), - static_cast(0.2e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n1a, static_cast(10247.25f)), - static_cast(0.2e1L), - tolerance); - - // - // Rational functions of order 0 - // - static const U d1c[1] = { 3 }; - static const boost::array d1a = { 3 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1c, d1c, static_cast(0.125), 1), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1c, d1c, static_cast(0.25), 1), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1c, d1c, static_cast(0.75), 1), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1c, d1c, static_cast(1.0f - 1.0f/64.0f), 1), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1c, d1c, static_cast(6.5f), 1), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1c, d1c, static_cast(10247.25f), 1), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1c, d1c, static_cast(0.125)), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1c, d1c, static_cast(0.25)), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1c, d1c, static_cast(0.75)), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1c, d1c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1c, d1c, static_cast(6.5f)), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1c, d1c, static_cast(10247.25f)), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1a, d1a, static_cast(0.125)), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1a, d1a, static_cast(0.25)), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1a, d1a, static_cast(0.75)), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1a, d1a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1a, d1a, static_cast(6.5f)), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n1a, d1a, static_cast(10247.25f)), - static_cast(0.6666666666666666666666666666666666666667e0L), - tolerance); - - // - // Polynomials of order 1 - // - static const U n2c[2] = { 3, 1 }; - static const boost::array n2a = { 3, 1 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2c, static_cast(0.125), 2), - static_cast(0.3125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2c, static_cast(0.25), 2), - static_cast(0.325e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2c, static_cast(0.75), 2), - static_cast(0.375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2c, static_cast(1.0f - 1.0f/64.0f), 2), - static_cast(0.3984375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2c, static_cast(6.5), 2), - static_cast(0.95e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2c, static_cast(10247.25), 2), - static_cast(0.1025025e5L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2c, static_cast(0.125)), - static_cast(0.3125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2c, static_cast(0.25)), - static_cast(0.325e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2c, static_cast(0.75)), - static_cast(0.375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.3984375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2c, static_cast(6.5)), - static_cast(0.95e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2c, static_cast(10247.25)), - static_cast(0.1025025e5L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2a, static_cast(0.125)), - static_cast(0.3125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2a, static_cast(0.25)), - static_cast(0.325e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2a, static_cast(0.75)), - static_cast(0.375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.3984375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2a, static_cast(6.5)), - static_cast(0.95e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n2a, static_cast(10247.25)), - static_cast(0.1025025e5L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2c, static_cast(0.125), 2), - static_cast(0.3015625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2c, static_cast(0.25), 2), - static_cast(0.30625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2c, static_cast(0.75), 2), - static_cast(0.35625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2c, static_cast(1.0f - 1.0f/64.0f), 2), - static_cast(0.3968994140625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2c, static_cast(6.5f), 2), - static_cast(0.4525e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2c, static_cast(10247.25f), 2), - static_cast(0.1050061355625e9L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2c, static_cast(0.125)), - static_cast(0.3015625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2c, static_cast(0.25)), - static_cast(0.30625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2c, static_cast(0.75)), - static_cast(0.35625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.3968994140625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2c, static_cast(6.5f)), - static_cast(0.4525e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2c, static_cast(10247.25f)), - static_cast(0.1050061355625e9L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2a, static_cast(0.125)), - static_cast(0.3015625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2a, static_cast(0.25)), - static_cast(0.30625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2a, static_cast(0.75)), - static_cast(0.35625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.3968994140625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2a, static_cast(6.5f)), - static_cast(0.4525e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n2a, static_cast(10247.25f)), - static_cast(0.1050061355625e9L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(0.125), 2), - static_cast(0.3125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(0.25), 2), - static_cast(0.325e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(0.75), 2), - static_cast(0.375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(1.0f - 1.0f/64.0f), 2), - static_cast(0.3984375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(6.5f), 2), - static_cast(0.95e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(10247.25f), 2), - static_cast(0.1025025e5L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(0.125)), - static_cast(0.3125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(0.25)), - static_cast(0.325e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(0.75)), - static_cast(0.375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.3984375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(6.5f)), - static_cast(0.95e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(10247.25f)), - static_cast(0.1025025e5L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2a, static_cast(0.125)), - static_cast(0.3125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2a, static_cast(0.25)), - static_cast(0.325e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2a, static_cast(0.75)), - static_cast(0.375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.3984375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2a, static_cast(6.5f)), - static_cast(0.95e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n2a, static_cast(10247.25f)), - static_cast(0.1025025e5L), - tolerance); - - // - // Rational functions of order 1 - // - static const U d2c[2] = { 5, 9 }; - static const boost::array d2a = { 5, 9 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2c, d2c, static_cast(0.125), 2), - static_cast(0.5102040816326530612244897959183673469388e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2c, d2c, static_cast(0.25), 2), - static_cast(0.4482758620689655172413793103448275862069e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2c, d2c, static_cast(0.75), 2), - static_cast(0.3191489361702127659574468085106382978723e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2c, d2c, static_cast(1.0f - 1.0f/64.0f), 2), - static_cast(0.2874859075535512965050732807215332581736e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2c, d2c, static_cast(6.5f), 2), - static_cast(0.1496062992125984251968503937007874015748e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2c, d2c, static_cast(10247.25f), 2), - static_cast(0.1111376148281068304596377002122405609873e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2c, d2c, static_cast(0.125)), - static_cast(0.5102040816326530612244897959183673469388e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2c, d2c, static_cast(0.25)), - static_cast(0.4482758620689655172413793103448275862069e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2c, d2c, static_cast(0.75)), - static_cast(0.3191489361702127659574468085106382978723e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2c, d2c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.2874859075535512965050732807215332581736e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2c, d2c, static_cast(6.5f)), - static_cast(0.1496062992125984251968503937007874015748e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2c, d2c, static_cast(10247.25f)), - static_cast(0.1111376148281068304596377002122405609873e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2a, d2a, static_cast(0.125)), - static_cast(0.5102040816326530612244897959183673469388e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2a, d2a, static_cast(0.25)), - static_cast(0.4482758620689655172413793103448275862069e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2a, d2a, static_cast(0.75)), - static_cast(0.3191489361702127659574468085106382978723e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2a, d2a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.2874859075535512965050732807215332581736e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2a, d2a, static_cast(6.5f)), - static_cast(0.1496062992125984251968503937007874015748e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n2a, d2a, static_cast(10247.25f)), - static_cast(0.1111376148281068304596377002122405609873e0L), - tolerance); - - // - // Polynomials of order 2 - // - static const U n3c[3] = { 10, 6, 11 }; - static const boost::array n3a = { 10, 6, 11 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3c, static_cast(0.125), 3), - static_cast(0.10921875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3c, static_cast(0.25), 3), - static_cast(0.121875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3c, static_cast(0.75), 3), - static_cast(0.206875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3c, static_cast(1.0f - 1.0f/64.0f), 3), - static_cast(0.26565185546875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3c, static_cast(6.5), 3), - static_cast(0.51375e3L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3c, static_cast(10247.25), 3), - static_cast(0.11551289516875e10L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3c, static_cast(0.125)), - static_cast(0.10921875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3c, static_cast(0.25)), - static_cast(0.121875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3c, static_cast(0.75)), - static_cast(0.206875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.26565185546875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3c, static_cast(6.5)), - static_cast(0.51375e3L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3c, static_cast(10247.25)), - static_cast(0.11551289516875e10L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3a, static_cast(0.125)), - static_cast(0.10921875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3a, static_cast(0.25)), - static_cast(0.121875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3a, static_cast(0.75)), - static_cast(0.206875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.26565185546875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3a, static_cast(6.5)), - static_cast(0.51375e3L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n3a, static_cast(10247.25)), - static_cast(0.11551289516875e10L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3c, static_cast(0.125), 3), - static_cast(0.10096435546875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3c, static_cast(0.25), 3), - static_cast(0.1041796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3c, static_cast(0.75), 3), - static_cast(0.1685546875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3c, static_cast(1.0f - 1.0f/64.0f), 3), - static_cast(0.26142410933971405029296875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3c, static_cast(6.5f), 3), - static_cast(0.198991875e5L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3c, static_cast(10247.25f), 3), - static_cast(0.12128916726310335635546875e18L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3c, static_cast(0.125)), - static_cast(0.10096435546875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3c, static_cast(0.25)), - static_cast(0.1041796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3c, static_cast(0.75)), - static_cast(0.1685546875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.26142410933971405029296875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3c, static_cast(6.5f)), - static_cast(0.198991875e5L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3c, static_cast(10247.25f)), - static_cast(0.12128916726310335635546875e18L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3a, static_cast(0.125)), - static_cast(0.10096435546875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3a, static_cast(0.25)), - static_cast(0.1041796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3a, static_cast(0.75)), - static_cast(0.1685546875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.26142410933971405029296875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3a, static_cast(6.5f)), - static_cast(0.198991875e5L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n3a, static_cast(10247.25f)), - static_cast(0.12128916726310335635546875e18L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(0.125), 3), - static_cast(0.10771484375e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(0.25), 3), - static_cast(0.11671875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(0.75), 3), - static_cast(0.19140625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(1.0f - 1.0f/64.0f), 3), - static_cast(0.26398639678955078125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(6.5f), 3), - static_cast(0.3069875e4L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(10247.25f), 3), - static_cast(0.11836265072405359375e14L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(0.125)), - static_cast(0.10771484375e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(0.25)), - static_cast(0.11671875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(0.75)), - static_cast(0.19140625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.26398639678955078125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(6.5f)), - static_cast(0.3069875e4L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(10247.25f)), - static_cast(0.11836265072405359375e14L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3a, static_cast(0.125)), - static_cast(0.10771484375e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3a, static_cast(0.25)), - static_cast(0.11671875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3a, static_cast(0.75)), - static_cast(0.19140625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.26398639678955078125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3a, static_cast(6.5f)), - static_cast(0.3069875e4L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n3a, static_cast(10247.25f)), - static_cast(0.11836265072405359375e14L), - tolerance); - - // - // Rational functions of order 2 - // - static const U d3c[3] = { 3, 4, 10 }; - static const boost::array d3a = { 3, 4, 10 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3c, d3c, static_cast(0.125), 3), - static_cast(0.2987179487179487179487179487179487179487e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3c, d3c, static_cast(0.25), 3), - static_cast(0.2635135135135135135135135135135135135135e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3c, d3c, static_cast(0.75), 3), - static_cast(0.1779569892473118279569892473118279569892e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3c, d3c, static_cast(1.0f - 1.0f/64.0f), 3), - static_cast(0.1597671277126831703520981998649164537633e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3c, d3c, static_cast(6.5f), 3), - static_cast(0.1137873754152823920265780730897009966777e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3c, d3c, static_cast(10247.25f), 3), - static_cast(0.1100015619716026431429617996316152069115e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3c, d3c, static_cast(0.125)), - static_cast(0.2987179487179487179487179487179487179487e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3c, d3c, static_cast(0.25)), - static_cast(0.2635135135135135135135135135135135135135e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3c, d3c, static_cast(0.75)), - static_cast(0.1779569892473118279569892473118279569892e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3c, d3c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1597671277126831703520981998649164537633e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3c, d3c, static_cast(6.5f)), - static_cast(0.1137873754152823920265780730897009966777e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3c, d3c, static_cast(10247.25f)), - static_cast(0.1100015619716026431429617996316152069115e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3a, d3a, static_cast(0.125)), - static_cast(0.2987179487179487179487179487179487179487e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3a, d3a, static_cast(0.25)), - static_cast(0.2635135135135135135135135135135135135135e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3a, d3a, static_cast(0.75)), - static_cast(0.1779569892473118279569892473118279569892e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3a, d3a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1597671277126831703520981998649164537633e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3a, d3a, static_cast(6.5f)), - static_cast(0.1137873754152823920265780730897009966777e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n3a, d3a, static_cast(10247.25f)), - static_cast(0.1100015619716026431429617996316152069115e1L), - tolerance); - - // - // Polynomials of order 3 - // - static const U n4c[4] = { 1, 4, 9, 11 }; - static const boost::array n4a = { 1, 4, 9, 11 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4c, static_cast(0.125), 4), - static_cast(0.1662109375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4c, static_cast(0.25), 4), - static_cast(0.2734375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4c, static_cast(0.75), 4), - static_cast(0.13703125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4c, static_cast(1.0f - 1.0f/64.0f), 4), - static_cast(0.24150836944580078125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4c, static_cast(6.5), 4), - static_cast(0.3428125e4L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4c, static_cast(10247.25), 4), - static_cast(0.11837210107094921875e14L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4c, static_cast(0.125)), - static_cast(0.1662109375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4c, static_cast(0.25)), - static_cast(0.2734375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4c, static_cast(0.75)), - static_cast(0.13703125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.24150836944580078125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4c, static_cast(6.5)), - static_cast(0.3428125e4L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4c, static_cast(10247.25)), - static_cast(0.11837210107094921875e14L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4a, static_cast(0.125)), - static_cast(0.1662109375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4a, static_cast(0.25)), - static_cast(0.2734375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4a, static_cast(0.75)), - static_cast(0.13703125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.24150836944580078125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4a, static_cast(6.5)), - static_cast(0.3428125e4L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n4a, static_cast(10247.25)), - static_cast(0.11837210107094921875e14L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4c, static_cast(0.125), 4), - static_cast(0.1064739227294921875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4c, static_cast(0.25), 4), - static_cast(0.1287841796875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4c, static_cast(0.75), 4), - static_cast(0.8055419921875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4c, static_cast(1.0f - 1.0f/64.0f), 4), - static_cast(0.23334727106775972060859203338623046875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4c, static_cast(6.5f), 4), - static_cast(0.845843359375e6L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4c, static_cast(10247.25f), 4), - static_cast(0.12736106409103529349764202508544921875e26L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4c, static_cast(0.125)), - static_cast(0.1064739227294921875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4c, static_cast(0.25)), - static_cast(0.1287841796875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4c, static_cast(0.75)), - static_cast(0.8055419921875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.23334727106775972060859203338623046875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4c, static_cast(6.5f)), - static_cast(0.845843359375e6L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4c, static_cast(10247.25f)), - static_cast(0.12736106409103529349764202508544921875e26L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4a, static_cast(0.125)), - static_cast(0.1064739227294921875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4a, static_cast(0.25)), - static_cast(0.1287841796875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4a, static_cast(0.75)), - static_cast(0.8055419921875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.23334727106775972060859203338623046875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4a, static_cast(6.5f)), - static_cast(0.845843359375e6L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n4a, static_cast(10247.25f)), - static_cast(0.12736106409103529349764202508544921875e26L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(0.125), 4), - static_cast(0.1517913818359375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(0.25), 4), - static_cast(0.21513671875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(0.75), 4), - static_cast(0.104072265625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(1.0f - 1.0f/64.0f), 4), - static_cast(0.23689246584661304950714111328125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(6.5f), 4), - static_cast(0.13013059375e6L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(10247.25f), 4), - static_cast(0.12428804224649080826343115234375e22L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(0.125)), - static_cast(0.1517913818359375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(0.25)), - static_cast(0.21513671875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(0.75)), - static_cast(0.104072265625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.23689246584661304950714111328125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(6.5f)), - static_cast(0.13013059375e6L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(10247.25f)), - static_cast(0.12428804224649080826343115234375e22L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4a, static_cast(0.125)), - static_cast(0.1517913818359375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4a, static_cast(0.25)), - static_cast(0.21513671875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4a, static_cast(0.75)), - static_cast(0.104072265625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.23689246584661304950714111328125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4a, static_cast(6.5f)), - static_cast(0.13013059375e6L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n4a, static_cast(10247.25f)), - static_cast(0.12428804224649080826343115234375e22L), - tolerance); - - // - // Rational functions of order 3 - // - static const U d4c[4] = { 10, 2, 5, 4 }; - static const boost::array d4a = { 10, 2, 5, 4 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4c, d4c, static_cast(0.125), 4), - static_cast(0.1608087679516250944822373393801965230537e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4c, d4c, static_cast(0.25), 4), - static_cast(0.2514367816091954022988505747126436781609e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4c, d4c, static_cast(0.75), 4), - static_cast(0.8564453125e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4c, d4c, static_cast(1.0f - 1.0f/64.0f), 4), - static_cast(0.1170714951947222939292918160495461743806e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4c, d4c, static_cast(6.5f), 4), - static_cast(0.2572219095854436315888201087975989495404e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4c, d4c, static_cast(10247.25f), 4), - static_cast(0.2749884125808399380227005558292823797886e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4c, d4c, static_cast(0.125)), - static_cast(0.1608087679516250944822373393801965230537e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4c, d4c, static_cast(0.25)), - static_cast(0.2514367816091954022988505747126436781609e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4c, d4c, static_cast(0.75)), - static_cast(0.8564453125e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4c, d4c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1170714951947222939292918160495461743806e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4c, d4c, static_cast(6.5f)), - static_cast(0.2572219095854436315888201087975989495404e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4c, d4c, static_cast(10247.25f)), - static_cast(0.2749884125808399380227005558292823797886e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4a, d4a, static_cast(0.125)), - static_cast(0.1608087679516250944822373393801965230537e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4a, d4a, static_cast(0.25)), - static_cast(0.2514367816091954022988505747126436781609e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4a, d4a, static_cast(0.75)), - static_cast(0.8564453125e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4a, d4a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1170714951947222939292918160495461743806e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4a, d4a, static_cast(6.5f)), - static_cast(0.2572219095854436315888201087975989495404e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n4a, d4a, static_cast(10247.25f)), - static_cast(0.2749884125808399380227005558292823797886e1L), - tolerance); - - // - // Polynomials of order 4 - // - static const U n5c[5] = { 10, 10, 4, 11, 9 }; - static const boost::array n5a = { 10, 10, 4, 11, 9 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5c, static_cast(0.125), 5), - static_cast(0.11336181640625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5c, static_cast(0.25), 5), - static_cast(0.1295703125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5c, static_cast(0.75), 5), - static_cast(0.2723828125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5c, static_cast(1.0f - 1.0f/64.0f), 5), - static_cast(0.42662663042545318603515625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5c, static_cast(6.5), 5), - static_cast(0.193304375e5L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5c, static_cast(10247.25), 5), - static_cast(0.9924842756673782995703125e17L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5c, static_cast(0.125)), - static_cast(0.11336181640625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5c, static_cast(0.25)), - static_cast(0.1295703125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5c, static_cast(0.75)), - static_cast(0.2723828125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.42662663042545318603515625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5c, static_cast(6.5)), - static_cast(0.193304375e5L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5c, static_cast(10247.25)), - static_cast(0.9924842756673782995703125e17L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5a, static_cast(0.125)), - static_cast(0.11336181640625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5a, static_cast(0.25)), - static_cast(0.1295703125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5a, static_cast(0.75)), - static_cast(0.2723828125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.42662663042545318603515625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5a, static_cast(6.5)), - static_cast(0.193304375e5L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n5a, static_cast(10247.25)), - static_cast(0.9924842756673782995703125e17L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5c, static_cast(0.125), 5), - static_cast(0.10157269060611724853515625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5c, static_cast(0.25), 5), - static_cast(0.106434478759765625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5c, static_cast(0.75), 5), - static_cast(0.197494049072265625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5c, static_cast(1.0f - 1.0f/64.0f), 5), - static_cast(0.4138858164296656028113829961512237787247e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5c, static_cast(6.5f), 5), - static_cast(0.2951521370703125e8L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5c, static_cast(10247.25f), 5), - static_cast(0.1094211231602999407223950000397888253311e34L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5c, static_cast(0.125)), - static_cast(0.10157269060611724853515625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5c, static_cast(0.25)), - static_cast(0.106434478759765625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5c, static_cast(0.75)), - static_cast(0.197494049072265625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4138858164296656028113829961512237787247e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5c, static_cast(6.5f)), - static_cast(0.2951521370703125e8L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5c, static_cast(10247.25f)), - static_cast(0.1094211231602999407223950000397888253311e34L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5a, static_cast(0.125)), - static_cast(0.10157269060611724853515625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5a, static_cast(0.25)), - static_cast(0.106434478759765625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5a, static_cast(0.75)), - static_cast(0.197494049072265625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4138858164296656028113829961512237787247e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5a, static_cast(6.5f)), - static_cast(0.2951521370703125e8L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n5a, static_cast(10247.25f)), - static_cast(0.1094211231602999407223950000397888253311e34L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(0.125), 5), - static_cast(0.11258152484893798828125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(0.25), 5), - static_cast(0.1257379150390625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(0.75), 5), - static_cast(0.2299920654296875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(1.0f - 1.0f/64.0f), 5), - static_cast(0.4188681309761682314274366945028305053711e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(6.5f), 5), - static_cast(0.45408105703125e7L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(10247.25f), 5), - static_cast(0.106780963829612765105169679718983215332e30L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(0.125)), - static_cast(0.11258152484893798828125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(0.25)), - static_cast(0.1257379150390625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(0.75)), - static_cast(0.2299920654296875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4188681309761682314274366945028305053711e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(6.5f)), - static_cast(0.45408105703125e7L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(10247.25f)), - static_cast(0.106780963829612765105169679718983215332e30L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5a, static_cast(0.125)), - static_cast(0.11258152484893798828125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5a, static_cast(0.25)), - static_cast(0.1257379150390625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5a, static_cast(0.75)), - static_cast(0.2299920654296875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4188681309761682314274366945028305053711e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5a, static_cast(6.5f)), - static_cast(0.45408105703125e7L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n5a, static_cast(10247.25f)), - static_cast(0.106780963829612765105169679718983215332e30L), - tolerance); - - // - // Rational functions of order 4 - // - static const U d5c[5] = { 6, 9, 6, 2, 5 }; - static const boost::array d5a = { 6, 9, 6, 2, 5 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5c, d5c, static_cast(0.125), 5), - static_cast(0.1569265605461489066882963263374902835513e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5c, d5c, static_cast(0.25), 5), - static_cast(0.1493471409275101305718144979738856371004e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5c, d5c, static_cast(0.75), 5), - static_cast(0.1468309117708991366603495472731101284481e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5c, d5c, static_cast(1.0f - 1.0f/64.0f), 5), - static_cast(0.1564121691159921277310988862398683772017e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5c, d5c, static_cast(6.5f), 5), - static_cast(0.1973991741181125982091000185089449263153e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5c, d5c, static_cast(10247.25f), 5), - static_cast(0.1800144410401676792233921448870747965702e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5c, d5c, static_cast(0.125)), - static_cast(0.1569265605461489066882963263374902835513e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5c, d5c, static_cast(0.25)), - static_cast(0.1493471409275101305718144979738856371004e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5c, d5c, static_cast(0.75)), - static_cast(0.1468309117708991366603495472731101284481e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5c, d5c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1564121691159921277310988862398683772017e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5c, d5c, static_cast(6.5f)), - static_cast(0.1973991741181125982091000185089449263153e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5c, d5c, static_cast(10247.25f)), - static_cast(0.1800144410401676792233921448870747965702e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5a, d5a, static_cast(0.125)), - static_cast(0.1569265605461489066882963263374902835513e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5a, d5a, static_cast(0.25)), - static_cast(0.1493471409275101305718144979738856371004e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5a, d5a, static_cast(0.75)), - static_cast(0.1468309117708991366603495472731101284481e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5a, d5a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1564121691159921277310988862398683772017e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5a, d5a, static_cast(6.5f)), - static_cast(0.1973991741181125982091000185089449263153e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n5a, d5a, static_cast(10247.25f)), - static_cast(0.1800144410401676792233921448870747965702e1L), - tolerance); - - // - // Polynomials of order 5 - // - static const U n6c[6] = { 6, 8, 12, 5, 7, 5 }; - static const boost::array n6a = { 6, 8, 12, 5, 7, 5 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6c, static_cast(0.125), 6), - static_cast(0.7199127197265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6c, static_cast(0.25), 6), - static_cast(0.88603515625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6c, static_cast(0.75), 6), - static_cast(0.242607421875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6c, static_cast(1.0f - 1.0f/64.0f), 6), - static_cast(0.41466238017193973064422607421875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6c, static_cast(6.5), 6), - static_cast(0.7244809375e5L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6c, static_cast(10247.25), 6), - static_cast(0.5650228315695522094919501953125e21L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6c, static_cast(0.125)), - static_cast(0.7199127197265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6c, static_cast(0.25)), - static_cast(0.88603515625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6c, static_cast(0.75)), - static_cast(0.242607421875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.41466238017193973064422607421875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6c, static_cast(6.5)), - static_cast(0.7244809375e5L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6c, static_cast(10247.25)), - static_cast(0.5650228315695522094919501953125e21L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6a, static_cast(0.125)), - static_cast(0.7199127197265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6a, static_cast(0.25)), - static_cast(0.88603515625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6a, static_cast(0.75)), - static_cast(0.242607421875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.41466238017193973064422607421875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6a, static_cast(6.5)), - static_cast(0.7244809375e5L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n6a, static_cast(10247.25)), - static_cast(0.5650228315695522094919501953125e21L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6c, static_cast(0.125), 6), - static_cast(0.6127949182875454425811767578125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6c, static_cast(0.25), 6), - static_cast(0.654820728302001953125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6c, static_cast(0.75), 6), - static_cast(0.1616912555694580078125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6c, static_cast(1.0f - 1.0f/64.0f), 6), - static_cast(0.4001137167344577683526091194110563264985e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6c, static_cast(6.5f), 6), - static_cast(0.6958411633369140625e9L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6c, static_cast(0.125)), - static_cast(0.6127949182875454425811767578125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6c, static_cast(0.25)), - static_cast(0.654820728302001953125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6c, static_cast(0.75)), - static_cast(0.1616912555694580078125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4001137167344577683526091194110563264985e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6c, static_cast(6.5f)), - static_cast(0.6958411633369140625e9L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6a, static_cast(0.125)), - static_cast(0.6127949182875454425811767578125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6a, static_cast(0.25)), - static_cast(0.654820728302001953125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6a, static_cast(0.75)), - static_cast(0.1616912555694580078125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4001137167344577683526091194110563264985e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n6a, static_cast(6.5f)), - static_cast(0.6958411633369140625e9L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(0.125), 6), - static_cast(0.7023593463003635406494140625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(0.25), 6), - static_cast(0.8192829132080078125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(0.75), 6), - static_cast(0.19558834075927734375e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(1.0f - 1.0f/64.0f), 6), - static_cast(0.4055123471588142408661425974969461094588e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(6.5f), 6), - static_cast(0.107052491744140625e9L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(10247.25f), 6), - static_cast(0.6229253367792843599034768117351560896265e37L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(0.125)), - static_cast(0.7023593463003635406494140625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(0.25)), - static_cast(0.8192829132080078125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(0.75)), - static_cast(0.19558834075927734375e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4055123471588142408661425974969461094588e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(6.5f)), - static_cast(0.107052491744140625e9L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(10247.25f)), - static_cast(0.6229253367792843599034768117351560896265e37L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6a, static_cast(0.125)), - static_cast(0.7023593463003635406494140625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6a, static_cast(0.25)), - static_cast(0.8192829132080078125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6a, static_cast(0.75)), - static_cast(0.19558834075927734375e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4055123471588142408661425974969461094588e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6a, static_cast(6.5f)), - static_cast(0.107052491744140625e9L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n6a, static_cast(10247.25f)), - static_cast(0.6229253367792843599034768117351560896265e37L), - tolerance); - - // - // Rational functions of order 5 - // - static const U d6c[6] = { 5, 11, 7, 12, 10, 5 }; - static const boost::array d6a = { 5, 11, 7, 12, 10, 5 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6c, d6c, static_cast(0.125), 6), - static_cast(0.1105787665293227020667219792530925829572e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6c, d6c, static_cast(0.25), 6), - static_cast(0.1052430112515949425820670455863588910799e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6c, d6c, static_cast(0.75), 6), - static_cast(0.9120378868534087154447666948125848966555e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6c, d6c, static_cast(1.0f - 1.0f/64.0f), 6), - static_cast(0.8626539746676637108178973543021882567334e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6c, d6c, static_cast(6.5f), 6), - static_cast(0.9109197333022141385660730837432462113756e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6c, d6c, static_cast(10247.25f), 6), - static_cast(0.9999414458034701919327379302959430043671e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6c, d6c, static_cast(0.125)), - static_cast(0.1105787665293227020667219792530925829572e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6c, d6c, static_cast(0.25)), - static_cast(0.1052430112515949425820670455863588910799e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6c, d6c, static_cast(0.75)), - static_cast(0.9120378868534087154447666948125848966555e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6c, d6c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8626539746676637108178973543021882567334e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6c, d6c, static_cast(6.5f)), - static_cast(0.9109197333022141385660730837432462113756e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6c, d6c, static_cast(10247.25f)), - static_cast(0.9999414458034701919327379302959430043671e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6a, d6a, static_cast(0.125)), - static_cast(0.1105787665293227020667219792530925829572e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6a, d6a, static_cast(0.25)), - static_cast(0.1052430112515949425820670455863588910799e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6a, d6a, static_cast(0.75)), - static_cast(0.9120378868534087154447666948125848966555e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6a, d6a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8626539746676637108178973543021882567334e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6a, d6a, static_cast(6.5f)), - static_cast(0.9109197333022141385660730837432462113756e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n6a, d6a, static_cast(10247.25f)), - static_cast(0.9999414458034701919327379302959430043671e0L), - tolerance); - - // - // Polynomials of order 6 - // - static const U n7c[7] = { 3, 4, 11, 5, 10, 7, 9 }; - static const boost::array n7a = { 3, 4, 11, 5, 10, 7, 9 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7c, static_cast(0.125), 7), - static_cast(0.3684329986572265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7c, static_cast(0.25), 7), - static_cast(0.4813720703125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7c, static_cast(0.75), 7), - static_cast(0.20723876953125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7c, static_cast(1.0f - 1.0f/64.0f), 7), - static_cast(0.46413680258337990380823612213134765625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7c, static_cast(6.5), 7), - static_cast(0.779707859375e6L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7c, static_cast(10247.25), 7), - static_cast(0.10421241651331160693970241510986328125e26L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7c, static_cast(0.125)), - static_cast(0.3684329986572265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7c, static_cast(0.25)), - static_cast(0.4813720703125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7c, static_cast(0.75)), - static_cast(0.20723876953125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.46413680258337990380823612213134765625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7c, static_cast(6.5)), - static_cast(0.779707859375e6L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7c, static_cast(10247.25)), - static_cast(0.10421241651331160693970241510986328125e26L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7a, static_cast(0.125)), - static_cast(0.3684329986572265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7a, static_cast(0.25)), - static_cast(0.4813720703125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7a, static_cast(0.75)), - static_cast(0.20723876953125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.46413680258337990380823612213134765625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7a, static_cast(6.5)), - static_cast(0.779707859375e6L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n7a, static_cast(10247.25)), - static_cast(0.10421241651331160693970241510986328125e26L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7c, static_cast(0.125), 7), - static_cast(0.3065205223058001138269901275634765625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7c, static_cast(0.25), 7), - static_cast(0.3294349253177642822265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7c, static_cast(0.75), 7), - static_cast(0.11300772249698638916015625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7c, static_cast(1.0f - 1.0f/64.0f), 7), - static_cast(0.4400013192129567626077980251194602528964e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7c, static_cast(6.5f), 7), - static_cast(0.52166734985505126953125e11L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7c, static_cast(0.125)), - static_cast(0.3065205223058001138269901275634765625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7c, static_cast(0.25)), - static_cast(0.3294349253177642822265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7c, static_cast(0.75)), - static_cast(0.11300772249698638916015625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4400013192129567626077980251194602528964e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7c, static_cast(6.5f)), - static_cast(0.52166734985505126953125e11L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7a, static_cast(0.125)), - static_cast(0.3065205223058001138269901275634765625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7a, static_cast(0.25)), - static_cast(0.3294349253177642822265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7a, static_cast(0.75)), - static_cast(0.11300772249698638916015625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4400013192129567626077980251194602528964e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n7a, static_cast(6.5f)), - static_cast(0.52166734985505126953125e11L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(0.125), 7), - static_cast(0.3521641784464009106159210205078125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(0.25), 7), - static_cast(0.41773970127105712890625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(0.75), 7), - static_cast(0.140676963329315185546875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(1.0f - 1.0f/64.0f), 7), - static_cast(0.4465092766607814731253821207562770823074e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(6.5f), 7), - static_cast(0.802565153877001953125e10L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(0.125)), - static_cast(0.3521641784464009106159210205078125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(0.25)), - static_cast(0.41773970127105712890625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(0.75)), - static_cast(0.140676963329315185546875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4465092766607814731253821207562770823074e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(6.5f)), - static_cast(0.802565153877001953125e10L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7a, static_cast(0.125)), - static_cast(0.3521641784464009106159210205078125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7a, static_cast(0.25)), - static_cast(0.41773970127105712890625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7a, static_cast(0.75)), - static_cast(0.140676963329315185546875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4465092766607814731253821207562770823074e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n7a, static_cast(6.5f)), - static_cast(0.802565153877001953125e10L), - tolerance); - // - // Rational functions of order 6 - // - static const U d7c[7] = { 2, 8, 10, 8, 1, 11, 1 }; - static const boost::array d7a = { 2, 8, 10, 8, 1, 11, 1 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7c, d7c, static_cast(0.125), 7), - static_cast(0.1161348466465698540596242849979738853664e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7c, d7c, static_cast(0.25), 7), - static_cast(0.1010247476558897371522262642824204539632e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7c, d7c, static_cast(0.75), 7), - static_cast(0.103079575951134804308491906398377636644e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7c, d7c, static_cast(1.0f - 1.0f/64.0f), 7), - static_cast(0.1183671559390403425417413542214181025989e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7c, d7c, static_cast(6.5f), 7), - static_cast(0.3757457624476840396478985178609736319955e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7c, d7c, static_cast(10247.25f), 7), - static_cast(0.8991031618241406513349732955332873069556e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7c, d7c, static_cast(0.125)), - static_cast(0.1161348466465698540596242849979738853664e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7c, d7c, static_cast(0.25)), - static_cast(0.1010247476558897371522262642824204539632e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7c, d7c, static_cast(0.75)), - static_cast(0.103079575951134804308491906398377636644e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7c, d7c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1183671559390403425417413542214181025989e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7c, d7c, static_cast(6.5f)), - static_cast(0.3757457624476840396478985178609736319955e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7c, d7c, static_cast(10247.25f)), - static_cast(0.8991031618241406513349732955332873069556e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7a, d7a, static_cast(0.125)), - static_cast(0.1161348466465698540596242849979738853664e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7a, d7a, static_cast(0.25)), - static_cast(0.1010247476558897371522262642824204539632e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7a, d7a, static_cast(0.75)), - static_cast(0.103079575951134804308491906398377636644e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7a, d7a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1183671559390403425417413542214181025989e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7a, d7a, static_cast(6.5f)), - static_cast(0.3757457624476840396478985178609736319955e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n7a, d7a, static_cast(10247.25f)), - static_cast(0.8991031618241406513349732955332873069556e1L), - tolerance); - - // - // Polynomials of order 7 - // - static const U n8c[8] = { 9, 5, 6, 1, 12, 2, 11, 1 }; - static const boost::array n8a = { 9, 5, 6, 1, 12, 2, 11, 1 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8c, static_cast(0.125), 8), - static_cast(0.9723736286163330078125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8c, static_cast(0.25), 8), - static_cast(0.1069219970703125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8c, static_cast(0.75), 8), - static_cast(0.2290960693359375e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8c, static_cast(1.0f - 1.0f/64.0f), 8), - static_cast(0.4470947054706607559637632220983505249023e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8c, static_cast(6.5), 8), - static_cast(0.13650267734375e7L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8c, static_cast(10247.25), 8), - static_cast(0.1187728773094625678513681460864459228516e29L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8c, static_cast(0.125)), - static_cast(0.9723736286163330078125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8c, static_cast(0.25)), - static_cast(0.1069219970703125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8c, static_cast(0.75)), - static_cast(0.2290960693359375e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4470947054706607559637632220983505249023e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8c, static_cast(6.5)), - static_cast(0.13650267734375e7L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8c, static_cast(10247.25)), - static_cast(0.1187728773094625678513681460864459228516e29L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8a, static_cast(0.125)), - static_cast(0.9723736286163330078125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8a, static_cast(0.25)), - static_cast(0.1069219970703125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8a, static_cast(0.75)), - static_cast(0.2290960693359375e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4470947054706607559637632220983505249023e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8a, static_cast(6.5)), - static_cast(0.13650267734375e7L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n8a, static_cast(10247.25)), - static_cast(0.1187728773094625678513681460864459228516e29L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8c, static_cast(0.125), 8), - static_cast(0.9079594375725946520105935633182525634766e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8c, static_cast(0.25), 8), - static_cast(0.93363673128187656402587890625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8c, static_cast(0.75), 8), - static_cast(0.155691558457911014556884765625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8c, static_cast(1.0f - 1.0f/64.0f), 8), - static_cast(0.4258457138999176910226338119632657870077e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8c, static_cast(6.5f), 8), - static_cast(0.30319406120433428955078125e12L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8c, static_cast(0.125)), - static_cast(0.9079594375725946520105935633182525634766e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8c, static_cast(0.25)), - static_cast(0.93363673128187656402587890625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8c, static_cast(0.75)), - static_cast(0.155691558457911014556884765625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4258457138999176910226338119632657870077e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8c, static_cast(6.5f)), - static_cast(0.30319406120433428955078125e12L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8a, static_cast(0.125)), - static_cast(0.9079594375725946520105935633182525634766e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8a, static_cast(0.25)), - static_cast(0.93363673128187656402587890625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8a, static_cast(0.75)), - static_cast(0.155691558457911014556884765625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4258457138999176910226338119632657870077e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n8a, static_cast(6.5f)), - static_cast(0.30319406120433428955078125e12L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(0.125), 8), - static_cast(0.9636755005807572160847485065460205078125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(0.25), 8), - static_cast(0.1034546925127506256103515625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(0.75), 8), - static_cast(0.1775887446105480194091796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(1.0f - 1.0f/64.0f), 8), - static_cast(0.4311765982475354321499772058039525455316e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(6.5f), 8), - static_cast(0.466452401928975830078125e11L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(0.125)), - static_cast(0.9636755005807572160847485065460205078125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(0.25)), - static_cast(0.1034546925127506256103515625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(0.75)), - static_cast(0.1775887446105480194091796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4311765982475354321499772058039525455316e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(6.5f)), - static_cast(0.466452401928975830078125e11L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8a, static_cast(0.125)), - static_cast(0.9636755005807572160847485065460205078125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8a, static_cast(0.25)), - static_cast(0.1034546925127506256103515625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8a, static_cast(0.75)), - static_cast(0.1775887446105480194091796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4311765982475354321499772058039525455316e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n8a, static_cast(6.5f)), - static_cast(0.466452401928975830078125e11L), - tolerance); - // - // Rational functions of order 7 - // - static const U d8c[8] = { 7, 10, 10, 11, 2, 4, 1, 7 }; - static const boost::array d8a = { 7, 10, 10, 11, 2, 4, 1, 7 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8c, d8c, static_cast(0.125), 8), - static_cast(0.1153693678861771369296601206130394355814e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8c, d8c, static_cast(0.25), 8), - static_cast(0.103714470093009762768860970830101771981e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8c, d8c, static_cast(0.75), 8), - static_cast(0.834289461108456229648481346061946410909e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8c, d8c, static_cast(1.0f - 1.0f/64.0f), 8), - static_cast(0.8981362736388035283180082845549732926578e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8c, d8c, static_cast(6.5f), 8), - static_cast(0.383383275200627223098571833372266642165e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8c, d8c, static_cast(10247.25f), 8), - static_cast(0.1430085023641929377426860779365964126311e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8c, d8c, static_cast(0.125)), - static_cast(0.1153693678861771369296601206130394355814e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8c, d8c, static_cast(0.25)), - static_cast(0.103714470093009762768860970830101771981e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8c, d8c, static_cast(0.75)), - static_cast(0.834289461108456229648481346061946410909e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8c, d8c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8981362736388035283180082845549732926578e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8c, d8c, static_cast(6.5f)), - static_cast(0.383383275200627223098571833372266642165e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8c, d8c, static_cast(10247.25f)), - static_cast(0.1430085023641929377426860779365964126311e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8a, d8a, static_cast(0.125)), - static_cast(0.1153693678861771369296601206130394355814e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8a, d8a, static_cast(0.25)), - static_cast(0.103714470093009762768860970830101771981e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8a, d8a, static_cast(0.75)), - static_cast(0.834289461108456229648481346061946410909e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8a, d8a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8981362736388035283180082845549732926578e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8a, d8a, static_cast(6.5f)), - static_cast(0.383383275200627223098571833372266642165e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n8a, d8a, static_cast(10247.25f)), - static_cast(0.1430085023641929377426860779365964126311e0L), - tolerance); - - // - // Polynomials of order 8 - // - static const U n9c[9] = { 3, 9, 3, 9, 5, 6, 10, 7, 10 }; - static const boost::array n9a = { 3, 9, 3, 9, 5, 6, 10, 7, 10 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9c, static_cast(0.125), 9), - static_cast(0.419089901447296142578125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9c, static_cast(0.25), 9), - static_cast(0.5606536865234375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9c, static_cast(0.75), 9), - static_cast(0.21955535888671875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9c, static_cast(1.0f - 1.0f/64.0f), 9), - static_cast(0.577754343750660055434309470001608133316e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9c, static_cast(6.5), 9), - static_cast(0.3613143234375e8L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9c, static_cast(10247.25), 9), - static_cast(0.1215873306624182859977656082228297326996e34L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9c, static_cast(0.125)), - static_cast(0.419089901447296142578125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9c, static_cast(0.25)), - static_cast(0.5606536865234375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9c, static_cast(0.75)), - static_cast(0.21955535888671875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.577754343750660055434309470001608133316e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9c, static_cast(6.5)), - static_cast(0.3613143234375e8L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9c, static_cast(10247.25)), - static_cast(0.1215873306624182859977656082228297326996e34L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9a, static_cast(0.125)), - static_cast(0.419089901447296142578125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9a, static_cast(0.25)), - static_cast(0.5606536865234375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9a, static_cast(0.75)), - static_cast(0.21955535888671875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.577754343750660055434309470001608133316e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9a, static_cast(6.5)), - static_cast(0.3613143234375e8L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n9a, static_cast(10247.25)), - static_cast(0.1215873306624182859977656082228297326996e34L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9c, static_cast(0.125), 9), - static_cast(0.3141392057908696244794555241242051124573e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9c, static_cast(0.25), 9), - static_cast(0.35764986560679972171783447265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9c, static_cast(0.75), 9), - static_cast(0.119936861679889261722564697265625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9c, static_cast(1.0f - 1.0f/64.0f), 9), - static_cast(0.5392583642412261279423815221065846904997e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9c, static_cast(6.5f), 9), - static_cast(0.103274449934495763275146484375e15L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9c, static_cast(0.125)), - static_cast(0.3141392057908696244794555241242051124573e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9c, static_cast(0.25)), - static_cast(0.35764986560679972171783447265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9c, static_cast(0.75)), - static_cast(0.119936861679889261722564697265625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.5392583642412261279423815221065846904997e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9c, static_cast(6.5f)), - static_cast(0.103274449934495763275146484375e15L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9a, static_cast(0.125)), - static_cast(0.3141392057908696244794555241242051124573e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9a, static_cast(0.25)), - static_cast(0.35764986560679972171783447265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9a, static_cast(0.75)), - static_cast(0.119936861679889261722564697265625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.5392583642412261279423815221065846904997e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n9a, static_cast(6.5f)), - static_cast(0.103274449934495763275146484375e15L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(0.125), 9), - static_cast(0.4131136463269569958356441929936408996582e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(0.25), 9), - static_cast(0.530599462427198886871337890625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(0.75), 9), - static_cast(0.1499158155731856822967529296875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(1.0f - 1.0f/64.0f), 9), - static_cast(0.5473418303402932093382923399178003205076e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(6.5f), 9), - static_cast(0.1588837691300188665771484375e14L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(0.125)), - static_cast(0.4131136463269569958356441929936408996582e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(0.25)), - static_cast(0.530599462427198886871337890625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(0.75)), - static_cast(0.1499158155731856822967529296875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.5473418303402932093382923399178003205076e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(6.5f)), - static_cast(0.1588837691300188665771484375e14L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9a, static_cast(0.125)), - static_cast(0.4131136463269569958356441929936408996582e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9a, static_cast(0.25)), - static_cast(0.530599462427198886871337890625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9a, static_cast(0.75)), - static_cast(0.1499158155731856822967529296875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.5473418303402932093382923399178003205076e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n9a, static_cast(6.5f)), - static_cast(0.1588837691300188665771484375e14L), - tolerance); - // - // Rational functions of order 8 - // - static const U d9c[9] = { 12, 3, 10, 4, 6, 6, 6, 10, 7 }; - static const boost::array d9a = { 12, 3, 10, 4, 6, 6, 6, 10, 7 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9c, d9c, static_cast(0.125), 9), - static_cast(0.3341827920887278954826517708316980450243e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9c, d9c, static_cast(0.25), 9), - static_cast(0.4162555242250224594229316089330159747956e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9c, d9c, static_cast(0.75), 9), - static_cast(0.7844550246723573100342976024389406178802e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9c, d9c, static_cast(1.0f - 1.0f/64.0f), 9), - static_cast(0.959335028097323235424759017468360386113e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9c, d9c, static_cast(6.5f), 9), - static_cast(0.1302420407483849169746727326286868117535e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9c, d9c, static_cast(10247.25f), 9), - static_cast(0.1428469874366314841691622991213446692856e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9c, d9c, static_cast(0.125)), - static_cast(0.3341827920887278954826517708316980450243e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9c, d9c, static_cast(0.25)), - static_cast(0.4162555242250224594229316089330159747956e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9c, d9c, static_cast(0.75)), - static_cast(0.7844550246723573100342976024389406178802e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9c, d9c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.959335028097323235424759017468360386113e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9c, d9c, static_cast(6.5f)), - static_cast(0.1302420407483849169746727326286868117535e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9c, d9c, static_cast(10247.25f)), - static_cast(0.1428469874366314841691622991213446692856e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9a, d9a, static_cast(0.125)), - static_cast(0.3341827920887278954826517708316980450243e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9a, d9a, static_cast(0.25)), - static_cast(0.4162555242250224594229316089330159747956e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9a, d9a, static_cast(0.75)), - static_cast(0.7844550246723573100342976024389406178802e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9a, d9a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.959335028097323235424759017468360386113e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9a, d9a, static_cast(6.5f)), - static_cast(0.1302420407483849169746727326286868117535e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n9a, d9a, static_cast(10247.25f)), - static_cast(0.1428469874366314841691622991213446692856e1L), - tolerance); - - // - // Polynomials of order 9 - // - static const U n10c[10] = { 3, 4, 2, 6, 8, 1, 2, 4, 8, 8 }; - static const boost::array n10a = { 3, 4, 2, 6, 8, 1, 2, 4, 8, 8 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10c, static_cast(0.125), 10), - static_cast(0.3544962465763092041015625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10c, static_cast(0.25), 10), - static_cast(0.4251861572265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10c, static_cast(0.75), 10), - static_cast(0.14716278076171875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10c, static_cast(1.0f - 1.0f/64.0f), 10), - static_cast(0.4243246072286939307716124858416151255369e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10c, static_cast(6.5), 10), - static_cast(0.193326261328125e9L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10c, static_cast(10247.25), 10), - static_cast(0.9967777935240642903307419028007759631098e37L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10c, static_cast(0.125)), - static_cast(0.3544962465763092041015625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10c, static_cast(0.25)), - static_cast(0.4251861572265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10c, static_cast(0.75)), - static_cast(0.14716278076171875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4243246072286939307716124858416151255369e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10c, static_cast(6.5)), - static_cast(0.193326261328125e9L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10c, static_cast(10247.25)), - static_cast(0.9967777935240642903307419028007759631098e37L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10a, static_cast(0.125)), - static_cast(0.3544962465763092041015625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10a, static_cast(0.25)), - static_cast(0.4251861572265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10a, static_cast(0.75)), - static_cast(0.14716278076171875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.4243246072286939307716124858416151255369e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10a, static_cast(6.5)), - static_cast(0.193326261328125e9L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n10a, static_cast(10247.25)), - static_cast(0.9967777935240642903307419028007759631098e37L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10c, static_cast(0.125), 10), - static_cast(0.3063011647232116718697625401546247303486e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10c, static_cast(0.25), 10), - static_cast(0.3259400503826327621936798095703125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10c, static_cast(0.75), 10), - static_cast(0.8067807371844537556171417236328125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10c, static_cast(1.0f - 1.0f/64.0f), 10), - static_cast(0.3922779295817342542834377568121069117613e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10c, static_cast(6.5f), 10), - static_cast(0.3514067090785774022613525390625e16L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10c, static_cast(0.125)), - static_cast(0.3063011647232116718697625401546247303486e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10c, static_cast(0.25)), - static_cast(0.3259400503826327621936798095703125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10c, static_cast(0.75)), - static_cast(0.8067807371844537556171417236328125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.3922779295817342542834377568121069117613e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10c, static_cast(6.5f)), - static_cast(0.3514067090785774022613525390625e16L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10a, static_cast(0.125)), - static_cast(0.3063011647232116718697625401546247303486e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10a, static_cast(0.25)), - static_cast(0.3259400503826327621936798095703125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10a, static_cast(0.75)), - static_cast(0.8067807371844537556171417236328125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.3922779295817342542834377568121069117613e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n10a, static_cast(6.5f)), - static_cast(0.3514067090785774022613525390625e16L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(0.125), 10), - static_cast(0.3504093177856933749581003212369978427887e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(0.25), 10), - static_cast(0.40376020153053104877471923828125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(0.75), 10), - static_cast(0.97570764957927167415618896484375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(1.0f - 1.0f/64.0f), 10), - static_cast(0.3980283729084284487958732767615054341702e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(6.5f), 10), - static_cast(0.54062570627473700347900390625e15L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(0.125)), - static_cast(0.3504093177856933749581003212369978427887e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(0.25)), - static_cast(0.40376020153053104877471923828125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(0.75)), - static_cast(0.97570764957927167415618896484375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.3980283729084284487958732767615054341702e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(6.5f)), - static_cast(0.54062570627473700347900390625e15L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10a, static_cast(0.125)), - static_cast(0.3504093177856933749581003212369978427887e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10a, static_cast(0.25)), - static_cast(0.40376020153053104877471923828125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10a, static_cast(0.75)), - static_cast(0.97570764957927167415618896484375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.3980283729084284487958732767615054341702e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n10a, static_cast(6.5f)), - static_cast(0.54062570627473700347900390625e15L), - tolerance); - // - // Rational functions of order 9 - // - static const U d10c[10] = { 3, 11, 1, 12, 8, 8, 7, 10, 8, 8 }; - static const boost::array d10a = { 3, 11, 1, 12, 8, 8, 7, 10, 8, 8 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10c, d10c, static_cast(0.125), 10), - static_cast(0.8027011456035955638016996485812217742707e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10c, d10c, static_cast(0.25), 10), - static_cast(0.7037718026559713894599659542655668311705e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10c, d10c, static_cast(0.75), 10), - static_cast(0.5819711007563332500606442409694389231031e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10c, d10c, static_cast(1.0f - 1.0f/64.0f), 10), - static_cast(0.6021345078884753739086911192013079405483e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10c, d10c, static_cast(6.5f), 10), - static_cast(0.9827105949744728065574239430024037810213e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10c, d10c, static_cast(10247.25f), 10), - static_cast(0.9999999928576761766405011572543053028339e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10c, d10c, static_cast(0.125)), - static_cast(0.8027011456035955638016996485812217742707e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10c, d10c, static_cast(0.25)), - static_cast(0.7037718026559713894599659542655668311705e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10c, d10c, static_cast(0.75)), - static_cast(0.5819711007563332500606442409694389231031e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10c, d10c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.6021345078884753739086911192013079405483e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10c, d10c, static_cast(6.5f)), - static_cast(0.9827105949744728065574239430024037810213e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10c, d10c, static_cast(10247.25f)), - static_cast(0.9999999928576761766405011572543053028339e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10a, d10a, static_cast(0.125)), - static_cast(0.8027011456035955638016996485812217742707e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10a, d10a, static_cast(0.25)), - static_cast(0.7037718026559713894599659542655668311705e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10a, d10a, static_cast(0.75)), - static_cast(0.5819711007563332500606442409694389231031e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10a, d10a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.6021345078884753739086911192013079405483e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10a, d10a, static_cast(6.5f)), - static_cast(0.9827105949744728065574239430024037810213e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n10a, d10a, static_cast(10247.25f)), - static_cast(0.9999999928576761766405011572543053028339e0L), - tolerance); - - // - // Polynomials of order 10 - // - static const U n11c[11] = { 2, 2, 8, 11, 3, 4, 10, 11, 5, 1, 6 }; - static const boost::array n11a = { 2, 2, 8, 11, 3, 4, 10, 11, 5, 1, 6 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11c, static_cast(0.125), 11), - static_cast(0.239738257043063640594482421875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11c, static_cast(0.25), 11), - static_cast(0.31906986236572265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11c, static_cast(0.75), 11), - static_cast(0.187007007598876953125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11c, static_cast(1.0f - 1.0f/64.0f), 11), - static_cast(0.5807897685780276847943015550157497273176e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11c, static_cast(6.5), 11), - static_cast(0.85061053443359375e9L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11c, static_cast(0.125)), - static_cast(0.239738257043063640594482421875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11c, static_cast(0.25)), - static_cast(0.31906986236572265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11c, static_cast(0.75)), - static_cast(0.187007007598876953125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.5807897685780276847943015550157497273176e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11c, static_cast(6.5)), - static_cast(0.85061053443359375e9L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11a, static_cast(0.125)), - static_cast(0.239738257043063640594482421875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11a, static_cast(0.25)), - static_cast(0.31906986236572265625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11a, static_cast(0.75)), - static_cast(0.187007007598876953125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.5807897685780276847943015550157497273176e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n11a, static_cast(6.5)), - static_cast(0.85061053443359375e9L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11c, static_cast(0.125), 11), - static_cast(0.2033245269357184586631048794913567689946e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11c, static_cast(0.25), 11), - static_cast(0.2158985776148256263695657253265380859375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11c, static_cast(0.75), 11), - static_cast(0.8727145384755203849636018276214599609375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11c, static_cast(1.0f - 1.0f/64.0f), 11), - static_cast(0.5363972553738812062759598952966094072427e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11c, static_cast(6.5f), 11), - static_cast(0.1092297265410211371166019439697265625e18L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11c, static_cast(0.125)), - static_cast(0.2033245269357184586631048794913567689946e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11c, static_cast(0.25)), - static_cast(0.2158985776148256263695657253265380859375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11c, static_cast(0.75)), - static_cast(0.8727145384755203849636018276214599609375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.5363972553738812062759598952966094072427e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11c, static_cast(6.5f)), - static_cast(0.1092297265410211371166019439697265625e18L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11a, static_cast(0.125)), - static_cast(0.2033245269357184586631048794913567689946e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11a, static_cast(0.25)), - static_cast(0.2158985776148256263695657253265380859375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11a, static_cast(0.75)), - static_cast(0.8727145384755203849636018276214599609375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.5363972553738812062759598952966094072427e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n11a, static_cast(6.5f)), - static_cast(0.1092297265410211371166019439697265625e18L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(0.125), 11), - static_cast(0.2265962154857476693048390359308541519567e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(0.25), 11), - static_cast(0.26359431045930250547826290130615234375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(0.75), 11), - static_cast(0.109695271796736051328480243682861328125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(1.0f - 1.0f/64.0f), 11), - static_cast(0.544594037205212653994625925380682572437e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(6.5f), 11), - static_cast(0.16804573314003253556400299072265625e17L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(0.125)), - static_cast(0.2265962154857476693048390359308541519567e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(0.25)), - static_cast(0.26359431045930250547826290130615234375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(0.75)), - static_cast(0.109695271796736051328480243682861328125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.544594037205212653994625925380682572437e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(6.5f)), - static_cast(0.16804573314003253556400299072265625e17L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11a, static_cast(0.125)), - static_cast(0.2265962154857476693048390359308541519567e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11a, static_cast(0.25)), - static_cast(0.26359431045930250547826290130615234375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11a, static_cast(0.75)), - static_cast(0.109695271796736051328480243682861328125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.544594037205212653994625925380682572437e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n11a, static_cast(6.5f)), - static_cast(0.16804573314003253556400299072265625e17L), - tolerance); - // - // Rational functions of order 10 - // - static const U d11c[11] = { 4, 1, 3, 9, 11, 8, 11, 2, 6, 6, 4 }; - static const boost::array d11a = { 4, 1, 3, 9, 11, 8, 11, 2, 6, 6, 4 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11c, d11c, static_cast(0.125), 11), - static_cast(0.5718365676248588095654568811483084403598e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11c, d11c, static_cast(0.25), 11), - static_cast(0.6888631839546304707516922567568791812269e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11c, d11c, static_cast(0.75), 11), - static_cast(0.9783539912974912482969079012097816310129e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11c, d11c, static_cast(1.0f - 1.0f/64.0f), 11), - static_cast(0.9694017102874332007392886881642471036972e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11c, d11c, static_cast(6.5f), 11), - static_cast(0.1243900864392932237542421996384079347041e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11c, d11c, static_cast(10247.25f), 11), - static_cast(0.1499804844733304585200728061706913399511e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11c, d11c, static_cast(0.125)), - static_cast(0.5718365676248588095654568811483084403598e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11c, d11c, static_cast(0.25)), - static_cast(0.6888631839546304707516922567568791812269e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11c, d11c, static_cast(0.75)), - static_cast(0.9783539912974912482969079012097816310129e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11c, d11c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.9694017102874332007392886881642471036972e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11c, d11c, static_cast(6.5f)), - static_cast(0.1243900864392932237542421996384079347041e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11c, d11c, static_cast(10247.25f)), - static_cast(0.1499804844733304585200728061706913399511e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11a, d11a, static_cast(0.125)), - static_cast(0.5718365676248588095654568811483084403598e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11a, d11a, static_cast(0.25)), - static_cast(0.6888631839546304707516922567568791812269e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11a, d11a, static_cast(0.75)), - static_cast(0.9783539912974912482969079012097816310129e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11a, d11a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.9694017102874332007392886881642471036972e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11a, d11a, static_cast(6.5f)), - static_cast(0.1243900864392932237542421996384079347041e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n11a, d11a, static_cast(10247.25f)), - static_cast(0.1499804844733304585200728061706913399511e1L), - tolerance); - - // - // Polynomials of order 11 - // - static const U n12c[12] = { 10, 12, 4, 1, 12, 7, 11, 5, 12, 5, 10, 6 }; - static const boost::array n12a = { 10, 12, 4, 1, 12, 7, 11, 5, 12, 5, 10, 6 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12c, static_cast(0.125), 12), - static_cast(0.1156764154392294585704803466796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12c, static_cast(0.25), 12), - static_cast(0.13322539806365966796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12c, static_cast(0.75), 12), - static_cast(0.32148390293121337890625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12c, static_cast(1.0f - 1.0f/64.0f), 12), - static_cast(0.8737331822870016474402916385744166660743e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12c, static_cast(6.5), 12), - static_cast(0.67419250750654296875e10L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12c, static_cast(0.125)), - static_cast(0.1156764154392294585704803466796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12c, static_cast(0.25)), - static_cast(0.13322539806365966796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12c, static_cast(0.75)), - static_cast(0.32148390293121337890625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8737331822870016474402916385744166660743e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12c, static_cast(6.5)), - static_cast(0.67419250750654296875e10L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12a, static_cast(0.125)), - static_cast(0.1156764154392294585704803466796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12a, static_cast(0.25)), - static_cast(0.13322539806365966796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12a, static_cast(0.75)), - static_cast(0.32148390293121337890625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8737331822870016474402916385744166660743e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n12a, static_cast(6.5)), - static_cast(0.67419250750654296875e10L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12c, static_cast(0.125), 12), - static_cast(0.101884810991335118067599354446661763518e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12c, static_cast(0.25), 12), - static_cast(0.1076605959896767217287560924887657165527e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12c, static_cast(0.75), 12), - static_cast(0.2041755737073560794669901952147483825684e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12c, static_cast(1.0f - 1.0f/64.0f), 12), - static_cast(0.8060387357327405373376954971672611741429e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12c, static_cast(6.5f), 12), - static_cast(0.4778085851102157284559772014617919921875e19L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12c, static_cast(0.125)), - static_cast(0.101884810991335118067599354446661763518e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12c, static_cast(0.25)), - static_cast(0.1076605959896767217287560924887657165527e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12c, static_cast(0.75)), - static_cast(0.2041755737073560794669901952147483825684e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8060387357327405373376954971672611741429e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12c, static_cast(6.5f)), - static_cast(0.4778085851102157284559772014617919921875e19L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12a, static_cast(0.125)), - static_cast(0.101884810991335118067599354446661763518e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12a, static_cast(0.25)), - static_cast(0.1076605959896767217287560924887657165527e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12a, static_cast(0.75)), - static_cast(0.2041755737073560794669901952147483825684e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8060387357327405373376954971672611741429e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n12a, static_cast(6.5f)), - static_cast(0.4778085851102157284559772014617919921875e19L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(0.125), 12), - static_cast(0.1150784879306809445407948355732941081442e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(0.25), 12), - static_cast(0.1306423839587068869150243699550628662109e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(0.75), 12), - static_cast(0.2389007649431414392893202602863311767578e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(1.0f - 1.0f/64.0f), 12), - static_cast(0.8172456997919903871367065368048367483356e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(6.5f), 12), - static_cast(0.73509013093879343685534954071044921875e18L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(0.125)), - static_cast(0.1150784879306809445407948355732941081442e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(0.25)), - static_cast(0.1306423839587068869150243699550628662109e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(0.75)), - static_cast(0.2389007649431414392893202602863311767578e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8172456997919903871367065368048367483356e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(6.5f)), - static_cast(0.73509013093879343685534954071044921875e18L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12a, static_cast(0.125)), - static_cast(0.1150784879306809445407948355732941081442e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12a, static_cast(0.25)), - static_cast(0.1306423839587068869150243699550628662109e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12a, static_cast(0.75)), - static_cast(0.2389007649431414392893202602863311767578e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8172456997919903871367065368048367483356e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n12a, static_cast(6.5f)), - static_cast(0.73509013093879343685534954071044921875e18L), - tolerance); - // - // Rational functions of order 11 - // - static const U d12c[12] = { 12, 5, 2, 8, 3, 2, 6, 9, 2, 8, 9, 12 }; - static const boost::array d12a = { 12, 5, 2, 8, 3, 2, 6, 9, 2, 8, 9, 12 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12c, d12c, static_cast(0.125), 12), - static_cast(0.9128003783370762743953357962892418132189e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12c, d12c, static_cast(0.25), 12), - static_cast(0.9857041905689267091438933694601440838819e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12c, d12c, static_cast(0.75), 12), - static_cast(0.1248112763387283893598834927961632655902e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12c, d12c, static_cast(1.0f - 1.0f/64.0f), 12), - static_cast(0.1227813945781309965073515980672922656926e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12c, d12c, static_cast(6.5f), 12), - static_cast(0.5670462630528956417277364302989555872917e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12c, d12c, static_cast(10247.25f), 12), - static_cast(0.5000447249679368028702341332079904080375e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12c, d12c, static_cast(0.125)), - static_cast(0.9128003783370762743953357962892418132189e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12c, d12c, static_cast(0.25)), - static_cast(0.9857041905689267091438933694601440838819e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12c, d12c, static_cast(0.75)), - static_cast(0.1248112763387283893598834927961632655902e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12c, d12c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1227813945781309965073515980672922656926e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12c, d12c, static_cast(6.5f)), - static_cast(0.5670462630528956417277364302989555872917e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12c, d12c, static_cast(10247.25f)), - static_cast(0.5000447249679368028702341332079904080375e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12a, d12a, static_cast(0.125)), - static_cast(0.9128003783370762743953357962892418132189e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12a, d12a, static_cast(0.25)), - static_cast(0.9857041905689267091438933694601440838819e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12a, d12a, static_cast(0.75)), - static_cast(0.1248112763387283893598834927961632655902e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12a, d12a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1227813945781309965073515980672922656926e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12a, d12a, static_cast(6.5f)), - static_cast(0.5670462630528956417277364302989555872917e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n12a, d12a, static_cast(10247.25f)), - static_cast(0.5000447249679368028702341332079904080375e0L), - tolerance); - - // - // Polynomials of order 12 - // - static const U n13c[13] = { 4, 11, 7, 1, 1, 1, 8, 11, 10, 12, 8, 2, 1 }; - static const boost::array n13a = { 4, 11, 7, 1, 1, 1, 8, 11, 10, 12, 8, 2, 1 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13c, static_cast(0.125), 13), - static_cast(0.5486639239141368307173252105712890625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13c, static_cast(0.25), 13), - static_cast(0.7210838854312896728515625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13c, static_cast(0.75), 13), - static_cast(0.22524036943912506103515625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13c, static_cast(1.0f - 1.0f/64.0f), 13), - static_cast(0.7013317633407797455061737623412208147977e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13c, static_cast(6.5), 13), - static_cast(0.8801602436469970703125e10L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13c, static_cast(0.125)), - static_cast(0.5486639239141368307173252105712890625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13c, static_cast(0.25)), - static_cast(0.7210838854312896728515625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13c, static_cast(0.75)), - static_cast(0.22524036943912506103515625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7013317633407797455061737623412208147977e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13c, static_cast(6.5)), - static_cast(0.8801602436469970703125e10L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13a, static_cast(0.125)), - static_cast(0.5486639239141368307173252105712890625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13a, static_cast(0.25)), - static_cast(0.7210838854312896728515625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13a, static_cast(0.75)), - static_cast(0.22524036943912506103515625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7013317633407797455061737623412208147977e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n13a, static_cast(6.5)), - static_cast(0.8801602436469970703125e10L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13c, static_cast(0.125), 13), - static_cast(0.4173587859727185607499727379291788731397e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13c, static_cast(0.25), 13), - static_cast(0.4715104623414053008900737040676176548004e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13c, static_cast(0.75), 13), - static_cast(0.1338397611887558369403450342360883951187e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13c, static_cast(1.0f - 1.0f/64.0f), 13), - static_cast(0.6407202225497595548875186059951665936749e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13c, static_cast(6.5f), 13), - static_cast(0.3403521961549553788009664398431777954102e20L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13c, static_cast(0.125)), - static_cast(0.4173587859727185607499727379291788731397e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13c, static_cast(0.25)), - static_cast(0.4715104623414053008900737040676176548004e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13c, static_cast(0.75)), - static_cast(0.1338397611887558369403450342360883951187e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.6407202225497595548875186059951665936749e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13c, static_cast(6.5f)), - static_cast(0.3403521961549553788009664398431777954102e20L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13a, static_cast(0.125)), - static_cast(0.4173587859727185607499727379291788731397e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13a, static_cast(0.25)), - static_cast(0.4715104623414053008900737040676176548004e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13a, static_cast(0.75)), - static_cast(0.1338397611887558369403450342360883951187e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.6407202225497595548875186059951665936749e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n13a, static_cast(6.5f)), - static_cast(0.3403521961549553788009664398431777954102e20L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(0.125), 13), - static_cast(0.5388702877817484859997819034334309851175e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(0.25), 13), - static_cast(0.6860418493656212035602948162704706192017e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(0.75), 13), - static_cast(0.165119681585007782587126712314784526825e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(1.0f - 1.0f/64.0f), 13), - static_cast(0.6502554641775335160762093775188993967491e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(6.5f), 13), - static_cast(0.5236187633153159677245637536048889160156e19L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(0.125)), - static_cast(0.5388702877817484859997819034334309851175e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(0.25)), - static_cast(0.6860418493656212035602948162704706192017e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(0.75)), - static_cast(0.165119681585007782587126712314784526825e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.6502554641775335160762093775188993967491e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(6.5f)), - static_cast(0.5236187633153159677245637536048889160156e19L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13a, static_cast(0.125)), - static_cast(0.5388702877817484859997819034334309851175e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13a, static_cast(0.25)), - static_cast(0.6860418493656212035602948162704706192017e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13a, static_cast(0.75)), - static_cast(0.165119681585007782587126712314784526825e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.6502554641775335160762093775188993967491e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n13a, static_cast(6.5f)), - static_cast(0.5236187633153159677245637536048889160156e19L), - tolerance); - // - // Rational functions of order 12 - // - static const U d13c[13] = { 4, 7, 1, 6, 11, 4, 9, 11, 1, 10, 1, 11, 12 }; - static const boost::array d13a = { 4, 7, 1, 6, 11, 4, 9, 11, 1, 10, 1, 11, 12 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13c, d13c, static_cast(0.125), 13), - static_cast(0.1118537310443419140823936840990235560775e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13c, d13c, static_cast(0.25), 13), - static_cast(0.12106743933208147312270004711488386001e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13c, d13c, static_cast(0.75), 13), - static_cast(0.1042994706832119738384940706309786965245e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13c, d13c, static_cast(1.0f - 1.0f/64.0f), 13), - static_cast(0.8849937505065081554917467830175954168154e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13c, d13c, static_cast(6.5f), 13), - static_cast(0.1125049235146435310211414108934070096386e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13c, d13c, static_cast(10247.25f), 13), - static_cast(0.8334214878002966556152610218152238753709e-1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13c, d13c, static_cast(0.125)), - static_cast(0.1118537310443419140823936840990235560775e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13c, d13c, static_cast(0.25)), - static_cast(0.12106743933208147312270004711488386001e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13c, d13c, static_cast(0.75)), - static_cast(0.1042994706832119738384940706309786965245e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13c, d13c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8849937505065081554917467830175954168154e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13c, d13c, static_cast(6.5f)), - static_cast(0.1125049235146435310211414108934070096386e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13c, d13c, static_cast(10247.25f)), - static_cast(0.8334214878002966556152610218152238753709e-1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13a, d13a, static_cast(0.125)), - static_cast(0.1118537310443419140823936840990235560775e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13a, d13a, static_cast(0.25)), - static_cast(0.12106743933208147312270004711488386001e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13a, d13a, static_cast(0.75)), - static_cast(0.1042994706832119738384940706309786965245e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13a, d13a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8849937505065081554917467830175954168154e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13a, d13a, static_cast(6.5f)), - static_cast(0.1125049235146435310211414108934070096386e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n13a, d13a, static_cast(10247.25f)), - static_cast(0.8334214878002966556152610218152238753709e-1L), - tolerance); - - // - // Polynomials of order 13 - // - static const U n14c[14] = { 5, 5, 3, 5, 12, 8, 10, 5, 5, 9, 2, 10, 3, 3 }; - static const boost::array n14a = { 5, 5, 3, 5, 12, 8, 10, 5, 5, 9, 2, 10, 3, 3 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14c, static_cast(0.125), 14), - static_cast(0.5684855352437807596288621425628662109375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14c, static_cast(0.25), 14), - static_cast(0.657317422330379486083984375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14c, static_cast(0.75), 14), - static_cast(0.2256699807941913604736328125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14c, static_cast(1.0f - 1.0f/64.0f), 14), - static_cast(0.7710103154409585858207746641830426369713e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14c, static_cast(6.5), 14), - static_cast(0.1372059025011920166015625e12L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14c, static_cast(0.125)), - static_cast(0.5684855352437807596288621425628662109375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14c, static_cast(0.25)), - static_cast(0.657317422330379486083984375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14c, static_cast(0.75)), - static_cast(0.2256699807941913604736328125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7710103154409585858207746641830426369713e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14c, static_cast(6.5)), - static_cast(0.1372059025011920166015625e12L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14a, static_cast(0.125)), - static_cast(0.5684855352437807596288621425628662109375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14a, static_cast(0.25)), - static_cast(0.657317422330379486083984375e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14a, static_cast(0.75)), - static_cast(0.2256699807941913604736328125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7710103154409585858207746641830426369713e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n14a, static_cast(6.5)), - static_cast(0.1372059025011920166015625e12L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14c, static_cast(0.125), 14), - static_cast(0.5078877218214320312311861835604176527818e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14c, static_cast(0.25), 14), - static_cast(0.5325630803958699699407475236512254923582e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14c, static_cast(0.75), 14), - static_cast(0.1183906394403697492911931021808413788676e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14c, static_cast(1.0f - 1.0f/64.0f), 14), - static_cast(0.7015764398304385537424317046920004042802e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14c, static_cast(6.5f), 14), - static_cast(0.4205557544065332561152158209905028343201e22L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14c, static_cast(0.125)), - static_cast(0.5078877218214320312311861835604176527818e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14c, static_cast(0.25)), - static_cast(0.5325630803958699699407475236512254923582e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14c, static_cast(0.75)), - static_cast(0.1183906394403697492911931021808413788676e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7015764398304385537424317046920004042802e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14c, static_cast(6.5f)), - static_cast(0.4205557544065332561152158209905028343201e22L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14a, static_cast(0.125)), - static_cast(0.5078877218214320312311861835604176527818e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14a, static_cast(0.25)), - static_cast(0.5325630803958699699407475236512254923582e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14a, static_cast(0.75)), - static_cast(0.1183906394403697492911931021808413788676e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7015764398304385537424317046920004042802e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n14a, static_cast(6.5f)), - static_cast(0.4205557544065332561152158209905028343201e22L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(0.125), 14), - static_cast(0.5631017745714562498494894684833412222547e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(0.25), 14), - static_cast(0.6302523215834798797629900946049019694328e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(0.75), 14), - static_cast(0.1411875192538263323882574695744551718235e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(1.0f - 1.0f/64.0f), 14), - static_cast(0.7119189230023502768177083984172702519672e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(6.5f), 14), - static_cast(0.6470088529331280863353320322930812835693e21L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(0.125)), - static_cast(0.5631017745714562498494894684833412222547e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(0.25)), - static_cast(0.6302523215834798797629900946049019694328e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(0.75)), - static_cast(0.1411875192538263323882574695744551718235e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7119189230023502768177083984172702519672e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(6.5f)), - static_cast(0.6470088529331280863353320322930812835693e21L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14a, static_cast(0.125)), - static_cast(0.5631017745714562498494894684833412222547e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14a, static_cast(0.25)), - static_cast(0.6302523215834798797629900946049019694328e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14a, static_cast(0.75)), - static_cast(0.1411875192538263323882574695744551718235e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7119189230023502768177083984172702519672e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n14a, static_cast(6.5f)), - static_cast(0.6470088529331280863353320322930812835693e21L), - tolerance); - // - // Rational functions of order 13 - // - static const U d14c[14] = { 1, 2, 1, 8, 5, 8, 2, 11, 3, 6, 5, 9, 7, 10 }; - static const boost::array d14a = { 1, 2, 1, 8, 5, 8, 2, 11, 3, 6, 5, 9, 7, 10 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14c, d14c, static_cast(0.125), 14), - static_cast(0.4431848049037056640776200482297774574883e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14c, d14c, static_cast(0.25), 14), - static_cast(0.3830343514018902583833597521450902906851e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14c, d14c, static_cast(0.75), 14), - static_cast(0.1657621200711495617835320787645038062003e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14c, d14c, static_cast(1.0f - 1.0f/64.0f), 14), - static_cast(0.1117985091800992684003226640313705018678e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14c, d14c, static_cast(6.5f), 14), - static_cast(0.3280672161259396135368350556553925507681e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14c, d14c, static_cast(10247.25f), 14), - static_cast(0.3000087891957249835881866421118445480875e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14c, d14c, static_cast(0.125)), - static_cast(0.4431848049037056640776200482297774574883e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14c, d14c, static_cast(0.25)), - static_cast(0.3830343514018902583833597521450902906851e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14c, d14c, static_cast(0.75)), - static_cast(0.1657621200711495617835320787645038062003e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14c, d14c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1117985091800992684003226640313705018678e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14c, d14c, static_cast(6.5f)), - static_cast(0.3280672161259396135368350556553925507681e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14c, d14c, static_cast(10247.25f)), - static_cast(0.3000087891957249835881866421118445480875e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14a, d14a, static_cast(0.125)), - static_cast(0.4431848049037056640776200482297774574883e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14a, d14a, static_cast(0.25)), - static_cast(0.3830343514018902583833597521450902906851e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14a, d14a, static_cast(0.75)), - static_cast(0.1657621200711495617835320787645038062003e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14a, d14a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1117985091800992684003226640313705018678e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14a, d14a, static_cast(6.5f)), - static_cast(0.3280672161259396135368350556553925507681e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n14a, d14a, static_cast(10247.25f)), - static_cast(0.3000087891957249835881866421118445480875e0L), - tolerance); - - // - // Polynomials of order 14 - // - static const U n15c[15] = { 6, 2, 10, 2, 4, 11, 4, 6, 5, 5, 10, 12, 8, 6, 2 }; - static const boost::array n15a = { 6, 2, 10, 2, 4, 11, 4, 6, 5, 5, 10, 12, 8, 6, 2 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15c, static_cast(0.125), 15), - static_cast(0.6411486971785507193999364972114562988281e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15c, static_cast(0.25), 15), - static_cast(0.7184068299829959869384765625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15c, static_cast(0.75), 15), - static_cast(0.21735079027712345123291015625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15c, static_cast(1.0f - 1.0f/64.0f), 15), - static_cast(0.8299984286646360949452954853655163780233e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15c, static_cast(6.5), 15), - static_cast(0.7599432765217742919921875e12L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15c, static_cast(0.125)), - static_cast(0.6411486971785507193999364972114562988281e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15c, static_cast(0.25)), - static_cast(0.7184068299829959869384765625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15c, static_cast(0.75)), - static_cast(0.21735079027712345123291015625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8299984286646360949452954853655163780233e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15c, static_cast(6.5)), - static_cast(0.7599432765217742919921875e12L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15a, static_cast(0.125)), - static_cast(0.6411486971785507193999364972114562988281e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15a, static_cast(0.25)), - static_cast(0.7184068299829959869384765625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15a, static_cast(0.75)), - static_cast(0.21735079027712345123291015625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8299984286646360949452954853655163780233e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n15a, static_cast(6.5)), - static_cast(0.7599432765217742919921875e12L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15c, static_cast(0.125), 15), - static_cast(0.603369928436724862526100235763586452224e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15c, static_cast(0.25), 15), - static_cast(0.6164622568840771005271861326946236658841e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15c, static_cast(0.75), 15), - static_cast(0.1204200081304656236302896843426424311474e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15c, static_cast(1.0f - 1.0f/64.0f), 15), - static_cast(0.7438435296991670658675730793779505088179e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15c, static_cast(6.5f), 15), - static_cast(0.123975649339443727300884144392229616642e24L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15c, static_cast(0.125)), - static_cast(0.603369928436724862526100235763586452224e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15c, static_cast(0.25)), - static_cast(0.6164622568840771005271861326946236658841e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15c, static_cast(0.75)), - static_cast(0.1204200081304656236302896843426424311474e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7438435296991670658675730793779505088179e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15c, static_cast(6.5f)), - static_cast(0.123975649339443727300884144392229616642e24L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15a, static_cast(0.125)), - static_cast(0.603369928436724862526100235763586452224e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15a, static_cast(0.25)), - static_cast(0.6164622568840771005271861326946236658841e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15a, static_cast(0.75)), - static_cast(0.1204200081304656236302896843426424311474e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7438435296991670658675730793779505088179e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n15a, static_cast(6.5f)), - static_cast(0.123975649339443727300884144392229616642e24L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(0.125), 15), - static_cast(0.6269594274937989002088018861086916177919e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(0.25), 15), - static_cast(0.6658490275363084021087445307784946635365e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(0.75), 15), - static_cast(0.1405600108406208315070529124568565748632e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(1.0f - 1.0f/64.0f), 15), - static_cast(0.7546981889007411462781694774633148026087e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(6.5f), 15), - static_cast(0.1907317682145288112321802221418917179108e23L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(0.125)), - static_cast(0.6269594274937989002088018861086916177919e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(0.25)), - static_cast(0.6658490275363084021087445307784946635365e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(0.75)), - static_cast(0.1405600108406208315070529124568565748632e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7546981889007411462781694774633148026087e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(6.5f)), - static_cast(0.1907317682145288112321802221418917179108e23L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15a, static_cast(0.125)), - static_cast(0.6269594274937989002088018861086916177919e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15a, static_cast(0.25)), - static_cast(0.6658490275363084021087445307784946635365e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15a, static_cast(0.75)), - static_cast(0.1405600108406208315070529124568565748632e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7546981889007411462781694774633148026087e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n15a, static_cast(6.5f)), - static_cast(0.1907317682145288112321802221418917179108e23L), - tolerance); - // - // Rational functions of order 14 - // - static const U d15c[15] = { 7, 10, 7, 1, 10, 11, 11, 10, 7, 1, 10, 9, 8, 2, 3 }; - static const boost::array d15a = { 7, 10, 7, 1, 10, 11, 11, 10, 7, 1, 10, 9, 8, 2, 3 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15c, d15c, static_cast(0.125), 15), - static_cast(0.7665435387801205084357966990293734431712e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15c, d15c, static_cast(0.25), 15), - static_cast(0.7179510450452743437979498898508621162489e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15c, d15c, static_cast(0.75), 15), - static_cast(0.7245051156202447814210400449367214490615e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15c, d15c, static_cast(1.0f - 1.0f/64.0f), 15), - static_cast(0.8564567127146107292325365412425895512358e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15c, d15c, static_cast(6.5f), 15), - static_cast(0.8943937154363365123476971638815814742919e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15c, d15c, static_cast(10247.25f), 15), - static_cast(0.6668184674989563469735607034881326982176e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15c, d15c, static_cast(0.125)), - static_cast(0.7665435387801205084357966990293734431712e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15c, d15c, static_cast(0.25)), - static_cast(0.7179510450452743437979498898508621162489e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15c, d15c, static_cast(0.75)), - static_cast(0.7245051156202447814210400449367214490615e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15c, d15c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8564567127146107292325365412425895512358e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15c, d15c, static_cast(6.5f)), - static_cast(0.8943937154363365123476971638815814742919e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15c, d15c, static_cast(10247.25f)), - static_cast(0.6668184674989563469735607034881326982176e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15a, d15a, static_cast(0.125)), - static_cast(0.7665435387801205084357966990293734431712e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15a, d15a, static_cast(0.25)), - static_cast(0.7179510450452743437979498898508621162489e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15a, d15a, static_cast(0.75)), - static_cast(0.7245051156202447814210400449367214490615e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15a, d15a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8564567127146107292325365412425895512358e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15a, d15a, static_cast(6.5f)), - static_cast(0.8943937154363365123476971638815814742919e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n15a, d15a, static_cast(10247.25f)), - static_cast(0.6668184674989563469735607034881326982176e0L), - tolerance); - - // - // Polynomials of order 15 - // - static const U n16c[16] = { 5, 3, 4, 6, 7, 9, 7, 6, 12, 12, 7, 12, 10, 3, 6, 2 }; - static const boost::array n16a = { 5, 3, 4, 6, 7, 9, 7, 6, 12, 12, 7, 12, 10, 3, 6, 2 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16c, static_cast(0.125), 16), - static_cast(0.545123276921327715172083117067813873291e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16c, static_cast(0.25), 16), - static_cast(0.613219709135591983795166015625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16c, static_cast(0.75), 16), - static_cast(0.2195364624075591564178466796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16c, static_cast(1.0f - 1.0f/64.0f), 16), - static_cast(0.9836568924934260045838041177111855604603e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16c, static_cast(6.5), 16), - static_cast(0.474557924297607818603515625e13L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16c, static_cast(0.125)), - static_cast(0.545123276921327715172083117067813873291e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16c, static_cast(0.25)), - static_cast(0.613219709135591983795166015625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16c, static_cast(0.75)), - static_cast(0.2195364624075591564178466796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.9836568924934260045838041177111855604603e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16c, static_cast(6.5)), - static_cast(0.474557924297607818603515625e13L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16a, static_cast(0.125)), - static_cast(0.545123276921327715172083117067813873291e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16a, static_cast(0.25)), - static_cast(0.613219709135591983795166015625e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16a, static_cast(0.75)), - static_cast(0.2195364624075591564178466796875e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.9836568924934260045838041177111855604603e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n16a, static_cast(6.5)), - static_cast(0.474557924297607818603515625e13L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16c, static_cast(0.125), 16), - static_cast(0.5047874876401281302859159688868887179229e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16c, static_cast(0.25), 16), - static_cast(0.5204705680902215943553490440365294489311e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16c, static_cast(0.75), 16), - static_cast(0.1080276729363941941482185615797106947866e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16c, static_cast(1.0f - 1.0f/64.0f), 16), - static_cast(0.8750139513999183433264859554731006794881e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16c, static_cast(6.5f), 16), - static_cast(0.5231073382834479254225049897383445873857e25L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16c, static_cast(0.125)), - static_cast(0.5047874876401281302859159688868887179229e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16c, static_cast(0.25)), - static_cast(0.5204705680902215943553490440365294489311e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16c, static_cast(0.75)), - static_cast(0.1080276729363941941482185615797106947866e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8750139513999183433264859554731006794881e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16c, static_cast(6.5f)), - static_cast(0.5231073382834479254225049897383445873857e25L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16a, static_cast(0.125)), - static_cast(0.5047874876401281302859159688868887179229e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16a, static_cast(0.25)), - static_cast(0.5204705680902215943553490440365294489311e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16a, static_cast(0.75)), - static_cast(0.1080276729363941941482185615797106947866e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8750139513999183433264859554731006794881e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n16a, static_cast(6.5f)), - static_cast(0.5231073382834479254225049897383445873857e25L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(0.125), 16), - static_cast(0.5382999011210250422873277510951097433836e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(0.25), 16), - static_cast(0.5818822723608863774213961761461177957244e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(0.75), 16), - static_cast(0.1273702305818589255309580821062809263822e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(1.0f - 1.0f/64.0f), 16), - static_cast(0.8881094109459487932205571611155308490038e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(6.5f), 16), - static_cast(0.8047805204360737314192426765205301344395e24L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(0.125)), - static_cast(0.5382999011210250422873277510951097433836e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(0.25)), - static_cast(0.5818822723608863774213961761461177957244e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(0.75)), - static_cast(0.1273702305818589255309580821062809263822e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8881094109459487932205571611155308490038e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(6.5f)), - static_cast(0.8047805204360737314192426765205301344395e24L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16a, static_cast(0.125)), - static_cast(0.5382999011210250422873277510951097433836e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16a, static_cast(0.25)), - static_cast(0.5818822723608863774213961761461177957244e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16a, static_cast(0.75)), - static_cast(0.1273702305818589255309580821062809263822e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8881094109459487932205571611155308490038e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n16a, static_cast(6.5f)), - static_cast(0.8047805204360737314192426765205301344395e24L), - tolerance); - // - // Rational functions of order 15 - // - static const U d16c[16] = { 9, 5, 2, 4, 4, 12, 11, 5, 1, 4, 1, 7, 9, 6, 6, 10 }; - static const boost::array d16a = { 9, 5, 2, 4, 4, 12, 11, 5, 1, 4, 1, 7, 9, 6, 6, 10 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16c, d16c, static_cast(0.125), 16), - static_cast(0.5639916333371058636233240074655101514789e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16c, d16c, static_cast(0.25), 16), - static_cast(0.5858114501425065583332351775671440891069e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16c, d16c, static_cast(0.75), 16), - static_cast(0.9254727283150680371198227978127749853934e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16c, d16c, static_cast(1.0f - 1.0f/64.0f), 16), - static_cast(0.1155192269792597191440811772688208898465e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16c, d16c, static_cast(6.5f), 16), - static_cast(0.2736469218296852258039959401695110274611e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16c, d16c, static_cast(10247.25f), 16), - static_cast(0.2000468408076577399196121638600795513365e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16c, d16c, static_cast(0.125)), - static_cast(0.5639916333371058636233240074655101514789e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16c, d16c, static_cast(0.25)), - static_cast(0.5858114501425065583332351775671440891069e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16c, d16c, static_cast(0.75)), - static_cast(0.9254727283150680371198227978127749853934e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16c, d16c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1155192269792597191440811772688208898465e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16c, d16c, static_cast(6.5f)), - static_cast(0.2736469218296852258039959401695110274611e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16c, d16c, static_cast(10247.25f)), - static_cast(0.2000468408076577399196121638600795513365e0L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16a, d16a, static_cast(0.125)), - static_cast(0.5639916333371058636233240074655101514789e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16a, d16a, static_cast(0.25)), - static_cast(0.5858114501425065583332351775671440891069e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16a, d16a, static_cast(0.75)), - static_cast(0.9254727283150680371198227978127749853934e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16a, d16a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.1155192269792597191440811772688208898465e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16a, d16a, static_cast(6.5f)), - static_cast(0.2736469218296852258039959401695110274611e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n16a, d16a, static_cast(10247.25f)), - static_cast(0.2000468408076577399196121638600795513365e0L), - tolerance); - - // - // Polynomials of order 16 - // - static const U n17c[17] = { 9, 6, 11, 2, 9, 10, 6, 3, 3, 3, 4, 9, 10, 2, 3, 2, 2 }; - static const boost::array n17a = { 9, 6, 11, 2, 9, 10, 6, 3, 3, 3, 4, 9, 10, 2, 3, 2, 2 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17c, static_cast(0.125), 17), - static_cast(0.9928308216189925872185995103791356086731e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17c, static_cast(0.25), 17), - static_cast(0.112653836444951593875885009765625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17c, static_cast(0.75), 17), - static_cast(0.288157429718412458896636962890625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17c, static_cast(1.0f - 1.0f/64.0f), 17), - static_cast(0.8499409476622319741012411965028222548509e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17c, static_cast(6.5), 17), - static_cast(0.24291309657542805938720703125e14L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17c, static_cast(0.125)), - static_cast(0.9928308216189925872185995103791356086731e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17c, static_cast(0.25)), - static_cast(0.112653836444951593875885009765625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17c, static_cast(0.75)), - static_cast(0.288157429718412458896636962890625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8499409476622319741012411965028222548509e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17c, static_cast(6.5)), - static_cast(0.24291309657542805938720703125e14L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17a, static_cast(0.125)), - static_cast(0.9928308216189925872185995103791356086731e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17a, static_cast(0.25)), - static_cast(0.112653836444951593875885009765625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17a, static_cast(0.75)), - static_cast(0.288157429718412458896636962890625e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8499409476622319741012411965028222548509e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n17a, static_cast(6.5)), - static_cast(0.24291309657542805938720703125e14L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17c, static_cast(0.125), 17), - static_cast(0.9096443722112564415334975111453014308977e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17c, static_cast(0.25), 17), - static_cast(0.9418604266644799371155545586464796770088e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17c, static_cast(0.75), 17), - static_cast(0.1800748238050061998856161277204890325265e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17c, static_cast(1.0f - 1.0f/64.0f), 17), - static_cast(0.7725414891276907880696219594586980069116e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17c, static_cast(6.5f), 17), - static_cast(0.2112416072820759278619692697965107844211e27L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17c, static_cast(0.125)), - static_cast(0.9096443722112564415334975111453014308977e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17c, static_cast(0.25)), - static_cast(0.9418604266644799371155545586464796770088e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17c, static_cast(0.75)), - static_cast(0.1800748238050061998856161277204890325265e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7725414891276907880696219594586980069116e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17c, static_cast(6.5f)), - static_cast(0.2112416072820759278619692697965107844211e27L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17a, static_cast(0.125)), - static_cast(0.9096443722112564415334975111453014308977e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17a, static_cast(0.25)), - static_cast(0.9418604266644799371155545586464796770088e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17a, static_cast(0.75)), - static_cast(0.1800748238050061998856161277204890325265e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7725414891276907880696219594586980069116e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n17a, static_cast(6.5f)), - static_cast(0.2112416072820759278619692697965107844211e27L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(0.125), 17), - static_cast(0.9771549776900515322679800891624114471814e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(0.25), 17), - static_cast(0.1067441706657919748462218234585918708035e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(0.75), 17), - static_cast(0.210099765073341599847488170293985376702e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(1.0f - 1.0f/64.0f), 17), - static_cast(0.7833754810186065148643778635770900387673e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(6.5f), 17), - static_cast(0.3249870881262706582491835681484781298786e26L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(0.125)), - static_cast(0.9771549776900515322679800891624114471814e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(0.25)), - static_cast(0.1067441706657919748462218234585918708035e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(0.75)), - static_cast(0.210099765073341599847488170293985376702e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7833754810186065148643778635770900387673e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(6.5f)), - static_cast(0.3249870881262706582491835681484781298786e26L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17a, static_cast(0.125)), - static_cast(0.9771549776900515322679800891624114471814e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17a, static_cast(0.25)), - static_cast(0.1067441706657919748462218234585918708035e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17a, static_cast(0.75)), - static_cast(0.210099765073341599847488170293985376702e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7833754810186065148643778635770900387673e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n17a, static_cast(6.5f)), - static_cast(0.3249870881262706582491835681484781298786e26L), - tolerance); - // - // Rational functions of order 16 - // - static const U d17c[17] = { 7, 12, 3, 11, 10, 2, 5, 10, 4, 11, 10, 6, 2, 12, 1, 2, 1 }; - static const boost::array d17a = { 7, 12, 3, 11, 10, 2, 5, 10, 4, 11, 10, 6, 2, 12, 1, 2, 1 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17c, d17c, static_cast(0.125), 17), - static_cast(0.1158375951946763080209403673166347533318e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17c, d17c, static_cast(0.25), 17), - static_cast(0.1082966720285644924561131930917359028989e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17c, d17c, static_cast(0.75), 17), - static_cast(0.9405394059495731884564238556014726773139e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17c, d17c, static_cast(1.0f - 1.0f/64.0f), 17), - static_cast(0.8654376623250381987950547557864849720673e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17c, d17c, static_cast(6.5f), 17), - static_cast(0.1737601600028386310221746538845672721834e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17c, d17c, static_cast(10247.25f), 17), - static_cast(0.1999804873273333726353229695741031917586e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17c, d17c, static_cast(0.125)), - static_cast(0.1158375951946763080209403673166347533318e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17c, d17c, static_cast(0.25)), - static_cast(0.1082966720285644924561131930917359028989e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17c, d17c, static_cast(0.75)), - static_cast(0.9405394059495731884564238556014726773139e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17c, d17c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8654376623250381987950547557864849720673e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17c, d17c, static_cast(6.5f)), - static_cast(0.1737601600028386310221746538845672721834e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17c, d17c, static_cast(10247.25f)), - static_cast(0.1999804873273333726353229695741031917586e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17a, d17a, static_cast(0.125)), - static_cast(0.1158375951946763080209403673166347533318e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17a, d17a, static_cast(0.25)), - static_cast(0.1082966720285644924561131930917359028989e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17a, d17a, static_cast(0.75)), - static_cast(0.9405394059495731884564238556014726773139e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17a, d17a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8654376623250381987950547557864849720673e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17a, d17a, static_cast(6.5f)), - static_cast(0.1737601600028386310221746538845672721834e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n17a, d17a, static_cast(10247.25f)), - static_cast(0.1999804873273333726353229695741031917586e1L), - tolerance); - - // - // Polynomials of order 17 - // - static const U n18c[18] = { 6, 5, 7, 8, 12, 9, 4, 1, 3, 5, 1, 5, 12, 8, 4, 6, 1, 10 }; - static const boost::array n18a = { 6, 5, 7, 8, 12, 9, 4, 1, 3, 5, 1, 5, 12, 8, 4, 6, 1, 10 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18c, static_cast(0.125), 18), - static_cast(0.6753220299099845114199069939786568284035e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18c, static_cast(0.25), 18), - static_cast(0.7869269511546008288860321044921875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18c, static_cast(0.75), 18), - static_cast(0.25590585466590709984302520751953125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18c, static_cast(1.0f - 1.0f/64.0f), 18), - static_cast(0.9432688198514753127308115619023015607828e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18c, static_cast(6.5), 18), - static_cast(0.680830157865510950897216796875e15L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18c, static_cast(0.125)), - static_cast(0.6753220299099845114199069939786568284035e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18c, static_cast(0.25)), - static_cast(0.7869269511546008288860321044921875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18c, static_cast(0.75)), - static_cast(0.25590585466590709984302520751953125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.9432688198514753127308115619023015607828e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18c, static_cast(6.5)), - static_cast(0.680830157865510950897216796875e15L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18a, static_cast(0.125)), - static_cast(0.6753220299099845114199069939786568284035e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18a, static_cast(0.25)), - static_cast(0.7869269511546008288860321044921875e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18a, static_cast(0.75)), - static_cast(0.25590585466590709984302520751953125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.9432688198514753127308115619023015607828e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n18a, static_cast(6.5)), - static_cast(0.680830157865510950897216796875e15L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18c, static_cast(0.125), 18), - static_cast(0.6079865225649211447450201991749585071453e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18c, static_cast(0.25), 18), - static_cast(0.6341988806453956744898332268528529098717e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18c, static_cast(0.75), 18), - static_cast(0.1439378129034890784564674906867431936064e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18c, static_cast(1.0f - 1.0f/64.0f), 18), - static_cast(0.8374908316692411299816073455081075151876e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18c, static_cast(6.5f), 18), - static_cast(0.4367459075155664096657376949959960997093e29L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18c, static_cast(0.125)), - static_cast(0.6079865225649211447450201991749585071453e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18c, static_cast(0.25)), - static_cast(0.6341988806453956744898332268528529098717e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18c, static_cast(0.75)), - static_cast(0.1439378129034890784564674906867431936064e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8374908316692411299816073455081075151876e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18c, static_cast(6.5f)), - static_cast(0.4367459075155664096657376949959960997093e29L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18a, static_cast(0.125)), - static_cast(0.6079865225649211447450201991749585071453e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18a, static_cast(0.25)), - static_cast(0.6341988806453956744898332268528529098717e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18a, static_cast(0.75)), - static_cast(0.1439378129034890784564674906867431936064e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8374908316692411299816073455081075151876e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n18a, static_cast(6.5f)), - static_cast(0.4367459075155664096657376949959960997093e29L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(0.125), 18), - static_cast(0.6638921805193691579601615933996680571626e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(0.25), 18), - static_cast(0.7367955225815826979593329074114116394867e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(0.75), 18), - static_cast(0.1719170838713187712752899875823242581419e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(1.0f - 1.0f/64.0f), 18), - static_cast(0.8498319559814513066479820652780774757461e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(6.5f), 18), - static_cast(0.6719167807931790917934426081938401533989e28L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(0.125)), - static_cast(0.6638921805193691579601615933996680571626e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(0.25)), - static_cast(0.7367955225815826979593329074114116394867e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(0.75)), - static_cast(0.1719170838713187712752899875823242581419e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8498319559814513066479820652780774757461e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(6.5f)), - static_cast(0.6719167807931790917934426081938401533989e28L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18a, static_cast(0.125)), - static_cast(0.6638921805193691579601615933996680571626e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18a, static_cast(0.25)), - static_cast(0.7367955225815826979593329074114116394867e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18a, static_cast(0.75)), - static_cast(0.1719170838713187712752899875823242581419e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8498319559814513066479820652780774757461e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n18a, static_cast(6.5f)), - static_cast(0.6719167807931790917934426081938401533989e28L), - tolerance); - // - // Rational functions of order 17 - // - static const U d18c[18] = { 6, 2, 11, 2, 12, 4, 1, 5, 7, 12, 5, 7, 5, 7, 5, 7, 2, 9 }; - static const boost::array d18a = { 6, 2, 11, 2, 12, 4, 1, 5, 7, 12, 5, 7, 5, 7, 5, 7, 2, 9 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18c, d18c, static_cast(0.125), 18), - static_cast(0.1050457095586493221315235501384188635425e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18c, d18c, static_cast(0.25), 18), - static_cast(0.1082394733850278225180153358339433604182e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18c, d18c, static_cast(0.75), 18), - static_cast(0.1117650157149023587583496399377426188558e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18c, d18c, static_cast(1.0f - 1.0f/64.0f), 18), - static_cast(0.9882013696252427983431096654690843223851e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18c, d18c, static_cast(6.5f), 18), - static_cast(0.1086348665080997883580887205673821889245e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18c, d18c, static_cast(10247.25f), 18), - static_cast(0.1111097856940394090609547290690047016487e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18c, d18c, static_cast(0.125)), - static_cast(0.1050457095586493221315235501384188635425e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18c, d18c, static_cast(0.25)), - static_cast(0.1082394733850278225180153358339433604182e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18c, d18c, static_cast(0.75)), - static_cast(0.1117650157149023587583496399377426188558e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18c, d18c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.9882013696252427983431096654690843223851e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18c, d18c, static_cast(6.5f)), - static_cast(0.1086348665080997883580887205673821889245e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18c, d18c, static_cast(10247.25f)), - static_cast(0.1111097856940394090609547290690047016487e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18a, d18a, static_cast(0.125)), - static_cast(0.1050457095586493221315235501384188635425e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18a, d18a, static_cast(0.25)), - static_cast(0.1082394733850278225180153358339433604182e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18a, d18a, static_cast(0.75)), - static_cast(0.1117650157149023587583496399377426188558e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18a, d18a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.9882013696252427983431096654690843223851e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18a, d18a, static_cast(6.5f)), - static_cast(0.1086348665080997883580887205673821889245e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n18a, d18a, static_cast(10247.25f)), - static_cast(0.1111097856940394090609547290690047016487e1L), - tolerance); - - // - // Polynomials of order 18 - // - static const U n19c[19] = { 7, 2, 4, 2, 4, 3, 9, 1, 9, 3, 7, 2, 10, 4, 2, 5, 11, 3, 9 }; - static const boost::array n19a = { 7, 2, 4, 2, 4, 3, 9, 1, 9, 3, 7, 2, 10, 4, 2, 5, 11, 3, 9 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19c, static_cast(0.125), 19), - static_cast(0.7317509740045990140888676478425622917712e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19c, static_cast(0.25), 19), - static_cast(0.7802219584656995721161365509033203125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19c, static_cast(0.75), 19), - static_cast(0.17609299321266007609665393829345703125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19c, static_cast(1.0f - 1.0f/64.0f), 19), - static_cast(0.8327888521934174049333133442289010778727e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19c, static_cast(6.5), 19), - static_cast(0.4179028813935817562572479248046875e16L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19c, static_cast(0.125)), - static_cast(0.7317509740045990140888676478425622917712e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19c, static_cast(0.25)), - static_cast(0.7802219584656995721161365509033203125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19c, static_cast(0.75)), - static_cast(0.17609299321266007609665393829345703125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8327888521934174049333133442289010778727e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19c, static_cast(6.5)), - static_cast(0.4179028813935817562572479248046875e16L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19a, static_cast(0.125)), - static_cast(0.7317509740045990140888676478425622917712e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19a, static_cast(0.25)), - static_cast(0.7802219584656995721161365509033203125e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19a, static_cast(0.75)), - static_cast(0.17609299321266007609665393829345703125e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8327888521934174049333133442289010778727e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_polynomial(n19a, static_cast(6.5)), - static_cast(0.4179028813935817562572479248046875e16L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19c, static_cast(0.125), 19), - static_cast(0.7032234433238304833197011488540991991734e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19c, static_cast(0.25), 19), - static_cast(0.7141177719741940632063571816842174888595e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19c, static_cast(0.75), 19), - static_cast(0.107671418972012709727788225142148040292e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19c, static_cast(1.0f - 1.0f/64.0f), 19), - static_cast(0.7205306905267900876445365429703520869133e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19c, static_cast(6.5f), 19), - static_cast(0.1670453627683043936397442394984734181614e31L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19c, static_cast(0.125)), - static_cast(0.7032234433238304833197011488540991991734e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19c, static_cast(0.25)), - static_cast(0.7141177719741940632063571816842174888595e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19c, static_cast(0.75)), - static_cast(0.107671418972012709727788225142148040292e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7205306905267900876445365429703520869133e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19c, static_cast(6.5f)), - static_cast(0.1670453627683043936397442394984734181614e31L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19a, static_cast(0.125)), - static_cast(0.7032234433238304833197011488540991991734e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19a, static_cast(0.25)), - static_cast(0.7141177719741940632063571816842174888595e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19a, static_cast(0.75)), - static_cast(0.107671418972012709727788225142148040292e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7205306905267900876445365429703520869133e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_even_polynomial(n19a, static_cast(6.5f)), - static_cast(0.1670453627683043936397442394984734181614e31L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(0.125), 19), - static_cast(0.7257875465906438665576091908327935933871e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(0.25), 19), - static_cast(0.7564710878967762528254287267368699554382e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(0.75), 19), - static_cast(0.120228558629350279637050966856197387056e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(1.0f - 1.0f/64.0f), 19), - static_cast(0.7308565745034058033214339484143259295627e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(6.5f), 19), - static_cast(0.2569928657973913748303757530804975664022e30L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(0.125)), - static_cast(0.7257875465906438665576091908327935933871e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(0.25)), - static_cast(0.7564710878967762528254287267368699554382e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(0.75)), - static_cast(0.120228558629350279637050966856197387056e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7308565745034058033214339484143259295627e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(6.5f)), - static_cast(0.2569928657973913748303757530804975664022e30L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19a, static_cast(0.125)), - static_cast(0.7257875465906438665576091908327935933871e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19a, static_cast(0.25)), - static_cast(0.7564710878967762528254287267368699554382e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19a, static_cast(0.75)), - static_cast(0.120228558629350279637050966856197387056e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.7308565745034058033214339484143259295627e2L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_odd_polynomial(n19a, static_cast(6.5f)), - static_cast(0.2569928657973913748303757530804975664022e30L), - tolerance); - // - // Rational functions of order 18 - // - static const U d19c[19] = { 3, 2, 3, 3, 10, 6, 2, 6, 9, 8, 8, 10, 5, 7, 6, 4, 6, 9, 7 }; - static const boost::array d19a = { 3, 2, 3, 3, 10, 6, 2, 6, 9, 8, 8, 10, 5, 7, 6, 4, 6, 9, 7 }; - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19c, d19c, static_cast(0.125), 19), - static_cast(0.2213824709533496994632324982010106870288e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19c, d19c, static_cast(0.25), 19), - static_cast(0.2063899260318829004588039751781791436716e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19c, d19c, static_cast(0.75), 19), - static_cast(0.1085337280046506127330919833145641152667e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19c, d19c, static_cast(1.0f - 1.0f/64.0f), 19), - static_cast(0.8530644127293554041631338796773621506306e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19c, d19c, static_cast(6.5f), 19), - static_cast(0.1140014406058131768268407547610620204626e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19c, d19c, static_cast(10247.25f), 19), - static_cast(0.1285594810697167354761598106316532892359e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19c, d19c, static_cast(0.125)), - static_cast(0.2213824709533496994632324982010106870288e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19c, d19c, static_cast(0.25)), - static_cast(0.2063899260318829004588039751781791436716e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19c, d19c, static_cast(0.75)), - static_cast(0.1085337280046506127330919833145641152667e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19c, d19c, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8530644127293554041631338796773621506306e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19c, d19c, static_cast(6.5f)), - static_cast(0.1140014406058131768268407547610620204626e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19c, d19c, static_cast(10247.25f)), - static_cast(0.1285594810697167354761598106316532892359e1L), - tolerance); - - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19a, d19a, static_cast(0.125)), - static_cast(0.2213824709533496994632324982010106870288e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19a, d19a, static_cast(0.25)), - static_cast(0.2063899260318829004588039751781791436716e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19a, d19a, static_cast(0.75)), - static_cast(0.1085337280046506127330919833145641152667e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19a, d19a, static_cast(1.0f - 1.0f/64.0f)), - static_cast(0.8530644127293554041631338796773621506306e0L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19a, d19a, static_cast(6.5f)), - static_cast(0.1140014406058131768268407547610620204626e1L), - tolerance); - BOOST_CHECK_CLOSE( - boost::math::tools::evaluate_rational(n19a, d19a, static_cast(10247.25f)), - static_cast(0.1285594810697167354761598106316532892359e1L), - tolerance); -} - -#endif + +#ifndef BOOST_MATH_TEST_RATIONAL_HPP +#define BOOST_MATH_TEST_RATIONAL_HPP + +#include + +template +void do_test_spots(T, U) +{ + // + // Tolerance is 4 eps expressed as a persentage: + // + T tolerance = boost::math::tools::epsilon() * 4 * 100; + + // + // Everything past this point is generated by the program + // ../tools/generate_rational_test.cpp + // + + // + // Polynomials of order 0 + // + static const U n1c[1] = { 2 }; + static const boost::array n1a = { 2 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1c, static_cast(0.125), 1), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1c, static_cast(0.25), 1), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1c, static_cast(0.75), 1), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1c, static_cast(1.0f - 1.0f/64.0f), 1), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1c, static_cast(6.5), 1), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1c, static_cast(10247.25), 1), + static_cast(0.2e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1c, static_cast(0.125)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1c, static_cast(0.25)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1c, static_cast(0.75)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1c, static_cast(6.5)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1c, static_cast(10247.25)), + static_cast(0.2e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1a, static_cast(0.125)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1a, static_cast(0.25)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1a, static_cast(0.75)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1a, static_cast(6.5)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n1a, static_cast(10247.25)), + static_cast(0.2e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1c, static_cast(0.125), 1), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1c, static_cast(0.25), 1), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1c, static_cast(0.75), 1), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1c, static_cast(1.0f - 1.0f/64.0f), 1), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1c, static_cast(6.5f), 1), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1c, static_cast(10247.25f), 1), + static_cast(0.2e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1c, static_cast(0.125)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1c, static_cast(0.25)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1c, static_cast(0.75)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1c, static_cast(6.5f)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1c, static_cast(10247.25f)), + static_cast(0.2e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1a, static_cast(0.125)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1a, static_cast(0.25)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1a, static_cast(0.75)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1a, static_cast(6.5f)), + static_cast(0.2e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n1a, static_cast(10247.25f)), + static_cast(0.2e1L), + tolerance); + + // + // Rational functions of order 0 + // + static const U d1c[1] = { 3 }; + static const boost::array d1a = { 3 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1c, d1c, static_cast(0.125), 1), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1c, d1c, static_cast(0.25), 1), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1c, d1c, static_cast(0.75), 1), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1c, d1c, static_cast(1.0f - 1.0f/64.0f), 1), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1c, d1c, static_cast(6.5f), 1), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1c, d1c, static_cast(10247.25f), 1), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1c, d1c, static_cast(0.125)), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1c, d1c, static_cast(0.25)), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1c, d1c, static_cast(0.75)), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1c, d1c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1c, d1c, static_cast(6.5f)), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1c, d1c, static_cast(10247.25f)), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1a, d1a, static_cast(0.125)), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1a, d1a, static_cast(0.25)), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1a, d1a, static_cast(0.75)), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1a, d1a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1a, d1a, static_cast(6.5f)), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n1a, d1a, static_cast(10247.25f)), + static_cast(0.6666666666666666666666666666666666666667e0L), + tolerance); + + // + // Polynomials of order 1 + // + static const U n2c[2] = { 3, 1 }; + static const boost::array n2a = { 3, 1 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2c, static_cast(0.125), 2), + static_cast(0.3125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2c, static_cast(0.25), 2), + static_cast(0.325e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2c, static_cast(0.75), 2), + static_cast(0.375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2c, static_cast(1.0f - 1.0f/64.0f), 2), + static_cast(0.3984375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2c, static_cast(6.5), 2), + static_cast(0.95e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2c, static_cast(10247.25), 2), + static_cast(0.1025025e5L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2c, static_cast(0.125)), + static_cast(0.3125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2c, static_cast(0.25)), + static_cast(0.325e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2c, static_cast(0.75)), + static_cast(0.375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.3984375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2c, static_cast(6.5)), + static_cast(0.95e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2c, static_cast(10247.25)), + static_cast(0.1025025e5L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2a, static_cast(0.125)), + static_cast(0.3125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2a, static_cast(0.25)), + static_cast(0.325e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2a, static_cast(0.75)), + static_cast(0.375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.3984375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2a, static_cast(6.5)), + static_cast(0.95e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n2a, static_cast(10247.25)), + static_cast(0.1025025e5L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2c, static_cast(0.125), 2), + static_cast(0.3015625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2c, static_cast(0.25), 2), + static_cast(0.30625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2c, static_cast(0.75), 2), + static_cast(0.35625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2c, static_cast(1.0f - 1.0f/64.0f), 2), + static_cast(0.3968994140625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2c, static_cast(6.5f), 2), + static_cast(0.4525e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2c, static_cast(10247.25f), 2), + static_cast(0.1050061355625e9L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2c, static_cast(0.125)), + static_cast(0.3015625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2c, static_cast(0.25)), + static_cast(0.30625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2c, static_cast(0.75)), + static_cast(0.35625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.3968994140625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2c, static_cast(6.5f)), + static_cast(0.4525e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2c, static_cast(10247.25f)), + static_cast(0.1050061355625e9L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2a, static_cast(0.125)), + static_cast(0.3015625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2a, static_cast(0.25)), + static_cast(0.30625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2a, static_cast(0.75)), + static_cast(0.35625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.3968994140625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2a, static_cast(6.5f)), + static_cast(0.4525e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n2a, static_cast(10247.25f)), + static_cast(0.1050061355625e9L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(0.125), 2), + static_cast(0.3125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(0.25), 2), + static_cast(0.325e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(0.75), 2), + static_cast(0.375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(1.0f - 1.0f/64.0f), 2), + static_cast(0.3984375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(6.5f), 2), + static_cast(0.95e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(10247.25f), 2), + static_cast(0.1025025e5L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(0.125)), + static_cast(0.3125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(0.25)), + static_cast(0.325e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(0.75)), + static_cast(0.375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.3984375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(6.5f)), + static_cast(0.95e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2c, static_cast(10247.25f)), + static_cast(0.1025025e5L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2a, static_cast(0.125)), + static_cast(0.3125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2a, static_cast(0.25)), + static_cast(0.325e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2a, static_cast(0.75)), + static_cast(0.375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.3984375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2a, static_cast(6.5f)), + static_cast(0.95e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n2a, static_cast(10247.25f)), + static_cast(0.1025025e5L), + tolerance); + + // + // Rational functions of order 1 + // + static const U d2c[2] = { 5, 9 }; + static const boost::array d2a = { 5, 9 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2c, d2c, static_cast(0.125), 2), + static_cast(0.5102040816326530612244897959183673469388e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2c, d2c, static_cast(0.25), 2), + static_cast(0.4482758620689655172413793103448275862069e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2c, d2c, static_cast(0.75), 2), + static_cast(0.3191489361702127659574468085106382978723e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2c, d2c, static_cast(1.0f - 1.0f/64.0f), 2), + static_cast(0.2874859075535512965050732807215332581736e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2c, d2c, static_cast(6.5f), 2), + static_cast(0.1496062992125984251968503937007874015748e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2c, d2c, static_cast(10247.25f), 2), + static_cast(0.1111376148281068304596377002122405609873e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2c, d2c, static_cast(0.125)), + static_cast(0.5102040816326530612244897959183673469388e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2c, d2c, static_cast(0.25)), + static_cast(0.4482758620689655172413793103448275862069e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2c, d2c, static_cast(0.75)), + static_cast(0.3191489361702127659574468085106382978723e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2c, d2c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.2874859075535512965050732807215332581736e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2c, d2c, static_cast(6.5f)), + static_cast(0.1496062992125984251968503937007874015748e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2c, d2c, static_cast(10247.25f)), + static_cast(0.1111376148281068304596377002122405609873e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2a, d2a, static_cast(0.125)), + static_cast(0.5102040816326530612244897959183673469388e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2a, d2a, static_cast(0.25)), + static_cast(0.4482758620689655172413793103448275862069e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2a, d2a, static_cast(0.75)), + static_cast(0.3191489361702127659574468085106382978723e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2a, d2a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.2874859075535512965050732807215332581736e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2a, d2a, static_cast(6.5f)), + static_cast(0.1496062992125984251968503937007874015748e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n2a, d2a, static_cast(10247.25f)), + static_cast(0.1111376148281068304596377002122405609873e0L), + tolerance); + + // + // Polynomials of order 2 + // + static const U n3c[3] = { 10, 6, 11 }; + static const boost::array n3a = { 10, 6, 11 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3c, static_cast(0.125), 3), + static_cast(0.10921875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3c, static_cast(0.25), 3), + static_cast(0.121875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3c, static_cast(0.75), 3), + static_cast(0.206875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3c, static_cast(1.0f - 1.0f/64.0f), 3), + static_cast(0.26565185546875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3c, static_cast(6.5), 3), + static_cast(0.51375e3L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3c, static_cast(10247.25), 3), + static_cast(0.11551289516875e10L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3c, static_cast(0.125)), + static_cast(0.10921875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3c, static_cast(0.25)), + static_cast(0.121875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3c, static_cast(0.75)), + static_cast(0.206875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.26565185546875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3c, static_cast(6.5)), + static_cast(0.51375e3L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3c, static_cast(10247.25)), + static_cast(0.11551289516875e10L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3a, static_cast(0.125)), + static_cast(0.10921875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3a, static_cast(0.25)), + static_cast(0.121875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3a, static_cast(0.75)), + static_cast(0.206875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.26565185546875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3a, static_cast(6.5)), + static_cast(0.51375e3L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n3a, static_cast(10247.25)), + static_cast(0.11551289516875e10L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3c, static_cast(0.125), 3), + static_cast(0.10096435546875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3c, static_cast(0.25), 3), + static_cast(0.1041796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3c, static_cast(0.75), 3), + static_cast(0.1685546875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3c, static_cast(1.0f - 1.0f/64.0f), 3), + static_cast(0.26142410933971405029296875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3c, static_cast(6.5f), 3), + static_cast(0.198991875e5L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3c, static_cast(10247.25f), 3), + static_cast(0.12128916726310335635546875e18L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3c, static_cast(0.125)), + static_cast(0.10096435546875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3c, static_cast(0.25)), + static_cast(0.1041796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3c, static_cast(0.75)), + static_cast(0.1685546875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.26142410933971405029296875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3c, static_cast(6.5f)), + static_cast(0.198991875e5L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3c, static_cast(10247.25f)), + static_cast(0.12128916726310335635546875e18L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3a, static_cast(0.125)), + static_cast(0.10096435546875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3a, static_cast(0.25)), + static_cast(0.1041796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3a, static_cast(0.75)), + static_cast(0.1685546875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.26142410933971405029296875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3a, static_cast(6.5f)), + static_cast(0.198991875e5L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n3a, static_cast(10247.25f)), + static_cast(0.12128916726310335635546875e18L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(0.125), 3), + static_cast(0.10771484375e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(0.25), 3), + static_cast(0.11671875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(0.75), 3), + static_cast(0.19140625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(1.0f - 1.0f/64.0f), 3), + static_cast(0.26398639678955078125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(6.5f), 3), + static_cast(0.3069875e4L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(10247.25f), 3), + static_cast(0.11836265072405359375e14L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(0.125)), + static_cast(0.10771484375e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(0.25)), + static_cast(0.11671875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(0.75)), + static_cast(0.19140625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.26398639678955078125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(6.5f)), + static_cast(0.3069875e4L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3c, static_cast(10247.25f)), + static_cast(0.11836265072405359375e14L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3a, static_cast(0.125)), + static_cast(0.10771484375e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3a, static_cast(0.25)), + static_cast(0.11671875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3a, static_cast(0.75)), + static_cast(0.19140625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.26398639678955078125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3a, static_cast(6.5f)), + static_cast(0.3069875e4L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n3a, static_cast(10247.25f)), + static_cast(0.11836265072405359375e14L), + tolerance); + + // + // Rational functions of order 2 + // + static const U d3c[3] = { 3, 4, 10 }; + static const boost::array d3a = { 3, 4, 10 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3c, d3c, static_cast(0.125), 3), + static_cast(0.2987179487179487179487179487179487179487e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3c, d3c, static_cast(0.25), 3), + static_cast(0.2635135135135135135135135135135135135135e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3c, d3c, static_cast(0.75), 3), + static_cast(0.1779569892473118279569892473118279569892e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3c, d3c, static_cast(1.0f - 1.0f/64.0f), 3), + static_cast(0.1597671277126831703520981998649164537633e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3c, d3c, static_cast(6.5f), 3), + static_cast(0.1137873754152823920265780730897009966777e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3c, d3c, static_cast(10247.25f), 3), + static_cast(0.1100015619716026431429617996316152069115e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3c, d3c, static_cast(0.125)), + static_cast(0.2987179487179487179487179487179487179487e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3c, d3c, static_cast(0.25)), + static_cast(0.2635135135135135135135135135135135135135e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3c, d3c, static_cast(0.75)), + static_cast(0.1779569892473118279569892473118279569892e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3c, d3c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1597671277126831703520981998649164537633e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3c, d3c, static_cast(6.5f)), + static_cast(0.1137873754152823920265780730897009966777e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3c, d3c, static_cast(10247.25f)), + static_cast(0.1100015619716026431429617996316152069115e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3a, d3a, static_cast(0.125)), + static_cast(0.2987179487179487179487179487179487179487e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3a, d3a, static_cast(0.25)), + static_cast(0.2635135135135135135135135135135135135135e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3a, d3a, static_cast(0.75)), + static_cast(0.1779569892473118279569892473118279569892e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3a, d3a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1597671277126831703520981998649164537633e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3a, d3a, static_cast(6.5f)), + static_cast(0.1137873754152823920265780730897009966777e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n3a, d3a, static_cast(10247.25f)), + static_cast(0.1100015619716026431429617996316152069115e1L), + tolerance); + + // + // Polynomials of order 3 + // + static const U n4c[4] = { 1, 4, 9, 11 }; + static const boost::array n4a = { 1, 4, 9, 11 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4c, static_cast(0.125), 4), + static_cast(0.1662109375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4c, static_cast(0.25), 4), + static_cast(0.2734375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4c, static_cast(0.75), 4), + static_cast(0.13703125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4c, static_cast(1.0f - 1.0f/64.0f), 4), + static_cast(0.24150836944580078125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4c, static_cast(6.5), 4), + static_cast(0.3428125e4L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4c, static_cast(10247.25), 4), + static_cast(0.11837210107094921875e14L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4c, static_cast(0.125)), + static_cast(0.1662109375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4c, static_cast(0.25)), + static_cast(0.2734375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4c, static_cast(0.75)), + static_cast(0.13703125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.24150836944580078125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4c, static_cast(6.5)), + static_cast(0.3428125e4L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4c, static_cast(10247.25)), + static_cast(0.11837210107094921875e14L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4a, static_cast(0.125)), + static_cast(0.1662109375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4a, static_cast(0.25)), + static_cast(0.2734375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4a, static_cast(0.75)), + static_cast(0.13703125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.24150836944580078125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4a, static_cast(6.5)), + static_cast(0.3428125e4L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n4a, static_cast(10247.25)), + static_cast(0.11837210107094921875e14L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4c, static_cast(0.125), 4), + static_cast(0.1064739227294921875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4c, static_cast(0.25), 4), + static_cast(0.1287841796875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4c, static_cast(0.75), 4), + static_cast(0.8055419921875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4c, static_cast(1.0f - 1.0f/64.0f), 4), + static_cast(0.23334727106775972060859203338623046875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4c, static_cast(6.5f), 4), + static_cast(0.845843359375e6L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4c, static_cast(10247.25f), 4), + static_cast(0.12736106409103529349764202508544921875e26L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4c, static_cast(0.125)), + static_cast(0.1064739227294921875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4c, static_cast(0.25)), + static_cast(0.1287841796875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4c, static_cast(0.75)), + static_cast(0.8055419921875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.23334727106775972060859203338623046875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4c, static_cast(6.5f)), + static_cast(0.845843359375e6L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4c, static_cast(10247.25f)), + static_cast(0.12736106409103529349764202508544921875e26L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4a, static_cast(0.125)), + static_cast(0.1064739227294921875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4a, static_cast(0.25)), + static_cast(0.1287841796875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4a, static_cast(0.75)), + static_cast(0.8055419921875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.23334727106775972060859203338623046875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4a, static_cast(6.5f)), + static_cast(0.845843359375e6L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n4a, static_cast(10247.25f)), + static_cast(0.12736106409103529349764202508544921875e26L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(0.125), 4), + static_cast(0.1517913818359375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(0.25), 4), + static_cast(0.21513671875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(0.75), 4), + static_cast(0.104072265625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(1.0f - 1.0f/64.0f), 4), + static_cast(0.23689246584661304950714111328125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(6.5f), 4), + static_cast(0.13013059375e6L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(10247.25f), 4), + static_cast(0.12428804224649080826343115234375e22L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(0.125)), + static_cast(0.1517913818359375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(0.25)), + static_cast(0.21513671875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(0.75)), + static_cast(0.104072265625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.23689246584661304950714111328125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(6.5f)), + static_cast(0.13013059375e6L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4c, static_cast(10247.25f)), + static_cast(0.12428804224649080826343115234375e22L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4a, static_cast(0.125)), + static_cast(0.1517913818359375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4a, static_cast(0.25)), + static_cast(0.21513671875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4a, static_cast(0.75)), + static_cast(0.104072265625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.23689246584661304950714111328125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4a, static_cast(6.5f)), + static_cast(0.13013059375e6L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n4a, static_cast(10247.25f)), + static_cast(0.12428804224649080826343115234375e22L), + tolerance); + + // + // Rational functions of order 3 + // + static const U d4c[4] = { 10, 2, 5, 4 }; + static const boost::array d4a = { 10, 2, 5, 4 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4c, d4c, static_cast(0.125), 4), + static_cast(0.1608087679516250944822373393801965230537e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4c, d4c, static_cast(0.25), 4), + static_cast(0.2514367816091954022988505747126436781609e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4c, d4c, static_cast(0.75), 4), + static_cast(0.8564453125e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4c, d4c, static_cast(1.0f - 1.0f/64.0f), 4), + static_cast(0.1170714951947222939292918160495461743806e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4c, d4c, static_cast(6.5f), 4), + static_cast(0.2572219095854436315888201087975989495404e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4c, d4c, static_cast(10247.25f), 4), + static_cast(0.2749884125808399380227005558292823797886e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4c, d4c, static_cast(0.125)), + static_cast(0.1608087679516250944822373393801965230537e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4c, d4c, static_cast(0.25)), + static_cast(0.2514367816091954022988505747126436781609e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4c, d4c, static_cast(0.75)), + static_cast(0.8564453125e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4c, d4c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1170714951947222939292918160495461743806e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4c, d4c, static_cast(6.5f)), + static_cast(0.2572219095854436315888201087975989495404e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4c, d4c, static_cast(10247.25f)), + static_cast(0.2749884125808399380227005558292823797886e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4a, d4a, static_cast(0.125)), + static_cast(0.1608087679516250944822373393801965230537e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4a, d4a, static_cast(0.25)), + static_cast(0.2514367816091954022988505747126436781609e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4a, d4a, static_cast(0.75)), + static_cast(0.8564453125e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4a, d4a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1170714951947222939292918160495461743806e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4a, d4a, static_cast(6.5f)), + static_cast(0.2572219095854436315888201087975989495404e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n4a, d4a, static_cast(10247.25f)), + static_cast(0.2749884125808399380227005558292823797886e1L), + tolerance); + + // + // Polynomials of order 4 + // + static const U n5c[5] = { 10, 10, 4, 11, 9 }; + static const boost::array n5a = { 10, 10, 4, 11, 9 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5c, static_cast(0.125), 5), + static_cast(0.11336181640625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5c, static_cast(0.25), 5), + static_cast(0.1295703125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5c, static_cast(0.75), 5), + static_cast(0.2723828125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5c, static_cast(1.0f - 1.0f/64.0f), 5), + static_cast(0.42662663042545318603515625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5c, static_cast(6.5), 5), + static_cast(0.193304375e5L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5c, static_cast(10247.25), 5), + static_cast(0.9924842756673782995703125e17L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5c, static_cast(0.125)), + static_cast(0.11336181640625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5c, static_cast(0.25)), + static_cast(0.1295703125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5c, static_cast(0.75)), + static_cast(0.2723828125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.42662663042545318603515625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5c, static_cast(6.5)), + static_cast(0.193304375e5L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5c, static_cast(10247.25)), + static_cast(0.9924842756673782995703125e17L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5a, static_cast(0.125)), + static_cast(0.11336181640625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5a, static_cast(0.25)), + static_cast(0.1295703125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5a, static_cast(0.75)), + static_cast(0.2723828125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.42662663042545318603515625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5a, static_cast(6.5)), + static_cast(0.193304375e5L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n5a, static_cast(10247.25)), + static_cast(0.9924842756673782995703125e17L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5c, static_cast(0.125), 5), + static_cast(0.10157269060611724853515625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5c, static_cast(0.25), 5), + static_cast(0.106434478759765625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5c, static_cast(0.75), 5), + static_cast(0.197494049072265625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5c, static_cast(1.0f - 1.0f/64.0f), 5), + static_cast(0.4138858164296656028113829961512237787247e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5c, static_cast(6.5f), 5), + static_cast(0.2951521370703125e8L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5c, static_cast(10247.25f), 5), + static_cast(0.1094211231602999407223950000397888253311e34L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5c, static_cast(0.125)), + static_cast(0.10157269060611724853515625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5c, static_cast(0.25)), + static_cast(0.106434478759765625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5c, static_cast(0.75)), + static_cast(0.197494049072265625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4138858164296656028113829961512237787247e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5c, static_cast(6.5f)), + static_cast(0.2951521370703125e8L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5c, static_cast(10247.25f)), + static_cast(0.1094211231602999407223950000397888253311e34L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5a, static_cast(0.125)), + static_cast(0.10157269060611724853515625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5a, static_cast(0.25)), + static_cast(0.106434478759765625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5a, static_cast(0.75)), + static_cast(0.197494049072265625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4138858164296656028113829961512237787247e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5a, static_cast(6.5f)), + static_cast(0.2951521370703125e8L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n5a, static_cast(10247.25f)), + static_cast(0.1094211231602999407223950000397888253311e34L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(0.125), 5), + static_cast(0.11258152484893798828125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(0.25), 5), + static_cast(0.1257379150390625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(0.75), 5), + static_cast(0.2299920654296875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(1.0f - 1.0f/64.0f), 5), + static_cast(0.4188681309761682314274366945028305053711e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(6.5f), 5), + static_cast(0.45408105703125e7L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(10247.25f), 5), + static_cast(0.106780963829612765105169679718983215332e30L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(0.125)), + static_cast(0.11258152484893798828125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(0.25)), + static_cast(0.1257379150390625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(0.75)), + static_cast(0.2299920654296875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4188681309761682314274366945028305053711e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(6.5f)), + static_cast(0.45408105703125e7L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5c, static_cast(10247.25f)), + static_cast(0.106780963829612765105169679718983215332e30L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5a, static_cast(0.125)), + static_cast(0.11258152484893798828125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5a, static_cast(0.25)), + static_cast(0.1257379150390625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5a, static_cast(0.75)), + static_cast(0.2299920654296875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4188681309761682314274366945028305053711e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5a, static_cast(6.5f)), + static_cast(0.45408105703125e7L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n5a, static_cast(10247.25f)), + static_cast(0.106780963829612765105169679718983215332e30L), + tolerance); + + // + // Rational functions of order 4 + // + static const U d5c[5] = { 6, 9, 6, 2, 5 }; + static const boost::array d5a = { 6, 9, 6, 2, 5 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5c, d5c, static_cast(0.125), 5), + static_cast(0.1569265605461489066882963263374902835513e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5c, d5c, static_cast(0.25), 5), + static_cast(0.1493471409275101305718144979738856371004e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5c, d5c, static_cast(0.75), 5), + static_cast(0.1468309117708991366603495472731101284481e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5c, d5c, static_cast(1.0f - 1.0f/64.0f), 5), + static_cast(0.1564121691159921277310988862398683772017e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5c, d5c, static_cast(6.5f), 5), + static_cast(0.1973991741181125982091000185089449263153e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5c, d5c, static_cast(10247.25f), 5), + static_cast(0.1800144410401676792233921448870747965702e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5c, d5c, static_cast(0.125)), + static_cast(0.1569265605461489066882963263374902835513e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5c, d5c, static_cast(0.25)), + static_cast(0.1493471409275101305718144979738856371004e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5c, d5c, static_cast(0.75)), + static_cast(0.1468309117708991366603495472731101284481e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5c, d5c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1564121691159921277310988862398683772017e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5c, d5c, static_cast(6.5f)), + static_cast(0.1973991741181125982091000185089449263153e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5c, d5c, static_cast(10247.25f)), + static_cast(0.1800144410401676792233921448870747965702e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5a, d5a, static_cast(0.125)), + static_cast(0.1569265605461489066882963263374902835513e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5a, d5a, static_cast(0.25)), + static_cast(0.1493471409275101305718144979738856371004e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5a, d5a, static_cast(0.75)), + static_cast(0.1468309117708991366603495472731101284481e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5a, d5a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1564121691159921277310988862398683772017e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5a, d5a, static_cast(6.5f)), + static_cast(0.1973991741181125982091000185089449263153e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n5a, d5a, static_cast(10247.25f)), + static_cast(0.1800144410401676792233921448870747965702e1L), + tolerance); + + // + // Polynomials of order 5 + // + static const U n6c[6] = { 6, 8, 12, 5, 7, 5 }; + static const boost::array n6a = { 6, 8, 12, 5, 7, 5 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6c, static_cast(0.125), 6), + static_cast(0.7199127197265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6c, static_cast(0.25), 6), + static_cast(0.88603515625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6c, static_cast(0.75), 6), + static_cast(0.242607421875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6c, static_cast(1.0f - 1.0f/64.0f), 6), + static_cast(0.41466238017193973064422607421875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6c, static_cast(6.5), 6), + static_cast(0.7244809375e5L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6c, static_cast(10247.25), 6), + static_cast(0.5650228315695522094919501953125e21L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6c, static_cast(0.125)), + static_cast(0.7199127197265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6c, static_cast(0.25)), + static_cast(0.88603515625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6c, static_cast(0.75)), + static_cast(0.242607421875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.41466238017193973064422607421875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6c, static_cast(6.5)), + static_cast(0.7244809375e5L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6c, static_cast(10247.25)), + static_cast(0.5650228315695522094919501953125e21L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6a, static_cast(0.125)), + static_cast(0.7199127197265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6a, static_cast(0.25)), + static_cast(0.88603515625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6a, static_cast(0.75)), + static_cast(0.242607421875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.41466238017193973064422607421875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6a, static_cast(6.5)), + static_cast(0.7244809375e5L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n6a, static_cast(10247.25)), + static_cast(0.5650228315695522094919501953125e21L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6c, static_cast(0.125), 6), + static_cast(0.6127949182875454425811767578125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6c, static_cast(0.25), 6), + static_cast(0.654820728302001953125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6c, static_cast(0.75), 6), + static_cast(0.1616912555694580078125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6c, static_cast(1.0f - 1.0f/64.0f), 6), + static_cast(0.4001137167344577683526091194110563264985e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6c, static_cast(6.5f), 6), + static_cast(0.6958411633369140625e9L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6c, static_cast(0.125)), + static_cast(0.6127949182875454425811767578125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6c, static_cast(0.25)), + static_cast(0.654820728302001953125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6c, static_cast(0.75)), + static_cast(0.1616912555694580078125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4001137167344577683526091194110563264985e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6c, static_cast(6.5f)), + static_cast(0.6958411633369140625e9L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6a, static_cast(0.125)), + static_cast(0.6127949182875454425811767578125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6a, static_cast(0.25)), + static_cast(0.654820728302001953125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6a, static_cast(0.75)), + static_cast(0.1616912555694580078125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4001137167344577683526091194110563264985e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n6a, static_cast(6.5f)), + static_cast(0.6958411633369140625e9L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(0.125), 6), + static_cast(0.7023593463003635406494140625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(0.25), 6), + static_cast(0.8192829132080078125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(0.75), 6), + static_cast(0.19558834075927734375e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(1.0f - 1.0f/64.0f), 6), + static_cast(0.4055123471588142408661425974969461094588e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(6.5f), 6), + static_cast(0.107052491744140625e9L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(10247.25f), 6), + static_cast(0.6229253367792843599034768117351560896265e37L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(0.125)), + static_cast(0.7023593463003635406494140625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(0.25)), + static_cast(0.8192829132080078125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(0.75)), + static_cast(0.19558834075927734375e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4055123471588142408661425974969461094588e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(6.5f)), + static_cast(0.107052491744140625e9L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6c, static_cast(10247.25f)), + static_cast(0.6229253367792843599034768117351560896265e37L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6a, static_cast(0.125)), + static_cast(0.7023593463003635406494140625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6a, static_cast(0.25)), + static_cast(0.8192829132080078125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6a, static_cast(0.75)), + static_cast(0.19558834075927734375e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4055123471588142408661425974969461094588e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6a, static_cast(6.5f)), + static_cast(0.107052491744140625e9L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n6a, static_cast(10247.25f)), + static_cast(0.6229253367792843599034768117351560896265e37L), + tolerance); + + // + // Rational functions of order 5 + // + static const U d6c[6] = { 5, 11, 7, 12, 10, 5 }; + static const boost::array d6a = { 5, 11, 7, 12, 10, 5 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6c, d6c, static_cast(0.125), 6), + static_cast(0.1105787665293227020667219792530925829572e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6c, d6c, static_cast(0.25), 6), + static_cast(0.1052430112515949425820670455863588910799e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6c, d6c, static_cast(0.75), 6), + static_cast(0.9120378868534087154447666948125848966555e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6c, d6c, static_cast(1.0f - 1.0f/64.0f), 6), + static_cast(0.8626539746676637108178973543021882567334e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6c, d6c, static_cast(6.5f), 6), + static_cast(0.9109197333022141385660730837432462113756e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6c, d6c, static_cast(10247.25f), 6), + static_cast(0.9999414458034701919327379302959430043671e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6c, d6c, static_cast(0.125)), + static_cast(0.1105787665293227020667219792530925829572e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6c, d6c, static_cast(0.25)), + static_cast(0.1052430112515949425820670455863588910799e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6c, d6c, static_cast(0.75)), + static_cast(0.9120378868534087154447666948125848966555e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6c, d6c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8626539746676637108178973543021882567334e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6c, d6c, static_cast(6.5f)), + static_cast(0.9109197333022141385660730837432462113756e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6c, d6c, static_cast(10247.25f)), + static_cast(0.9999414458034701919327379302959430043671e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6a, d6a, static_cast(0.125)), + static_cast(0.1105787665293227020667219792530925829572e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6a, d6a, static_cast(0.25)), + static_cast(0.1052430112515949425820670455863588910799e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6a, d6a, static_cast(0.75)), + static_cast(0.9120378868534087154447666948125848966555e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6a, d6a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8626539746676637108178973543021882567334e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6a, d6a, static_cast(6.5f)), + static_cast(0.9109197333022141385660730837432462113756e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n6a, d6a, static_cast(10247.25f)), + static_cast(0.9999414458034701919327379302959430043671e0L), + tolerance); + + // + // Polynomials of order 6 + // + static const U n7c[7] = { 3, 4, 11, 5, 10, 7, 9 }; + static const boost::array n7a = { 3, 4, 11, 5, 10, 7, 9 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7c, static_cast(0.125), 7), + static_cast(0.3684329986572265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7c, static_cast(0.25), 7), + static_cast(0.4813720703125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7c, static_cast(0.75), 7), + static_cast(0.20723876953125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7c, static_cast(1.0f - 1.0f/64.0f), 7), + static_cast(0.46413680258337990380823612213134765625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7c, static_cast(6.5), 7), + static_cast(0.779707859375e6L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7c, static_cast(10247.25), 7), + static_cast(0.10421241651331160693970241510986328125e26L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7c, static_cast(0.125)), + static_cast(0.3684329986572265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7c, static_cast(0.25)), + static_cast(0.4813720703125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7c, static_cast(0.75)), + static_cast(0.20723876953125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.46413680258337990380823612213134765625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7c, static_cast(6.5)), + static_cast(0.779707859375e6L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7c, static_cast(10247.25)), + static_cast(0.10421241651331160693970241510986328125e26L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7a, static_cast(0.125)), + static_cast(0.3684329986572265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7a, static_cast(0.25)), + static_cast(0.4813720703125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7a, static_cast(0.75)), + static_cast(0.20723876953125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.46413680258337990380823612213134765625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7a, static_cast(6.5)), + static_cast(0.779707859375e6L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n7a, static_cast(10247.25)), + static_cast(0.10421241651331160693970241510986328125e26L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7c, static_cast(0.125), 7), + static_cast(0.3065205223058001138269901275634765625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7c, static_cast(0.25), 7), + static_cast(0.3294349253177642822265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7c, static_cast(0.75), 7), + static_cast(0.11300772249698638916015625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7c, static_cast(1.0f - 1.0f/64.0f), 7), + static_cast(0.4400013192129567626077980251194602528964e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7c, static_cast(6.5f), 7), + static_cast(0.52166734985505126953125e11L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7c, static_cast(0.125)), + static_cast(0.3065205223058001138269901275634765625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7c, static_cast(0.25)), + static_cast(0.3294349253177642822265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7c, static_cast(0.75)), + static_cast(0.11300772249698638916015625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4400013192129567626077980251194602528964e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7c, static_cast(6.5f)), + static_cast(0.52166734985505126953125e11L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7a, static_cast(0.125)), + static_cast(0.3065205223058001138269901275634765625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7a, static_cast(0.25)), + static_cast(0.3294349253177642822265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7a, static_cast(0.75)), + static_cast(0.11300772249698638916015625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4400013192129567626077980251194602528964e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n7a, static_cast(6.5f)), + static_cast(0.52166734985505126953125e11L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(0.125), 7), + static_cast(0.3521641784464009106159210205078125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(0.25), 7), + static_cast(0.41773970127105712890625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(0.75), 7), + static_cast(0.140676963329315185546875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(1.0f - 1.0f/64.0f), 7), + static_cast(0.4465092766607814731253821207562770823074e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(6.5f), 7), + static_cast(0.802565153877001953125e10L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(0.125)), + static_cast(0.3521641784464009106159210205078125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(0.25)), + static_cast(0.41773970127105712890625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(0.75)), + static_cast(0.140676963329315185546875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4465092766607814731253821207562770823074e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7c, static_cast(6.5f)), + static_cast(0.802565153877001953125e10L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7a, static_cast(0.125)), + static_cast(0.3521641784464009106159210205078125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7a, static_cast(0.25)), + static_cast(0.41773970127105712890625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7a, static_cast(0.75)), + static_cast(0.140676963329315185546875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4465092766607814731253821207562770823074e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n7a, static_cast(6.5f)), + static_cast(0.802565153877001953125e10L), + tolerance); + // + // Rational functions of order 6 + // + static const U d7c[7] = { 2, 8, 10, 8, 1, 11, 1 }; + static const boost::array d7a = { 2, 8, 10, 8, 1, 11, 1 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7c, d7c, static_cast(0.125), 7), + static_cast(0.1161348466465698540596242849979738853664e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7c, d7c, static_cast(0.25), 7), + static_cast(0.1010247476558897371522262642824204539632e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7c, d7c, static_cast(0.75), 7), + static_cast(0.103079575951134804308491906398377636644e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7c, d7c, static_cast(1.0f - 1.0f/64.0f), 7), + static_cast(0.1183671559390403425417413542214181025989e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7c, d7c, static_cast(6.5f), 7), + static_cast(0.3757457624476840396478985178609736319955e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7c, d7c, static_cast(10247.25f), 7), + static_cast(0.8991031618241406513349732955332873069556e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7c, d7c, static_cast(0.125)), + static_cast(0.1161348466465698540596242849979738853664e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7c, d7c, static_cast(0.25)), + static_cast(0.1010247476558897371522262642824204539632e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7c, d7c, static_cast(0.75)), + static_cast(0.103079575951134804308491906398377636644e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7c, d7c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1183671559390403425417413542214181025989e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7c, d7c, static_cast(6.5f)), + static_cast(0.3757457624476840396478985178609736319955e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7c, d7c, static_cast(10247.25f)), + static_cast(0.8991031618241406513349732955332873069556e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7a, d7a, static_cast(0.125)), + static_cast(0.1161348466465698540596242849979738853664e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7a, d7a, static_cast(0.25)), + static_cast(0.1010247476558897371522262642824204539632e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7a, d7a, static_cast(0.75)), + static_cast(0.103079575951134804308491906398377636644e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7a, d7a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1183671559390403425417413542214181025989e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7a, d7a, static_cast(6.5f)), + static_cast(0.3757457624476840396478985178609736319955e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n7a, d7a, static_cast(10247.25f)), + static_cast(0.8991031618241406513349732955332873069556e1L), + tolerance); + + // + // Polynomials of order 7 + // + static const U n8c[8] = { 9, 5, 6, 1, 12, 2, 11, 1 }; + static const boost::array n8a = { 9, 5, 6, 1, 12, 2, 11, 1 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8c, static_cast(0.125), 8), + static_cast(0.9723736286163330078125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8c, static_cast(0.25), 8), + static_cast(0.1069219970703125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8c, static_cast(0.75), 8), + static_cast(0.2290960693359375e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8c, static_cast(1.0f - 1.0f/64.0f), 8), + static_cast(0.4470947054706607559637632220983505249023e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8c, static_cast(6.5), 8), + static_cast(0.13650267734375e7L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8c, static_cast(10247.25), 8), + static_cast(0.1187728773094625678513681460864459228516e29L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8c, static_cast(0.125)), + static_cast(0.9723736286163330078125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8c, static_cast(0.25)), + static_cast(0.1069219970703125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8c, static_cast(0.75)), + static_cast(0.2290960693359375e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4470947054706607559637632220983505249023e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8c, static_cast(6.5)), + static_cast(0.13650267734375e7L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8c, static_cast(10247.25)), + static_cast(0.1187728773094625678513681460864459228516e29L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8a, static_cast(0.125)), + static_cast(0.9723736286163330078125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8a, static_cast(0.25)), + static_cast(0.1069219970703125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8a, static_cast(0.75)), + static_cast(0.2290960693359375e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4470947054706607559637632220983505249023e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8a, static_cast(6.5)), + static_cast(0.13650267734375e7L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n8a, static_cast(10247.25)), + static_cast(0.1187728773094625678513681460864459228516e29L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8c, static_cast(0.125), 8), + static_cast(0.9079594375725946520105935633182525634766e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8c, static_cast(0.25), 8), + static_cast(0.93363673128187656402587890625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8c, static_cast(0.75), 8), + static_cast(0.155691558457911014556884765625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8c, static_cast(1.0f - 1.0f/64.0f), 8), + static_cast(0.4258457138999176910226338119632657870077e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8c, static_cast(6.5f), 8), + static_cast(0.30319406120433428955078125e12L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8c, static_cast(0.125)), + static_cast(0.9079594375725946520105935633182525634766e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8c, static_cast(0.25)), + static_cast(0.93363673128187656402587890625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8c, static_cast(0.75)), + static_cast(0.155691558457911014556884765625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4258457138999176910226338119632657870077e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8c, static_cast(6.5f)), + static_cast(0.30319406120433428955078125e12L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8a, static_cast(0.125)), + static_cast(0.9079594375725946520105935633182525634766e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8a, static_cast(0.25)), + static_cast(0.93363673128187656402587890625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8a, static_cast(0.75)), + static_cast(0.155691558457911014556884765625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4258457138999176910226338119632657870077e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n8a, static_cast(6.5f)), + static_cast(0.30319406120433428955078125e12L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(0.125), 8), + static_cast(0.9636755005807572160847485065460205078125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(0.25), 8), + static_cast(0.1034546925127506256103515625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(0.75), 8), + static_cast(0.1775887446105480194091796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(1.0f - 1.0f/64.0f), 8), + static_cast(0.4311765982475354321499772058039525455316e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(6.5f), 8), + static_cast(0.466452401928975830078125e11L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(0.125)), + static_cast(0.9636755005807572160847485065460205078125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(0.25)), + static_cast(0.1034546925127506256103515625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(0.75)), + static_cast(0.1775887446105480194091796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4311765982475354321499772058039525455316e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8c, static_cast(6.5f)), + static_cast(0.466452401928975830078125e11L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8a, static_cast(0.125)), + static_cast(0.9636755005807572160847485065460205078125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8a, static_cast(0.25)), + static_cast(0.1034546925127506256103515625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8a, static_cast(0.75)), + static_cast(0.1775887446105480194091796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4311765982475354321499772058039525455316e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n8a, static_cast(6.5f)), + static_cast(0.466452401928975830078125e11L), + tolerance); + // + // Rational functions of order 7 + // + static const U d8c[8] = { 7, 10, 10, 11, 2, 4, 1, 7 }; + static const boost::array d8a = { 7, 10, 10, 11, 2, 4, 1, 7 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8c, d8c, static_cast(0.125), 8), + static_cast(0.1153693678861771369296601206130394355814e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8c, d8c, static_cast(0.25), 8), + static_cast(0.103714470093009762768860970830101771981e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8c, d8c, static_cast(0.75), 8), + static_cast(0.834289461108456229648481346061946410909e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8c, d8c, static_cast(1.0f - 1.0f/64.0f), 8), + static_cast(0.8981362736388035283180082845549732926578e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8c, d8c, static_cast(6.5f), 8), + static_cast(0.383383275200627223098571833372266642165e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8c, d8c, static_cast(10247.25f), 8), + static_cast(0.1430085023641929377426860779365964126311e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8c, d8c, static_cast(0.125)), + static_cast(0.1153693678861771369296601206130394355814e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8c, d8c, static_cast(0.25)), + static_cast(0.103714470093009762768860970830101771981e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8c, d8c, static_cast(0.75)), + static_cast(0.834289461108456229648481346061946410909e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8c, d8c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8981362736388035283180082845549732926578e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8c, d8c, static_cast(6.5f)), + static_cast(0.383383275200627223098571833372266642165e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8c, d8c, static_cast(10247.25f)), + static_cast(0.1430085023641929377426860779365964126311e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8a, d8a, static_cast(0.125)), + static_cast(0.1153693678861771369296601206130394355814e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8a, d8a, static_cast(0.25)), + static_cast(0.103714470093009762768860970830101771981e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8a, d8a, static_cast(0.75)), + static_cast(0.834289461108456229648481346061946410909e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8a, d8a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8981362736388035283180082845549732926578e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8a, d8a, static_cast(6.5f)), + static_cast(0.383383275200627223098571833372266642165e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n8a, d8a, static_cast(10247.25f)), + static_cast(0.1430085023641929377426860779365964126311e0L), + tolerance); + + // + // Polynomials of order 8 + // + static const U n9c[9] = { 3, 9, 3, 9, 5, 6, 10, 7, 10 }; + static const boost::array n9a = { 3, 9, 3, 9, 5, 6, 10, 7, 10 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9c, static_cast(0.125), 9), + static_cast(0.419089901447296142578125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9c, static_cast(0.25), 9), + static_cast(0.5606536865234375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9c, static_cast(0.75), 9), + static_cast(0.21955535888671875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9c, static_cast(1.0f - 1.0f/64.0f), 9), + static_cast(0.577754343750660055434309470001608133316e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9c, static_cast(6.5), 9), + static_cast(0.3613143234375e8L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9c, static_cast(10247.25), 9), + static_cast(0.1215873306624182859977656082228297326996e34L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9c, static_cast(0.125)), + static_cast(0.419089901447296142578125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9c, static_cast(0.25)), + static_cast(0.5606536865234375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9c, static_cast(0.75)), + static_cast(0.21955535888671875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.577754343750660055434309470001608133316e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9c, static_cast(6.5)), + static_cast(0.3613143234375e8L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9c, static_cast(10247.25)), + static_cast(0.1215873306624182859977656082228297326996e34L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9a, static_cast(0.125)), + static_cast(0.419089901447296142578125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9a, static_cast(0.25)), + static_cast(0.5606536865234375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9a, static_cast(0.75)), + static_cast(0.21955535888671875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.577754343750660055434309470001608133316e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9a, static_cast(6.5)), + static_cast(0.3613143234375e8L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n9a, static_cast(10247.25)), + static_cast(0.1215873306624182859977656082228297326996e34L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9c, static_cast(0.125), 9), + static_cast(0.3141392057908696244794555241242051124573e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9c, static_cast(0.25), 9), + static_cast(0.35764986560679972171783447265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9c, static_cast(0.75), 9), + static_cast(0.119936861679889261722564697265625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9c, static_cast(1.0f - 1.0f/64.0f), 9), + static_cast(0.5392583642412261279423815221065846904997e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9c, static_cast(6.5f), 9), + static_cast(0.103274449934495763275146484375e15L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9c, static_cast(0.125)), + static_cast(0.3141392057908696244794555241242051124573e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9c, static_cast(0.25)), + static_cast(0.35764986560679972171783447265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9c, static_cast(0.75)), + static_cast(0.119936861679889261722564697265625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.5392583642412261279423815221065846904997e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9c, static_cast(6.5f)), + static_cast(0.103274449934495763275146484375e15L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9a, static_cast(0.125)), + static_cast(0.3141392057908696244794555241242051124573e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9a, static_cast(0.25)), + static_cast(0.35764986560679972171783447265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9a, static_cast(0.75)), + static_cast(0.119936861679889261722564697265625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.5392583642412261279423815221065846904997e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n9a, static_cast(6.5f)), + static_cast(0.103274449934495763275146484375e15L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(0.125), 9), + static_cast(0.4131136463269569958356441929936408996582e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(0.25), 9), + static_cast(0.530599462427198886871337890625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(0.75), 9), + static_cast(0.1499158155731856822967529296875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(1.0f - 1.0f/64.0f), 9), + static_cast(0.5473418303402932093382923399178003205076e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(6.5f), 9), + static_cast(0.1588837691300188665771484375e14L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(0.125)), + static_cast(0.4131136463269569958356441929936408996582e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(0.25)), + static_cast(0.530599462427198886871337890625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(0.75)), + static_cast(0.1499158155731856822967529296875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.5473418303402932093382923399178003205076e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9c, static_cast(6.5f)), + static_cast(0.1588837691300188665771484375e14L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9a, static_cast(0.125)), + static_cast(0.4131136463269569958356441929936408996582e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9a, static_cast(0.25)), + static_cast(0.530599462427198886871337890625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9a, static_cast(0.75)), + static_cast(0.1499158155731856822967529296875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.5473418303402932093382923399178003205076e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n9a, static_cast(6.5f)), + static_cast(0.1588837691300188665771484375e14L), + tolerance); + // + // Rational functions of order 8 + // + static const U d9c[9] = { 12, 3, 10, 4, 6, 6, 6, 10, 7 }; + static const boost::array d9a = { 12, 3, 10, 4, 6, 6, 6, 10, 7 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9c, d9c, static_cast(0.125), 9), + static_cast(0.3341827920887278954826517708316980450243e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9c, d9c, static_cast(0.25), 9), + static_cast(0.4162555242250224594229316089330159747956e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9c, d9c, static_cast(0.75), 9), + static_cast(0.7844550246723573100342976024389406178802e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9c, d9c, static_cast(1.0f - 1.0f/64.0f), 9), + static_cast(0.959335028097323235424759017468360386113e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9c, d9c, static_cast(6.5f), 9), + static_cast(0.1302420407483849169746727326286868117535e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9c, d9c, static_cast(10247.25f), 9), + static_cast(0.1428469874366314841691622991213446692856e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9c, d9c, static_cast(0.125)), + static_cast(0.3341827920887278954826517708316980450243e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9c, d9c, static_cast(0.25)), + static_cast(0.4162555242250224594229316089330159747956e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9c, d9c, static_cast(0.75)), + static_cast(0.7844550246723573100342976024389406178802e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9c, d9c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.959335028097323235424759017468360386113e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9c, d9c, static_cast(6.5f)), + static_cast(0.1302420407483849169746727326286868117535e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9c, d9c, static_cast(10247.25f)), + static_cast(0.1428469874366314841691622991213446692856e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9a, d9a, static_cast(0.125)), + static_cast(0.3341827920887278954826517708316980450243e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9a, d9a, static_cast(0.25)), + static_cast(0.4162555242250224594229316089330159747956e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9a, d9a, static_cast(0.75)), + static_cast(0.7844550246723573100342976024389406178802e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9a, d9a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.959335028097323235424759017468360386113e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9a, d9a, static_cast(6.5f)), + static_cast(0.1302420407483849169746727326286868117535e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n9a, d9a, static_cast(10247.25f)), + static_cast(0.1428469874366314841691622991213446692856e1L), + tolerance); + + // + // Polynomials of order 9 + // + static const U n10c[10] = { 3, 4, 2, 6, 8, 1, 2, 4, 8, 8 }; + static const boost::array n10a = { 3, 4, 2, 6, 8, 1, 2, 4, 8, 8 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10c, static_cast(0.125), 10), + static_cast(0.3544962465763092041015625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10c, static_cast(0.25), 10), + static_cast(0.4251861572265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10c, static_cast(0.75), 10), + static_cast(0.14716278076171875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10c, static_cast(1.0f - 1.0f/64.0f), 10), + static_cast(0.4243246072286939307716124858416151255369e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10c, static_cast(6.5), 10), + static_cast(0.193326261328125e9L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10c, static_cast(10247.25), 10), + static_cast(0.9967777935240642903307419028007759631098e37L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10c, static_cast(0.125)), + static_cast(0.3544962465763092041015625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10c, static_cast(0.25)), + static_cast(0.4251861572265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10c, static_cast(0.75)), + static_cast(0.14716278076171875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4243246072286939307716124858416151255369e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10c, static_cast(6.5)), + static_cast(0.193326261328125e9L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10c, static_cast(10247.25)), + static_cast(0.9967777935240642903307419028007759631098e37L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10a, static_cast(0.125)), + static_cast(0.3544962465763092041015625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10a, static_cast(0.25)), + static_cast(0.4251861572265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10a, static_cast(0.75)), + static_cast(0.14716278076171875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.4243246072286939307716124858416151255369e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10a, static_cast(6.5)), + static_cast(0.193326261328125e9L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n10a, static_cast(10247.25)), + static_cast(0.9967777935240642903307419028007759631098e37L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10c, static_cast(0.125), 10), + static_cast(0.3063011647232116718697625401546247303486e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10c, static_cast(0.25), 10), + static_cast(0.3259400503826327621936798095703125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10c, static_cast(0.75), 10), + static_cast(0.8067807371844537556171417236328125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10c, static_cast(1.0f - 1.0f/64.0f), 10), + static_cast(0.3922779295817342542834377568121069117613e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10c, static_cast(6.5f), 10), + static_cast(0.3514067090785774022613525390625e16L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10c, static_cast(0.125)), + static_cast(0.3063011647232116718697625401546247303486e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10c, static_cast(0.25)), + static_cast(0.3259400503826327621936798095703125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10c, static_cast(0.75)), + static_cast(0.8067807371844537556171417236328125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.3922779295817342542834377568121069117613e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10c, static_cast(6.5f)), + static_cast(0.3514067090785774022613525390625e16L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10a, static_cast(0.125)), + static_cast(0.3063011647232116718697625401546247303486e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10a, static_cast(0.25)), + static_cast(0.3259400503826327621936798095703125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10a, static_cast(0.75)), + static_cast(0.8067807371844537556171417236328125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.3922779295817342542834377568121069117613e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n10a, static_cast(6.5f)), + static_cast(0.3514067090785774022613525390625e16L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(0.125), 10), + static_cast(0.3504093177856933749581003212369978427887e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(0.25), 10), + static_cast(0.40376020153053104877471923828125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(0.75), 10), + static_cast(0.97570764957927167415618896484375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(1.0f - 1.0f/64.0f), 10), + static_cast(0.3980283729084284487958732767615054341702e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(6.5f), 10), + static_cast(0.54062570627473700347900390625e15L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(0.125)), + static_cast(0.3504093177856933749581003212369978427887e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(0.25)), + static_cast(0.40376020153053104877471923828125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(0.75)), + static_cast(0.97570764957927167415618896484375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.3980283729084284487958732767615054341702e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10c, static_cast(6.5f)), + static_cast(0.54062570627473700347900390625e15L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10a, static_cast(0.125)), + static_cast(0.3504093177856933749581003212369978427887e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10a, static_cast(0.25)), + static_cast(0.40376020153053104877471923828125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10a, static_cast(0.75)), + static_cast(0.97570764957927167415618896484375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.3980283729084284487958732767615054341702e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n10a, static_cast(6.5f)), + static_cast(0.54062570627473700347900390625e15L), + tolerance); + // + // Rational functions of order 9 + // + static const U d10c[10] = { 3, 11, 1, 12, 8, 8, 7, 10, 8, 8 }; + static const boost::array d10a = { 3, 11, 1, 12, 8, 8, 7, 10, 8, 8 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10c, d10c, static_cast(0.125), 10), + static_cast(0.8027011456035955638016996485812217742707e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10c, d10c, static_cast(0.25), 10), + static_cast(0.7037718026559713894599659542655668311705e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10c, d10c, static_cast(0.75), 10), + static_cast(0.5819711007563332500606442409694389231031e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10c, d10c, static_cast(1.0f - 1.0f/64.0f), 10), + static_cast(0.6021345078884753739086911192013079405483e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10c, d10c, static_cast(6.5f), 10), + static_cast(0.9827105949744728065574239430024037810213e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10c, d10c, static_cast(10247.25f), 10), + static_cast(0.9999999928576761766405011572543053028339e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10c, d10c, static_cast(0.125)), + static_cast(0.8027011456035955638016996485812217742707e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10c, d10c, static_cast(0.25)), + static_cast(0.7037718026559713894599659542655668311705e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10c, d10c, static_cast(0.75)), + static_cast(0.5819711007563332500606442409694389231031e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10c, d10c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.6021345078884753739086911192013079405483e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10c, d10c, static_cast(6.5f)), + static_cast(0.9827105949744728065574239430024037810213e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10c, d10c, static_cast(10247.25f)), + static_cast(0.9999999928576761766405011572543053028339e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10a, d10a, static_cast(0.125)), + static_cast(0.8027011456035955638016996485812217742707e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10a, d10a, static_cast(0.25)), + static_cast(0.7037718026559713894599659542655668311705e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10a, d10a, static_cast(0.75)), + static_cast(0.5819711007563332500606442409694389231031e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10a, d10a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.6021345078884753739086911192013079405483e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10a, d10a, static_cast(6.5f)), + static_cast(0.9827105949744728065574239430024037810213e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n10a, d10a, static_cast(10247.25f)), + static_cast(0.9999999928576761766405011572543053028339e0L), + tolerance); + + // + // Polynomials of order 10 + // + static const U n11c[11] = { 2, 2, 8, 11, 3, 4, 10, 11, 5, 1, 6 }; + static const boost::array n11a = { 2, 2, 8, 11, 3, 4, 10, 11, 5, 1, 6 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11c, static_cast(0.125), 11), + static_cast(0.239738257043063640594482421875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11c, static_cast(0.25), 11), + static_cast(0.31906986236572265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11c, static_cast(0.75), 11), + static_cast(0.187007007598876953125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11c, static_cast(1.0f - 1.0f/64.0f), 11), + static_cast(0.5807897685780276847943015550157497273176e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11c, static_cast(6.5), 11), + static_cast(0.85061053443359375e9L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11c, static_cast(0.125)), + static_cast(0.239738257043063640594482421875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11c, static_cast(0.25)), + static_cast(0.31906986236572265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11c, static_cast(0.75)), + static_cast(0.187007007598876953125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.5807897685780276847943015550157497273176e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11c, static_cast(6.5)), + static_cast(0.85061053443359375e9L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11a, static_cast(0.125)), + static_cast(0.239738257043063640594482421875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11a, static_cast(0.25)), + static_cast(0.31906986236572265625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11a, static_cast(0.75)), + static_cast(0.187007007598876953125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.5807897685780276847943015550157497273176e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n11a, static_cast(6.5)), + static_cast(0.85061053443359375e9L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11c, static_cast(0.125), 11), + static_cast(0.2033245269357184586631048794913567689946e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11c, static_cast(0.25), 11), + static_cast(0.2158985776148256263695657253265380859375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11c, static_cast(0.75), 11), + static_cast(0.8727145384755203849636018276214599609375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11c, static_cast(1.0f - 1.0f/64.0f), 11), + static_cast(0.5363972553738812062759598952966094072427e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11c, static_cast(6.5f), 11), + static_cast(0.1092297265410211371166019439697265625e18L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11c, static_cast(0.125)), + static_cast(0.2033245269357184586631048794913567689946e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11c, static_cast(0.25)), + static_cast(0.2158985776148256263695657253265380859375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11c, static_cast(0.75)), + static_cast(0.8727145384755203849636018276214599609375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.5363972553738812062759598952966094072427e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11c, static_cast(6.5f)), + static_cast(0.1092297265410211371166019439697265625e18L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11a, static_cast(0.125)), + static_cast(0.2033245269357184586631048794913567689946e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11a, static_cast(0.25)), + static_cast(0.2158985776148256263695657253265380859375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11a, static_cast(0.75)), + static_cast(0.8727145384755203849636018276214599609375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.5363972553738812062759598952966094072427e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n11a, static_cast(6.5f)), + static_cast(0.1092297265410211371166019439697265625e18L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(0.125), 11), + static_cast(0.2265962154857476693048390359308541519567e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(0.25), 11), + static_cast(0.26359431045930250547826290130615234375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(0.75), 11), + static_cast(0.109695271796736051328480243682861328125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(1.0f - 1.0f/64.0f), 11), + static_cast(0.544594037205212653994625925380682572437e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(6.5f), 11), + static_cast(0.16804573314003253556400299072265625e17L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(0.125)), + static_cast(0.2265962154857476693048390359308541519567e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(0.25)), + static_cast(0.26359431045930250547826290130615234375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(0.75)), + static_cast(0.109695271796736051328480243682861328125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.544594037205212653994625925380682572437e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11c, static_cast(6.5f)), + static_cast(0.16804573314003253556400299072265625e17L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11a, static_cast(0.125)), + static_cast(0.2265962154857476693048390359308541519567e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11a, static_cast(0.25)), + static_cast(0.26359431045930250547826290130615234375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11a, static_cast(0.75)), + static_cast(0.109695271796736051328480243682861328125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.544594037205212653994625925380682572437e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n11a, static_cast(6.5f)), + static_cast(0.16804573314003253556400299072265625e17L), + tolerance); + // + // Rational functions of order 10 + // + static const U d11c[11] = { 4, 1, 3, 9, 11, 8, 11, 2, 6, 6, 4 }; + static const boost::array d11a = { 4, 1, 3, 9, 11, 8, 11, 2, 6, 6, 4 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11c, d11c, static_cast(0.125), 11), + static_cast(0.5718365676248588095654568811483084403598e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11c, d11c, static_cast(0.25), 11), + static_cast(0.6888631839546304707516922567568791812269e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11c, d11c, static_cast(0.75), 11), + static_cast(0.9783539912974912482969079012097816310129e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11c, d11c, static_cast(1.0f - 1.0f/64.0f), 11), + static_cast(0.9694017102874332007392886881642471036972e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11c, d11c, static_cast(6.5f), 11), + static_cast(0.1243900864392932237542421996384079347041e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11c, d11c, static_cast(10247.25f), 11), + static_cast(0.1499804844733304585200728061706913399511e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11c, d11c, static_cast(0.125)), + static_cast(0.5718365676248588095654568811483084403598e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11c, d11c, static_cast(0.25)), + static_cast(0.6888631839546304707516922567568791812269e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11c, d11c, static_cast(0.75)), + static_cast(0.9783539912974912482969079012097816310129e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11c, d11c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.9694017102874332007392886881642471036972e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11c, d11c, static_cast(6.5f)), + static_cast(0.1243900864392932237542421996384079347041e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11c, d11c, static_cast(10247.25f)), + static_cast(0.1499804844733304585200728061706913399511e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11a, d11a, static_cast(0.125)), + static_cast(0.5718365676248588095654568811483084403598e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11a, d11a, static_cast(0.25)), + static_cast(0.6888631839546304707516922567568791812269e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11a, d11a, static_cast(0.75)), + static_cast(0.9783539912974912482969079012097816310129e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11a, d11a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.9694017102874332007392886881642471036972e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11a, d11a, static_cast(6.5f)), + static_cast(0.1243900864392932237542421996384079347041e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n11a, d11a, static_cast(10247.25f)), + static_cast(0.1499804844733304585200728061706913399511e1L), + tolerance); + + // + // Polynomials of order 11 + // + static const U n12c[12] = { 10, 12, 4, 1, 12, 7, 11, 5, 12, 5, 10, 6 }; + static const boost::array n12a = { 10, 12, 4, 1, 12, 7, 11, 5, 12, 5, 10, 6 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12c, static_cast(0.125), 12), + static_cast(0.1156764154392294585704803466796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12c, static_cast(0.25), 12), + static_cast(0.13322539806365966796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12c, static_cast(0.75), 12), + static_cast(0.32148390293121337890625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12c, static_cast(1.0f - 1.0f/64.0f), 12), + static_cast(0.8737331822870016474402916385744166660743e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12c, static_cast(6.5), 12), + static_cast(0.67419250750654296875e10L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12c, static_cast(0.125)), + static_cast(0.1156764154392294585704803466796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12c, static_cast(0.25)), + static_cast(0.13322539806365966796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12c, static_cast(0.75)), + static_cast(0.32148390293121337890625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8737331822870016474402916385744166660743e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12c, static_cast(6.5)), + static_cast(0.67419250750654296875e10L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12a, static_cast(0.125)), + static_cast(0.1156764154392294585704803466796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12a, static_cast(0.25)), + static_cast(0.13322539806365966796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12a, static_cast(0.75)), + static_cast(0.32148390293121337890625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8737331822870016474402916385744166660743e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n12a, static_cast(6.5)), + static_cast(0.67419250750654296875e10L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12c, static_cast(0.125), 12), + static_cast(0.101884810991335118067599354446661763518e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12c, static_cast(0.25), 12), + static_cast(0.1076605959896767217287560924887657165527e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12c, static_cast(0.75), 12), + static_cast(0.2041755737073560794669901952147483825684e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12c, static_cast(1.0f - 1.0f/64.0f), 12), + static_cast(0.8060387357327405373376954971672611741429e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12c, static_cast(6.5f), 12), + static_cast(0.4778085851102157284559772014617919921875e19L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12c, static_cast(0.125)), + static_cast(0.101884810991335118067599354446661763518e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12c, static_cast(0.25)), + static_cast(0.1076605959896767217287560924887657165527e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12c, static_cast(0.75)), + static_cast(0.2041755737073560794669901952147483825684e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8060387357327405373376954971672611741429e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12c, static_cast(6.5f)), + static_cast(0.4778085851102157284559772014617919921875e19L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12a, static_cast(0.125)), + static_cast(0.101884810991335118067599354446661763518e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12a, static_cast(0.25)), + static_cast(0.1076605959896767217287560924887657165527e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12a, static_cast(0.75)), + static_cast(0.2041755737073560794669901952147483825684e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8060387357327405373376954971672611741429e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n12a, static_cast(6.5f)), + static_cast(0.4778085851102157284559772014617919921875e19L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(0.125), 12), + static_cast(0.1150784879306809445407948355732941081442e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(0.25), 12), + static_cast(0.1306423839587068869150243699550628662109e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(0.75), 12), + static_cast(0.2389007649431414392893202602863311767578e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(1.0f - 1.0f/64.0f), 12), + static_cast(0.8172456997919903871367065368048367483356e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(6.5f), 12), + static_cast(0.73509013093879343685534954071044921875e18L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(0.125)), + static_cast(0.1150784879306809445407948355732941081442e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(0.25)), + static_cast(0.1306423839587068869150243699550628662109e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(0.75)), + static_cast(0.2389007649431414392893202602863311767578e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8172456997919903871367065368048367483356e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12c, static_cast(6.5f)), + static_cast(0.73509013093879343685534954071044921875e18L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12a, static_cast(0.125)), + static_cast(0.1150784879306809445407948355732941081442e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12a, static_cast(0.25)), + static_cast(0.1306423839587068869150243699550628662109e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12a, static_cast(0.75)), + static_cast(0.2389007649431414392893202602863311767578e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8172456997919903871367065368048367483356e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n12a, static_cast(6.5f)), + static_cast(0.73509013093879343685534954071044921875e18L), + tolerance); + // + // Rational functions of order 11 + // + static const U d12c[12] = { 12, 5, 2, 8, 3, 2, 6, 9, 2, 8, 9, 12 }; + static const boost::array d12a = { 12, 5, 2, 8, 3, 2, 6, 9, 2, 8, 9, 12 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12c, d12c, static_cast(0.125), 12), + static_cast(0.9128003783370762743953357962892418132189e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12c, d12c, static_cast(0.25), 12), + static_cast(0.9857041905689267091438933694601440838819e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12c, d12c, static_cast(0.75), 12), + static_cast(0.1248112763387283893598834927961632655902e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12c, d12c, static_cast(1.0f - 1.0f/64.0f), 12), + static_cast(0.1227813945781309965073515980672922656926e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12c, d12c, static_cast(6.5f), 12), + static_cast(0.5670462630528956417277364302989555872917e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12c, d12c, static_cast(10247.25f), 12), + static_cast(0.5000447249679368028702341332079904080375e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12c, d12c, static_cast(0.125)), + static_cast(0.9128003783370762743953357962892418132189e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12c, d12c, static_cast(0.25)), + static_cast(0.9857041905689267091438933694601440838819e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12c, d12c, static_cast(0.75)), + static_cast(0.1248112763387283893598834927961632655902e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12c, d12c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1227813945781309965073515980672922656926e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12c, d12c, static_cast(6.5f)), + static_cast(0.5670462630528956417277364302989555872917e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12c, d12c, static_cast(10247.25f)), + static_cast(0.5000447249679368028702341332079904080375e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12a, d12a, static_cast(0.125)), + static_cast(0.9128003783370762743953357962892418132189e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12a, d12a, static_cast(0.25)), + static_cast(0.9857041905689267091438933694601440838819e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12a, d12a, static_cast(0.75)), + static_cast(0.1248112763387283893598834927961632655902e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12a, d12a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1227813945781309965073515980672922656926e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12a, d12a, static_cast(6.5f)), + static_cast(0.5670462630528956417277364302989555872917e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n12a, d12a, static_cast(10247.25f)), + static_cast(0.5000447249679368028702341332079904080375e0L), + tolerance); + + // + // Polynomials of order 12 + // + static const U n13c[13] = { 4, 11, 7, 1, 1, 1, 8, 11, 10, 12, 8, 2, 1 }; + static const boost::array n13a = { 4, 11, 7, 1, 1, 1, 8, 11, 10, 12, 8, 2, 1 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13c, static_cast(0.125), 13), + static_cast(0.5486639239141368307173252105712890625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13c, static_cast(0.25), 13), + static_cast(0.7210838854312896728515625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13c, static_cast(0.75), 13), + static_cast(0.22524036943912506103515625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13c, static_cast(1.0f - 1.0f/64.0f), 13), + static_cast(0.7013317633407797455061737623412208147977e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13c, static_cast(6.5), 13), + static_cast(0.8801602436469970703125e10L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13c, static_cast(0.125)), + static_cast(0.5486639239141368307173252105712890625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13c, static_cast(0.25)), + static_cast(0.7210838854312896728515625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13c, static_cast(0.75)), + static_cast(0.22524036943912506103515625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7013317633407797455061737623412208147977e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13c, static_cast(6.5)), + static_cast(0.8801602436469970703125e10L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13a, static_cast(0.125)), + static_cast(0.5486639239141368307173252105712890625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13a, static_cast(0.25)), + static_cast(0.7210838854312896728515625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13a, static_cast(0.75)), + static_cast(0.22524036943912506103515625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7013317633407797455061737623412208147977e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n13a, static_cast(6.5)), + static_cast(0.8801602436469970703125e10L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13c, static_cast(0.125), 13), + static_cast(0.4173587859727185607499727379291788731397e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13c, static_cast(0.25), 13), + static_cast(0.4715104623414053008900737040676176548004e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13c, static_cast(0.75), 13), + static_cast(0.1338397611887558369403450342360883951187e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13c, static_cast(1.0f - 1.0f/64.0f), 13), + static_cast(0.6407202225497595548875186059951665936749e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13c, static_cast(6.5f), 13), + static_cast(0.3403521961549553788009664398431777954102e20L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13c, static_cast(0.125)), + static_cast(0.4173587859727185607499727379291788731397e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13c, static_cast(0.25)), + static_cast(0.4715104623414053008900737040676176548004e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13c, static_cast(0.75)), + static_cast(0.1338397611887558369403450342360883951187e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.6407202225497595548875186059951665936749e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13c, static_cast(6.5f)), + static_cast(0.3403521961549553788009664398431777954102e20L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13a, static_cast(0.125)), + static_cast(0.4173587859727185607499727379291788731397e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13a, static_cast(0.25)), + static_cast(0.4715104623414053008900737040676176548004e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13a, static_cast(0.75)), + static_cast(0.1338397611887558369403450342360883951187e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.6407202225497595548875186059951665936749e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n13a, static_cast(6.5f)), + static_cast(0.3403521961549553788009664398431777954102e20L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(0.125), 13), + static_cast(0.5388702877817484859997819034334309851175e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(0.25), 13), + static_cast(0.6860418493656212035602948162704706192017e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(0.75), 13), + static_cast(0.165119681585007782587126712314784526825e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(1.0f - 1.0f/64.0f), 13), + static_cast(0.6502554641775335160762093775188993967491e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(6.5f), 13), + static_cast(0.5236187633153159677245637536048889160156e19L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(0.125)), + static_cast(0.5388702877817484859997819034334309851175e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(0.25)), + static_cast(0.6860418493656212035602948162704706192017e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(0.75)), + static_cast(0.165119681585007782587126712314784526825e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.6502554641775335160762093775188993967491e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13c, static_cast(6.5f)), + static_cast(0.5236187633153159677245637536048889160156e19L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13a, static_cast(0.125)), + static_cast(0.5388702877817484859997819034334309851175e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13a, static_cast(0.25)), + static_cast(0.6860418493656212035602948162704706192017e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13a, static_cast(0.75)), + static_cast(0.165119681585007782587126712314784526825e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.6502554641775335160762093775188993967491e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n13a, static_cast(6.5f)), + static_cast(0.5236187633153159677245637536048889160156e19L), + tolerance); + // + // Rational functions of order 12 + // + static const U d13c[13] = { 4, 7, 1, 6, 11, 4, 9, 11, 1, 10, 1, 11, 12 }; + static const boost::array d13a = { 4, 7, 1, 6, 11, 4, 9, 11, 1, 10, 1, 11, 12 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13c, d13c, static_cast(0.125), 13), + static_cast(0.1118537310443419140823936840990235560775e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13c, d13c, static_cast(0.25), 13), + static_cast(0.12106743933208147312270004711488386001e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13c, d13c, static_cast(0.75), 13), + static_cast(0.1042994706832119738384940706309786965245e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13c, d13c, static_cast(1.0f - 1.0f/64.0f), 13), + static_cast(0.8849937505065081554917467830175954168154e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13c, d13c, static_cast(6.5f), 13), + static_cast(0.1125049235146435310211414108934070096386e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13c, d13c, static_cast(10247.25f), 13), + static_cast(0.8334214878002966556152610218152238753709e-1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13c, d13c, static_cast(0.125)), + static_cast(0.1118537310443419140823936840990235560775e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13c, d13c, static_cast(0.25)), + static_cast(0.12106743933208147312270004711488386001e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13c, d13c, static_cast(0.75)), + static_cast(0.1042994706832119738384940706309786965245e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13c, d13c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8849937505065081554917467830175954168154e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13c, d13c, static_cast(6.5f)), + static_cast(0.1125049235146435310211414108934070096386e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13c, d13c, static_cast(10247.25f)), + static_cast(0.8334214878002966556152610218152238753709e-1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13a, d13a, static_cast(0.125)), + static_cast(0.1118537310443419140823936840990235560775e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13a, d13a, static_cast(0.25)), + static_cast(0.12106743933208147312270004711488386001e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13a, d13a, static_cast(0.75)), + static_cast(0.1042994706832119738384940706309786965245e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13a, d13a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8849937505065081554917467830175954168154e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13a, d13a, static_cast(6.5f)), + static_cast(0.1125049235146435310211414108934070096386e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n13a, d13a, static_cast(10247.25f)), + static_cast(0.8334214878002966556152610218152238753709e-1L), + tolerance); + + // + // Polynomials of order 13 + // + static const U n14c[14] = { 5, 5, 3, 5, 12, 8, 10, 5, 5, 9, 2, 10, 3, 3 }; + static const boost::array n14a = { 5, 5, 3, 5, 12, 8, 10, 5, 5, 9, 2, 10, 3, 3 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14c, static_cast(0.125), 14), + static_cast(0.5684855352437807596288621425628662109375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14c, static_cast(0.25), 14), + static_cast(0.657317422330379486083984375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14c, static_cast(0.75), 14), + static_cast(0.2256699807941913604736328125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14c, static_cast(1.0f - 1.0f/64.0f), 14), + static_cast(0.7710103154409585858207746641830426369713e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14c, static_cast(6.5), 14), + static_cast(0.1372059025011920166015625e12L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14c, static_cast(0.125)), + static_cast(0.5684855352437807596288621425628662109375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14c, static_cast(0.25)), + static_cast(0.657317422330379486083984375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14c, static_cast(0.75)), + static_cast(0.2256699807941913604736328125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7710103154409585858207746641830426369713e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14c, static_cast(6.5)), + static_cast(0.1372059025011920166015625e12L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14a, static_cast(0.125)), + static_cast(0.5684855352437807596288621425628662109375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14a, static_cast(0.25)), + static_cast(0.657317422330379486083984375e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14a, static_cast(0.75)), + static_cast(0.2256699807941913604736328125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7710103154409585858207746641830426369713e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n14a, static_cast(6.5)), + static_cast(0.1372059025011920166015625e12L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14c, static_cast(0.125), 14), + static_cast(0.5078877218214320312311861835604176527818e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14c, static_cast(0.25), 14), + static_cast(0.5325630803958699699407475236512254923582e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14c, static_cast(0.75), 14), + static_cast(0.1183906394403697492911931021808413788676e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14c, static_cast(1.0f - 1.0f/64.0f), 14), + static_cast(0.7015764398304385537424317046920004042802e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14c, static_cast(6.5f), 14), + static_cast(0.4205557544065332561152158209905028343201e22L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14c, static_cast(0.125)), + static_cast(0.5078877218214320312311861835604176527818e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14c, static_cast(0.25)), + static_cast(0.5325630803958699699407475236512254923582e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14c, static_cast(0.75)), + static_cast(0.1183906394403697492911931021808413788676e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7015764398304385537424317046920004042802e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14c, static_cast(6.5f)), + static_cast(0.4205557544065332561152158209905028343201e22L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14a, static_cast(0.125)), + static_cast(0.5078877218214320312311861835604176527818e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14a, static_cast(0.25)), + static_cast(0.5325630803958699699407475236512254923582e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14a, static_cast(0.75)), + static_cast(0.1183906394403697492911931021808413788676e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7015764398304385537424317046920004042802e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n14a, static_cast(6.5f)), + static_cast(0.4205557544065332561152158209905028343201e22L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(0.125), 14), + static_cast(0.5631017745714562498494894684833412222547e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(0.25), 14), + static_cast(0.6302523215834798797629900946049019694328e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(0.75), 14), + static_cast(0.1411875192538263323882574695744551718235e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(1.0f - 1.0f/64.0f), 14), + static_cast(0.7119189230023502768177083984172702519672e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(6.5f), 14), + static_cast(0.6470088529331280863353320322930812835693e21L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(0.125)), + static_cast(0.5631017745714562498494894684833412222547e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(0.25)), + static_cast(0.6302523215834798797629900946049019694328e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(0.75)), + static_cast(0.1411875192538263323882574695744551718235e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7119189230023502768177083984172702519672e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14c, static_cast(6.5f)), + static_cast(0.6470088529331280863353320322930812835693e21L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14a, static_cast(0.125)), + static_cast(0.5631017745714562498494894684833412222547e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14a, static_cast(0.25)), + static_cast(0.6302523215834798797629900946049019694328e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14a, static_cast(0.75)), + static_cast(0.1411875192538263323882574695744551718235e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7119189230023502768177083984172702519672e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n14a, static_cast(6.5f)), + static_cast(0.6470088529331280863353320322930812835693e21L), + tolerance); + // + // Rational functions of order 13 + // + static const U d14c[14] = { 1, 2, 1, 8, 5, 8, 2, 11, 3, 6, 5, 9, 7, 10 }; + static const boost::array d14a = { 1, 2, 1, 8, 5, 8, 2, 11, 3, 6, 5, 9, 7, 10 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14c, d14c, static_cast(0.125), 14), + static_cast(0.4431848049037056640776200482297774574883e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14c, d14c, static_cast(0.25), 14), + static_cast(0.3830343514018902583833597521450902906851e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14c, d14c, static_cast(0.75), 14), + static_cast(0.1657621200711495617835320787645038062003e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14c, d14c, static_cast(1.0f - 1.0f/64.0f), 14), + static_cast(0.1117985091800992684003226640313705018678e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14c, d14c, static_cast(6.5f), 14), + static_cast(0.3280672161259396135368350556553925507681e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14c, d14c, static_cast(10247.25f), 14), + static_cast(0.3000087891957249835881866421118445480875e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14c, d14c, static_cast(0.125)), + static_cast(0.4431848049037056640776200482297774574883e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14c, d14c, static_cast(0.25)), + static_cast(0.3830343514018902583833597521450902906851e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14c, d14c, static_cast(0.75)), + static_cast(0.1657621200711495617835320787645038062003e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14c, d14c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1117985091800992684003226640313705018678e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14c, d14c, static_cast(6.5f)), + static_cast(0.3280672161259396135368350556553925507681e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14c, d14c, static_cast(10247.25f)), + static_cast(0.3000087891957249835881866421118445480875e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14a, d14a, static_cast(0.125)), + static_cast(0.4431848049037056640776200482297774574883e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14a, d14a, static_cast(0.25)), + static_cast(0.3830343514018902583833597521450902906851e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14a, d14a, static_cast(0.75)), + static_cast(0.1657621200711495617835320787645038062003e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14a, d14a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1117985091800992684003226640313705018678e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14a, d14a, static_cast(6.5f)), + static_cast(0.3280672161259396135368350556553925507681e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n14a, d14a, static_cast(10247.25f)), + static_cast(0.3000087891957249835881866421118445480875e0L), + tolerance); + + // + // Polynomials of order 14 + // + static const U n15c[15] = { 6, 2, 10, 2, 4, 11, 4, 6, 5, 5, 10, 12, 8, 6, 2 }; + static const boost::array n15a = { 6, 2, 10, 2, 4, 11, 4, 6, 5, 5, 10, 12, 8, 6, 2 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15c, static_cast(0.125), 15), + static_cast(0.6411486971785507193999364972114562988281e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15c, static_cast(0.25), 15), + static_cast(0.7184068299829959869384765625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15c, static_cast(0.75), 15), + static_cast(0.21735079027712345123291015625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15c, static_cast(1.0f - 1.0f/64.0f), 15), + static_cast(0.8299984286646360949452954853655163780233e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15c, static_cast(6.5), 15), + static_cast(0.7599432765217742919921875e12L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15c, static_cast(0.125)), + static_cast(0.6411486971785507193999364972114562988281e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15c, static_cast(0.25)), + static_cast(0.7184068299829959869384765625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15c, static_cast(0.75)), + static_cast(0.21735079027712345123291015625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8299984286646360949452954853655163780233e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15c, static_cast(6.5)), + static_cast(0.7599432765217742919921875e12L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15a, static_cast(0.125)), + static_cast(0.6411486971785507193999364972114562988281e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15a, static_cast(0.25)), + static_cast(0.7184068299829959869384765625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15a, static_cast(0.75)), + static_cast(0.21735079027712345123291015625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8299984286646360949452954853655163780233e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n15a, static_cast(6.5)), + static_cast(0.7599432765217742919921875e12L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15c, static_cast(0.125), 15), + static_cast(0.603369928436724862526100235763586452224e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15c, static_cast(0.25), 15), + static_cast(0.6164622568840771005271861326946236658841e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15c, static_cast(0.75), 15), + static_cast(0.1204200081304656236302896843426424311474e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15c, static_cast(1.0f - 1.0f/64.0f), 15), + static_cast(0.7438435296991670658675730793779505088179e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15c, static_cast(6.5f), 15), + static_cast(0.123975649339443727300884144392229616642e24L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15c, static_cast(0.125)), + static_cast(0.603369928436724862526100235763586452224e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15c, static_cast(0.25)), + static_cast(0.6164622568840771005271861326946236658841e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15c, static_cast(0.75)), + static_cast(0.1204200081304656236302896843426424311474e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7438435296991670658675730793779505088179e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15c, static_cast(6.5f)), + static_cast(0.123975649339443727300884144392229616642e24L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15a, static_cast(0.125)), + static_cast(0.603369928436724862526100235763586452224e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15a, static_cast(0.25)), + static_cast(0.6164622568840771005271861326946236658841e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15a, static_cast(0.75)), + static_cast(0.1204200081304656236302896843426424311474e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7438435296991670658675730793779505088179e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n15a, static_cast(6.5f)), + static_cast(0.123975649339443727300884144392229616642e24L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(0.125), 15), + static_cast(0.6269594274937989002088018861086916177919e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(0.25), 15), + static_cast(0.6658490275363084021087445307784946635365e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(0.75), 15), + static_cast(0.1405600108406208315070529124568565748632e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(1.0f - 1.0f/64.0f), 15), + static_cast(0.7546981889007411462781694774633148026087e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(6.5f), 15), + static_cast(0.1907317682145288112321802221418917179108e23L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(0.125)), + static_cast(0.6269594274937989002088018861086916177919e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(0.25)), + static_cast(0.6658490275363084021087445307784946635365e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(0.75)), + static_cast(0.1405600108406208315070529124568565748632e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7546981889007411462781694774633148026087e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15c, static_cast(6.5f)), + static_cast(0.1907317682145288112321802221418917179108e23L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15a, static_cast(0.125)), + static_cast(0.6269594274937989002088018861086916177919e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15a, static_cast(0.25)), + static_cast(0.6658490275363084021087445307784946635365e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15a, static_cast(0.75)), + static_cast(0.1405600108406208315070529124568565748632e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7546981889007411462781694774633148026087e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n15a, static_cast(6.5f)), + static_cast(0.1907317682145288112321802221418917179108e23L), + tolerance); + // + // Rational functions of order 14 + // + static const U d15c[15] = { 7, 10, 7, 1, 10, 11, 11, 10, 7, 1, 10, 9, 8, 2, 3 }; + static const boost::array d15a = { 7, 10, 7, 1, 10, 11, 11, 10, 7, 1, 10, 9, 8, 2, 3 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15c, d15c, static_cast(0.125), 15), + static_cast(0.7665435387801205084357966990293734431712e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15c, d15c, static_cast(0.25), 15), + static_cast(0.7179510450452743437979498898508621162489e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15c, d15c, static_cast(0.75), 15), + static_cast(0.7245051156202447814210400449367214490615e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15c, d15c, static_cast(1.0f - 1.0f/64.0f), 15), + static_cast(0.8564567127146107292325365412425895512358e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15c, d15c, static_cast(6.5f), 15), + static_cast(0.8943937154363365123476971638815814742919e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15c, d15c, static_cast(10247.25f), 15), + static_cast(0.6668184674989563469735607034881326982176e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15c, d15c, static_cast(0.125)), + static_cast(0.7665435387801205084357966990293734431712e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15c, d15c, static_cast(0.25)), + static_cast(0.7179510450452743437979498898508621162489e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15c, d15c, static_cast(0.75)), + static_cast(0.7245051156202447814210400449367214490615e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15c, d15c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8564567127146107292325365412425895512358e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15c, d15c, static_cast(6.5f)), + static_cast(0.8943937154363365123476971638815814742919e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15c, d15c, static_cast(10247.25f)), + static_cast(0.6668184674989563469735607034881326982176e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15a, d15a, static_cast(0.125)), + static_cast(0.7665435387801205084357966990293734431712e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15a, d15a, static_cast(0.25)), + static_cast(0.7179510450452743437979498898508621162489e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15a, d15a, static_cast(0.75)), + static_cast(0.7245051156202447814210400449367214490615e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15a, d15a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8564567127146107292325365412425895512358e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15a, d15a, static_cast(6.5f)), + static_cast(0.8943937154363365123476971638815814742919e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n15a, d15a, static_cast(10247.25f)), + static_cast(0.6668184674989563469735607034881326982176e0L), + tolerance); + + // + // Polynomials of order 15 + // + static const U n16c[16] = { 5, 3, 4, 6, 7, 9, 7, 6, 12, 12, 7, 12, 10, 3, 6, 2 }; + static const boost::array n16a = { 5, 3, 4, 6, 7, 9, 7, 6, 12, 12, 7, 12, 10, 3, 6, 2 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16c, static_cast(0.125), 16), + static_cast(0.545123276921327715172083117067813873291e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16c, static_cast(0.25), 16), + static_cast(0.613219709135591983795166015625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16c, static_cast(0.75), 16), + static_cast(0.2195364624075591564178466796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16c, static_cast(1.0f - 1.0f/64.0f), 16), + static_cast(0.9836568924934260045838041177111855604603e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16c, static_cast(6.5), 16), + static_cast(0.474557924297607818603515625e13L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16c, static_cast(0.125)), + static_cast(0.545123276921327715172083117067813873291e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16c, static_cast(0.25)), + static_cast(0.613219709135591983795166015625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16c, static_cast(0.75)), + static_cast(0.2195364624075591564178466796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.9836568924934260045838041177111855604603e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16c, static_cast(6.5)), + static_cast(0.474557924297607818603515625e13L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16a, static_cast(0.125)), + static_cast(0.545123276921327715172083117067813873291e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16a, static_cast(0.25)), + static_cast(0.613219709135591983795166015625e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16a, static_cast(0.75)), + static_cast(0.2195364624075591564178466796875e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.9836568924934260045838041177111855604603e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n16a, static_cast(6.5)), + static_cast(0.474557924297607818603515625e13L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16c, static_cast(0.125), 16), + static_cast(0.5047874876401281302859159688868887179229e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16c, static_cast(0.25), 16), + static_cast(0.5204705680902215943553490440365294489311e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16c, static_cast(0.75), 16), + static_cast(0.1080276729363941941482185615797106947866e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16c, static_cast(1.0f - 1.0f/64.0f), 16), + static_cast(0.8750139513999183433264859554731006794881e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16c, static_cast(6.5f), 16), + static_cast(0.5231073382834479254225049897383445873857e25L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16c, static_cast(0.125)), + static_cast(0.5047874876401281302859159688868887179229e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16c, static_cast(0.25)), + static_cast(0.5204705680902215943553490440365294489311e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16c, static_cast(0.75)), + static_cast(0.1080276729363941941482185615797106947866e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8750139513999183433264859554731006794881e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16c, static_cast(6.5f)), + static_cast(0.5231073382834479254225049897383445873857e25L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16a, static_cast(0.125)), + static_cast(0.5047874876401281302859159688868887179229e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16a, static_cast(0.25)), + static_cast(0.5204705680902215943553490440365294489311e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16a, static_cast(0.75)), + static_cast(0.1080276729363941941482185615797106947866e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8750139513999183433264859554731006794881e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n16a, static_cast(6.5f)), + static_cast(0.5231073382834479254225049897383445873857e25L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(0.125), 16), + static_cast(0.5382999011210250422873277510951097433836e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(0.25), 16), + static_cast(0.5818822723608863774213961761461177957244e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(0.75), 16), + static_cast(0.1273702305818589255309580821062809263822e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(1.0f - 1.0f/64.0f), 16), + static_cast(0.8881094109459487932205571611155308490038e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(6.5f), 16), + static_cast(0.8047805204360737314192426765205301344395e24L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(0.125)), + static_cast(0.5382999011210250422873277510951097433836e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(0.25)), + static_cast(0.5818822723608863774213961761461177957244e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(0.75)), + static_cast(0.1273702305818589255309580821062809263822e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8881094109459487932205571611155308490038e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16c, static_cast(6.5f)), + static_cast(0.8047805204360737314192426765205301344395e24L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16a, static_cast(0.125)), + static_cast(0.5382999011210250422873277510951097433836e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16a, static_cast(0.25)), + static_cast(0.5818822723608863774213961761461177957244e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16a, static_cast(0.75)), + static_cast(0.1273702305818589255309580821062809263822e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8881094109459487932205571611155308490038e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n16a, static_cast(6.5f)), + static_cast(0.8047805204360737314192426765205301344395e24L), + tolerance); + // + // Rational functions of order 15 + // + static const U d16c[16] = { 9, 5, 2, 4, 4, 12, 11, 5, 1, 4, 1, 7, 9, 6, 6, 10 }; + static const boost::array d16a = { 9, 5, 2, 4, 4, 12, 11, 5, 1, 4, 1, 7, 9, 6, 6, 10 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16c, d16c, static_cast(0.125), 16), + static_cast(0.5639916333371058636233240074655101514789e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16c, d16c, static_cast(0.25), 16), + static_cast(0.5858114501425065583332351775671440891069e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16c, d16c, static_cast(0.75), 16), + static_cast(0.9254727283150680371198227978127749853934e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16c, d16c, static_cast(1.0f - 1.0f/64.0f), 16), + static_cast(0.1155192269792597191440811772688208898465e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16c, d16c, static_cast(6.5f), 16), + static_cast(0.2736469218296852258039959401695110274611e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16c, d16c, static_cast(10247.25f), 16), + static_cast(0.2000468408076577399196121638600795513365e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16c, d16c, static_cast(0.125)), + static_cast(0.5639916333371058636233240074655101514789e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16c, d16c, static_cast(0.25)), + static_cast(0.5858114501425065583332351775671440891069e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16c, d16c, static_cast(0.75)), + static_cast(0.9254727283150680371198227978127749853934e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16c, d16c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1155192269792597191440811772688208898465e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16c, d16c, static_cast(6.5f)), + static_cast(0.2736469218296852258039959401695110274611e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16c, d16c, static_cast(10247.25f)), + static_cast(0.2000468408076577399196121638600795513365e0L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16a, d16a, static_cast(0.125)), + static_cast(0.5639916333371058636233240074655101514789e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16a, d16a, static_cast(0.25)), + static_cast(0.5858114501425065583332351775671440891069e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16a, d16a, static_cast(0.75)), + static_cast(0.9254727283150680371198227978127749853934e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16a, d16a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.1155192269792597191440811772688208898465e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16a, d16a, static_cast(6.5f)), + static_cast(0.2736469218296852258039959401695110274611e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n16a, d16a, static_cast(10247.25f)), + static_cast(0.2000468408076577399196121638600795513365e0L), + tolerance); + + // + // Polynomials of order 16 + // + static const U n17c[17] = { 9, 6, 11, 2, 9, 10, 6, 3, 3, 3, 4, 9, 10, 2, 3, 2, 2 }; + static const boost::array n17a = { 9, 6, 11, 2, 9, 10, 6, 3, 3, 3, 4, 9, 10, 2, 3, 2, 2 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17c, static_cast(0.125), 17), + static_cast(0.9928308216189925872185995103791356086731e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17c, static_cast(0.25), 17), + static_cast(0.112653836444951593875885009765625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17c, static_cast(0.75), 17), + static_cast(0.288157429718412458896636962890625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17c, static_cast(1.0f - 1.0f/64.0f), 17), + static_cast(0.8499409476622319741012411965028222548509e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17c, static_cast(6.5), 17), + static_cast(0.24291309657542805938720703125e14L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17c, static_cast(0.125)), + static_cast(0.9928308216189925872185995103791356086731e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17c, static_cast(0.25)), + static_cast(0.112653836444951593875885009765625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17c, static_cast(0.75)), + static_cast(0.288157429718412458896636962890625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8499409476622319741012411965028222548509e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17c, static_cast(6.5)), + static_cast(0.24291309657542805938720703125e14L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17a, static_cast(0.125)), + static_cast(0.9928308216189925872185995103791356086731e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17a, static_cast(0.25)), + static_cast(0.112653836444951593875885009765625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17a, static_cast(0.75)), + static_cast(0.288157429718412458896636962890625e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8499409476622319741012411965028222548509e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n17a, static_cast(6.5)), + static_cast(0.24291309657542805938720703125e14L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17c, static_cast(0.125), 17), + static_cast(0.9096443722112564415334975111453014308977e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17c, static_cast(0.25), 17), + static_cast(0.9418604266644799371155545586464796770088e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17c, static_cast(0.75), 17), + static_cast(0.1800748238050061998856161277204890325265e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17c, static_cast(1.0f - 1.0f/64.0f), 17), + static_cast(0.7725414891276907880696219594586980069116e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17c, static_cast(6.5f), 17), + static_cast(0.2112416072820759278619692697965107844211e27L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17c, static_cast(0.125)), + static_cast(0.9096443722112564415334975111453014308977e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17c, static_cast(0.25)), + static_cast(0.9418604266644799371155545586464796770088e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17c, static_cast(0.75)), + static_cast(0.1800748238050061998856161277204890325265e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7725414891276907880696219594586980069116e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17c, static_cast(6.5f)), + static_cast(0.2112416072820759278619692697965107844211e27L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17a, static_cast(0.125)), + static_cast(0.9096443722112564415334975111453014308977e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17a, static_cast(0.25)), + static_cast(0.9418604266644799371155545586464796770088e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17a, static_cast(0.75)), + static_cast(0.1800748238050061998856161277204890325265e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7725414891276907880696219594586980069116e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n17a, static_cast(6.5f)), + static_cast(0.2112416072820759278619692697965107844211e27L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(0.125), 17), + static_cast(0.9771549776900515322679800891624114471814e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(0.25), 17), + static_cast(0.1067441706657919748462218234585918708035e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(0.75), 17), + static_cast(0.210099765073341599847488170293985376702e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(1.0f - 1.0f/64.0f), 17), + static_cast(0.7833754810186065148643778635770900387673e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(6.5f), 17), + static_cast(0.3249870881262706582491835681484781298786e26L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(0.125)), + static_cast(0.9771549776900515322679800891624114471814e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(0.25)), + static_cast(0.1067441706657919748462218234585918708035e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(0.75)), + static_cast(0.210099765073341599847488170293985376702e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7833754810186065148643778635770900387673e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17c, static_cast(6.5f)), + static_cast(0.3249870881262706582491835681484781298786e26L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17a, static_cast(0.125)), + static_cast(0.9771549776900515322679800891624114471814e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17a, static_cast(0.25)), + static_cast(0.1067441706657919748462218234585918708035e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17a, static_cast(0.75)), + static_cast(0.210099765073341599847488170293985376702e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7833754810186065148643778635770900387673e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n17a, static_cast(6.5f)), + static_cast(0.3249870881262706582491835681484781298786e26L), + tolerance); + // + // Rational functions of order 16 + // + static const U d17c[17] = { 7, 12, 3, 11, 10, 2, 5, 10, 4, 11, 10, 6, 2, 12, 1, 2, 1 }; + static const boost::array d17a = { 7, 12, 3, 11, 10, 2, 5, 10, 4, 11, 10, 6, 2, 12, 1, 2, 1 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17c, d17c, static_cast(0.125), 17), + static_cast(0.1158375951946763080209403673166347533318e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17c, d17c, static_cast(0.25), 17), + static_cast(0.1082966720285644924561131930917359028989e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17c, d17c, static_cast(0.75), 17), + static_cast(0.9405394059495731884564238556014726773139e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17c, d17c, static_cast(1.0f - 1.0f/64.0f), 17), + static_cast(0.8654376623250381987950547557864849720673e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17c, d17c, static_cast(6.5f), 17), + static_cast(0.1737601600028386310221746538845672721834e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17c, d17c, static_cast(10247.25f), 17), + static_cast(0.1999804873273333726353229695741031917586e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17c, d17c, static_cast(0.125)), + static_cast(0.1158375951946763080209403673166347533318e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17c, d17c, static_cast(0.25)), + static_cast(0.1082966720285644924561131930917359028989e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17c, d17c, static_cast(0.75)), + static_cast(0.9405394059495731884564238556014726773139e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17c, d17c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8654376623250381987950547557864849720673e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17c, d17c, static_cast(6.5f)), + static_cast(0.1737601600028386310221746538845672721834e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17c, d17c, static_cast(10247.25f)), + static_cast(0.1999804873273333726353229695741031917586e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17a, d17a, static_cast(0.125)), + static_cast(0.1158375951946763080209403673166347533318e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17a, d17a, static_cast(0.25)), + static_cast(0.1082966720285644924561131930917359028989e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17a, d17a, static_cast(0.75)), + static_cast(0.9405394059495731884564238556014726773139e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17a, d17a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8654376623250381987950547557864849720673e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17a, d17a, static_cast(6.5f)), + static_cast(0.1737601600028386310221746538845672721834e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n17a, d17a, static_cast(10247.25f)), + static_cast(0.1999804873273333726353229695741031917586e1L), + tolerance); + + // + // Polynomials of order 17 + // + static const U n18c[18] = { 6, 5, 7, 8, 12, 9, 4, 1, 3, 5, 1, 5, 12, 8, 4, 6, 1, 10 }; + static const boost::array n18a = { 6, 5, 7, 8, 12, 9, 4, 1, 3, 5, 1, 5, 12, 8, 4, 6, 1, 10 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18c, static_cast(0.125), 18), + static_cast(0.6753220299099845114199069939786568284035e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18c, static_cast(0.25), 18), + static_cast(0.7869269511546008288860321044921875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18c, static_cast(0.75), 18), + static_cast(0.25590585466590709984302520751953125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18c, static_cast(1.0f - 1.0f/64.0f), 18), + static_cast(0.9432688198514753127308115619023015607828e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18c, static_cast(6.5), 18), + static_cast(0.680830157865510950897216796875e15L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18c, static_cast(0.125)), + static_cast(0.6753220299099845114199069939786568284035e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18c, static_cast(0.25)), + static_cast(0.7869269511546008288860321044921875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18c, static_cast(0.75)), + static_cast(0.25590585466590709984302520751953125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.9432688198514753127308115619023015607828e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18c, static_cast(6.5)), + static_cast(0.680830157865510950897216796875e15L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18a, static_cast(0.125)), + static_cast(0.6753220299099845114199069939786568284035e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18a, static_cast(0.25)), + static_cast(0.7869269511546008288860321044921875e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18a, static_cast(0.75)), + static_cast(0.25590585466590709984302520751953125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.9432688198514753127308115619023015607828e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n18a, static_cast(6.5)), + static_cast(0.680830157865510950897216796875e15L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18c, static_cast(0.125), 18), + static_cast(0.6079865225649211447450201991749585071453e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18c, static_cast(0.25), 18), + static_cast(0.6341988806453956744898332268528529098717e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18c, static_cast(0.75), 18), + static_cast(0.1439378129034890784564674906867431936064e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18c, static_cast(1.0f - 1.0f/64.0f), 18), + static_cast(0.8374908316692411299816073455081075151876e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18c, static_cast(6.5f), 18), + static_cast(0.4367459075155664096657376949959960997093e29L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18c, static_cast(0.125)), + static_cast(0.6079865225649211447450201991749585071453e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18c, static_cast(0.25)), + static_cast(0.6341988806453956744898332268528529098717e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18c, static_cast(0.75)), + static_cast(0.1439378129034890784564674906867431936064e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8374908316692411299816073455081075151876e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18c, static_cast(6.5f)), + static_cast(0.4367459075155664096657376949959960997093e29L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18a, static_cast(0.125)), + static_cast(0.6079865225649211447450201991749585071453e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18a, static_cast(0.25)), + static_cast(0.6341988806453956744898332268528529098717e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18a, static_cast(0.75)), + static_cast(0.1439378129034890784564674906867431936064e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8374908316692411299816073455081075151876e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n18a, static_cast(6.5f)), + static_cast(0.4367459075155664096657376949959960997093e29L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(0.125), 18), + static_cast(0.6638921805193691579601615933996680571626e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(0.25), 18), + static_cast(0.7367955225815826979593329074114116394867e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(0.75), 18), + static_cast(0.1719170838713187712752899875823242581419e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(1.0f - 1.0f/64.0f), 18), + static_cast(0.8498319559814513066479820652780774757461e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(6.5f), 18), + static_cast(0.6719167807931790917934426081938401533989e28L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(0.125)), + static_cast(0.6638921805193691579601615933996680571626e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(0.25)), + static_cast(0.7367955225815826979593329074114116394867e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(0.75)), + static_cast(0.1719170838713187712752899875823242581419e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8498319559814513066479820652780774757461e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18c, static_cast(6.5f)), + static_cast(0.6719167807931790917934426081938401533989e28L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18a, static_cast(0.125)), + static_cast(0.6638921805193691579601615933996680571626e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18a, static_cast(0.25)), + static_cast(0.7367955225815826979593329074114116394867e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18a, static_cast(0.75)), + static_cast(0.1719170838713187712752899875823242581419e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8498319559814513066479820652780774757461e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n18a, static_cast(6.5f)), + static_cast(0.6719167807931790917934426081938401533989e28L), + tolerance); + // + // Rational functions of order 17 + // + static const U d18c[18] = { 6, 2, 11, 2, 12, 4, 1, 5, 7, 12, 5, 7, 5, 7, 5, 7, 2, 9 }; + static const boost::array d18a = { 6, 2, 11, 2, 12, 4, 1, 5, 7, 12, 5, 7, 5, 7, 5, 7, 2, 9 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18c, d18c, static_cast(0.125), 18), + static_cast(0.1050457095586493221315235501384188635425e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18c, d18c, static_cast(0.25), 18), + static_cast(0.1082394733850278225180153358339433604182e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18c, d18c, static_cast(0.75), 18), + static_cast(0.1117650157149023587583496399377426188558e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18c, d18c, static_cast(1.0f - 1.0f/64.0f), 18), + static_cast(0.9882013696252427983431096654690843223851e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18c, d18c, static_cast(6.5f), 18), + static_cast(0.1086348665080997883580887205673821889245e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18c, d18c, static_cast(10247.25f), 18), + static_cast(0.1111097856940394090609547290690047016487e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18c, d18c, static_cast(0.125)), + static_cast(0.1050457095586493221315235501384188635425e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18c, d18c, static_cast(0.25)), + static_cast(0.1082394733850278225180153358339433604182e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18c, d18c, static_cast(0.75)), + static_cast(0.1117650157149023587583496399377426188558e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18c, d18c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.9882013696252427983431096654690843223851e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18c, d18c, static_cast(6.5f)), + static_cast(0.1086348665080997883580887205673821889245e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18c, d18c, static_cast(10247.25f)), + static_cast(0.1111097856940394090609547290690047016487e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18a, d18a, static_cast(0.125)), + static_cast(0.1050457095586493221315235501384188635425e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18a, d18a, static_cast(0.25)), + static_cast(0.1082394733850278225180153358339433604182e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18a, d18a, static_cast(0.75)), + static_cast(0.1117650157149023587583496399377426188558e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18a, d18a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.9882013696252427983431096654690843223851e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18a, d18a, static_cast(6.5f)), + static_cast(0.1086348665080997883580887205673821889245e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n18a, d18a, static_cast(10247.25f)), + static_cast(0.1111097856940394090609547290690047016487e1L), + tolerance); + + // + // Polynomials of order 18 + // + static const U n19c[19] = { 7, 2, 4, 2, 4, 3, 9, 1, 9, 3, 7, 2, 10, 4, 2, 5, 11, 3, 9 }; + static const boost::array n19a = { 7, 2, 4, 2, 4, 3, 9, 1, 9, 3, 7, 2, 10, 4, 2, 5, 11, 3, 9 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19c, static_cast(0.125), 19), + static_cast(0.7317509740045990140888676478425622917712e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19c, static_cast(0.25), 19), + static_cast(0.7802219584656995721161365509033203125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19c, static_cast(0.75), 19), + static_cast(0.17609299321266007609665393829345703125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19c, static_cast(1.0f - 1.0f/64.0f), 19), + static_cast(0.8327888521934174049333133442289010778727e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19c, static_cast(6.5), 19), + static_cast(0.4179028813935817562572479248046875e16L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19c, static_cast(0.125)), + static_cast(0.7317509740045990140888676478425622917712e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19c, static_cast(0.25)), + static_cast(0.7802219584656995721161365509033203125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19c, static_cast(0.75)), + static_cast(0.17609299321266007609665393829345703125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8327888521934174049333133442289010778727e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19c, static_cast(6.5)), + static_cast(0.4179028813935817562572479248046875e16L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19a, static_cast(0.125)), + static_cast(0.7317509740045990140888676478425622917712e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19a, static_cast(0.25)), + static_cast(0.7802219584656995721161365509033203125e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19a, static_cast(0.75)), + static_cast(0.17609299321266007609665393829345703125e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8327888521934174049333133442289010778727e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_polynomial(n19a, static_cast(6.5)), + static_cast(0.4179028813935817562572479248046875e16L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19c, static_cast(0.125), 19), + static_cast(0.7032234433238304833197011488540991991734e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19c, static_cast(0.25), 19), + static_cast(0.7141177719741940632063571816842174888595e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19c, static_cast(0.75), 19), + static_cast(0.107671418972012709727788225142148040292e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19c, static_cast(1.0f - 1.0f/64.0f), 19), + static_cast(0.7205306905267900876445365429703520869133e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19c, static_cast(6.5f), 19), + static_cast(0.1670453627683043936397442394984734181614e31L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19c, static_cast(0.125)), + static_cast(0.7032234433238304833197011488540991991734e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19c, static_cast(0.25)), + static_cast(0.7141177719741940632063571816842174888595e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19c, static_cast(0.75)), + static_cast(0.107671418972012709727788225142148040292e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7205306905267900876445365429703520869133e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19c, static_cast(6.5f)), + static_cast(0.1670453627683043936397442394984734181614e31L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19a, static_cast(0.125)), + static_cast(0.7032234433238304833197011488540991991734e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19a, static_cast(0.25)), + static_cast(0.7141177719741940632063571816842174888595e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19a, static_cast(0.75)), + static_cast(0.107671418972012709727788225142148040292e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7205306905267900876445365429703520869133e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_even_polynomial(n19a, static_cast(6.5f)), + static_cast(0.1670453627683043936397442394984734181614e31L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(0.125), 19), + static_cast(0.7257875465906438665576091908327935933871e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(0.25), 19), + static_cast(0.7564710878967762528254287267368699554382e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(0.75), 19), + static_cast(0.120228558629350279637050966856197387056e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(1.0f - 1.0f/64.0f), 19), + static_cast(0.7308565745034058033214339484143259295627e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(6.5f), 19), + static_cast(0.2569928657973913748303757530804975664022e30L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(0.125)), + static_cast(0.7257875465906438665576091908327935933871e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(0.25)), + static_cast(0.7564710878967762528254287267368699554382e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(0.75)), + static_cast(0.120228558629350279637050966856197387056e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7308565745034058033214339484143259295627e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19c, static_cast(6.5f)), + static_cast(0.2569928657973913748303757530804975664022e30L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19a, static_cast(0.125)), + static_cast(0.7257875465906438665576091908327935933871e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19a, static_cast(0.25)), + static_cast(0.7564710878967762528254287267368699554382e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19a, static_cast(0.75)), + static_cast(0.120228558629350279637050966856197387056e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.7308565745034058033214339484143259295627e2L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_odd_polynomial(n19a, static_cast(6.5f)), + static_cast(0.2569928657973913748303757530804975664022e30L), + tolerance); + // + // Rational functions of order 18 + // + static const U d19c[19] = { 3, 2, 3, 3, 10, 6, 2, 6, 9, 8, 8, 10, 5, 7, 6, 4, 6, 9, 7 }; + static const boost::array d19a = { 3, 2, 3, 3, 10, 6, 2, 6, 9, 8, 8, 10, 5, 7, 6, 4, 6, 9, 7 }; + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19c, d19c, static_cast(0.125), 19), + static_cast(0.2213824709533496994632324982010106870288e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19c, d19c, static_cast(0.25), 19), + static_cast(0.2063899260318829004588039751781791436716e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19c, d19c, static_cast(0.75), 19), + static_cast(0.1085337280046506127330919833145641152667e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19c, d19c, static_cast(1.0f - 1.0f/64.0f), 19), + static_cast(0.8530644127293554041631338796773621506306e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19c, d19c, static_cast(6.5f), 19), + static_cast(0.1140014406058131768268407547610620204626e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19c, d19c, static_cast(10247.25f), 19), + static_cast(0.1285594810697167354761598106316532892359e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19c, d19c, static_cast(0.125)), + static_cast(0.2213824709533496994632324982010106870288e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19c, d19c, static_cast(0.25)), + static_cast(0.2063899260318829004588039751781791436716e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19c, d19c, static_cast(0.75)), + static_cast(0.1085337280046506127330919833145641152667e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19c, d19c, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8530644127293554041631338796773621506306e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19c, d19c, static_cast(6.5f)), + static_cast(0.1140014406058131768268407547610620204626e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19c, d19c, static_cast(10247.25f)), + static_cast(0.1285594810697167354761598106316532892359e1L), + tolerance); + + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19a, d19a, static_cast(0.125)), + static_cast(0.2213824709533496994632324982010106870288e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19a, d19a, static_cast(0.25)), + static_cast(0.2063899260318829004588039751781791436716e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19a, d19a, static_cast(0.75)), + static_cast(0.1085337280046506127330919833145641152667e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19a, d19a, static_cast(1.0f - 1.0f/64.0f)), + static_cast(0.8530644127293554041631338796773621506306e0L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19a, d19a, static_cast(6.5f)), + static_cast(0.1140014406058131768268407547610620204626e1L), + tolerance); + BOOST_CHECK_CLOSE( + boost::math::tools::evaluate_rational(n19a, d19a, static_cast(10247.25f)), + static_cast(0.1285594810697167354761598106316532892359e1L), + tolerance); +} + +#endif diff --git a/test/test_rational_double.cpp b/test/test_rational_double.cpp index 11e4d6964..5a4f369ee 100644 --- a/test/test_rational_double.cpp +++ b/test/test_rational_double.cpp @@ -1,19 +1,19 @@ - -#include -#include -#include -#include - -#include "test_rational.hpp" - -void test_spots(double t, const char* n) -{ - std::cout << "Testing basic sanity checks for type " << n << std::endl; - do_test_spots(t, int(0)); - do_test_spots(t, unsigned(0)); -#ifdef BOOST_HAS_LONG_LONG - do_test_spots(t, (unsigned long long)(0)); -#endif - do_test_spots(t, float(0)); - do_test_spots(t, double(0)); -} + +#include +#include +#include +#include + +#include "test_rational.hpp" + +void test_spots(double t, const char* n) +{ + std::cout << "Testing basic sanity checks for type " << n << std::endl; + do_test_spots(t, int(0)); + do_test_spots(t, unsigned(0)); +#ifdef BOOST_HAS_LONG_LONG + do_test_spots(t, (unsigned long long)(0)); +#endif + do_test_spots(t, float(0)); + do_test_spots(t, double(0)); +} diff --git a/test/test_rational_float.cpp b/test/test_rational_float.cpp index e0e527ead..a186a76f8 100644 --- a/test/test_rational_float.cpp +++ b/test/test_rational_float.cpp @@ -1,19 +1,19 @@ - -#include -#include -#include -#include - -#include "test_rational.hpp" - -void test_spots(float t, const char* n) -{ - std::cout << "Testing basic sanity checks for type " << n << std::endl; - do_test_spots(t, int(0)); - do_test_spots(t, unsigned(0)); -#ifdef BOOST_HAS_LONG_LONG - do_test_spots(t, (unsigned long long)(0)); -#endif - do_test_spots(t, float(0)); - do_test_spots(t, float(0)); -} + +#include +#include +#include +#include + +#include "test_rational.hpp" + +void test_spots(float t, const char* n) +{ + std::cout << "Testing basic sanity checks for type " << n << std::endl; + do_test_spots(t, int(0)); + do_test_spots(t, unsigned(0)); +#ifdef BOOST_HAS_LONG_LONG + do_test_spots(t, (unsigned long long)(0)); +#endif + do_test_spots(t, float(0)); + do_test_spots(t, float(0)); +} diff --git a/test/test_rational_ldouble.cpp b/test/test_rational_ldouble.cpp index ea5e7f442..4adfab97c 100644 --- a/test/test_rational_ldouble.cpp +++ b/test/test_rational_ldouble.cpp @@ -1,19 +1,19 @@ - -#include -#include -#include -#include - -#include "test_rational.hpp" - -void test_spots(long double t, const char* n) -{ - std::cout << "Testing basic sanity checks for type " << n << std::endl; - do_test_spots(t, int(0)); - do_test_spots(t, unsigned(0)); -#ifdef BOOST_HAS_LONG_LONG - do_test_spots(t, (unsigned long long)(0)); -#endif - do_test_spots(t, float(0)); - do_test_spots(t, static_cast(0)); -} + +#include +#include +#include +#include + +#include "test_rational.hpp" + +void test_spots(long double t, const char* n) +{ + std::cout << "Testing basic sanity checks for type " << n << std::endl; + do_test_spots(t, int(0)); + do_test_spots(t, unsigned(0)); +#ifdef BOOST_HAS_LONG_LONG + do_test_spots(t, (unsigned long long)(0)); +#endif + do_test_spots(t, float(0)); + do_test_spots(t, static_cast(0)); +} diff --git a/tools/generate_rational_code.cpp b/tools/generate_rational_code.cpp index dd559e409..090175f84 100644 --- a/tools/generate_rational_code.cpp +++ b/tools/generate_rational_code.cpp @@ -1,738 +1,738 @@ -// (C) Copyright John Maddock 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#include -#include -#include -#include -#include - -int max_order = 20; -const char* path_prefix = "..\\..\\..\\boost\\math\\tools\\detail\\polynomial_"; -const char* path_prefix2 = "..\\..\\..\\boost\\math\\tools\\detail\\rational_"; - -const char* copyright_string = -"// (C) Copyright John Maddock 2007.\n" -"// Use, modification and distribution are subject to the\n" -"// Boost Software License, Version 1.0. (See accompanying file\n" -"// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" -"//\n" -"// This file is machine generated, do not edit by hand\n\n"; - - -void print_polynomials(int max_order) -{ - for(int i = 2; i <= max_order; ++i) - { - std::stringstream filename; - filename << path_prefix << "horner1_" << i << ".hpp"; - std::ofstream ofs(filename.str().c_str()); - if(ofs.bad()) - break; - // - // Output the boilerplate at the top of the header: - // - ofs << copyright_string << - "// Polynomial evaluation using Horners rule\n" - "#ifndef BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n" - "#define BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n\n" - "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)\n" - "{\n" - " return static_cast(0);\n" - "}\n" - "\n" - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)\n" - "{\n" - " return static_cast(a[0]);\n" - "}\n\n"; - - for(int order = 2; order <= i; ++order) - { - ofs << - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<" << order << ">*)\n" - "{\n" - " return static_cast("; - - for(int bracket = 2; bracket < order; ++bracket) - ofs << "("; - ofs << "a[" << order - 1 << "] * x + a[" << order - 2 << "]" ; - for(int item = order - 3; item >= 0; --item) - { - ofs << ") * x + a[" << item << "]"; - } - - ofs << ");\n" - "}\n\n"; - } - // - // And finally the boilerplate at the end of the header: - // - ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n"; - - filename.str(""); - filename << path_prefix << "horner2_" << i << ".hpp"; - ofs.close(); - ofs.open(filename.str().c_str()); - if(ofs.bad()) - break; - // - // Output the boilerplate at the top of the header: - // - ofs << copyright_string << - "// Polynomial evaluation using second order Horners rule\n" - "#ifndef BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n" - "#define BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n\n" - "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)\n" - "{\n" - " return static_cast(0);\n" - "}\n" - "\n" - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)\n" - "{\n" - " return static_cast(a[0]);\n" - "}\n\n" - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)\n" - "{\n" - " return static_cast(a[1] * x + a[0]);\n" - "}\n\n" - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)\n" - "{\n" - " return static_cast((a[2] * x + a[1]) * x + a[0]);\n" - "}\n\n" - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)\n" - "{\n" - " return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);\n" - "}\n\n"; - - for(int order = 5; order <= i; ++order) - { - ofs << - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<" << order << ">*)\n" - "{\n" - " V x2 = x * x;\n" - " return static_cast("; - - if(order & 1) - { - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "a[" << order - 1 << "] * x2 + a[" << order - 3 << "]" ; - for(int item = order - 5; item >= 0; item -= 2) - { - ofs << ") * x2 + a[" << item << "]"; - } - ofs << " + "; - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "a[" << order - 2 << "] * x2 + a[" << order - 4 << "]" ; - for(int item = order - 6; item >= 0; item -= 2) - { - ofs << ") * x2 + a[" << item << "]"; - } - ofs << ") * x"; - } - else - { - for(int bracket = 0; bracket < (order - 1) / 2; ++bracket) - ofs << "("; - ofs << "a[" << order - 1 << "] * x2 + a[" << order - 3 << "]" ; - for(int item = order - 5; item >= 0; item -= 2) - { - ofs << ") * x2 + a[" << item << "]"; - } - ofs << ") * x + "; - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "a[" << order - 2 << "] * x2 + a[" << order - 4 << "]" ; - for(int item = order - 6; item >= 0; item -= 2) - { - ofs << ") * x2 + a[" << item << "]"; - } - } - ofs << ");\n" - "}\n\n"; - } - // - // And finally the boilerplate at the end of the header: - // - ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n"; - - - filename.str(""); - filename << path_prefix << "horner3_" << i << ".hpp"; - ofs.close(); - ofs.open(filename.str().c_str()); - if(ofs.bad()) - break; - // - // Output the boilerplate at the top of the header: - // - ofs << copyright_string << - "// Unrolled polynomial evaluation using second order Horners rule\n" - "#ifndef BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n" - "#define BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n\n" - "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)\n" - "{\n" - " return static_cast(0);\n" - "}\n" - "\n" - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)\n" - "{\n" - " return static_cast(a[0]);\n" - "}\n\n" - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)\n" - "{\n" - " return static_cast(a[1] * x + a[0]);\n" - "}\n\n" - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)\n" - "{\n" - " return static_cast((a[2] * x + a[1]) * x + a[0]);\n" - "}\n\n" - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)\n" - "{\n" - " return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);\n" - "}\n\n"; - - for(int order = 5; order <= i; ++order) - { - ofs << - "template \n" - "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<" << order << ">*)\n" - "{\n" - " V x2 = x * x;\n" - " V t[2];\n"; - - if(order & 1) - { - ofs << " t[0] = static_cast(a[" << order - 1 << "] * x2 + a[" << order - 3 << "]);\n" ; - ofs << " t[1] = static_cast(a[" << order - 2 << "] * x2 + a[" << order - 4 << "]);\n" ; - for(int item = order - 5; item >= 0; item -= 2) - { - ofs << " t[0] *= x2;\n"; - if(item - 1 >= 0) - ofs << " t[1] *= x2;\n"; - ofs << " t[0] += static_cast(a[" << item << "]);\n"; - if(item - 1 >= 0) - ofs << " t[1] += static_cast(a[" << item - 1 << "]);\n"; - } - ofs << - " t[1] *= x;\n" - " return t[0] + t[1];\n"; - } - else - { - ofs << " t[0] = a[" << order - 1 << "] * x2 + a[" << order - 3 << "];\n" ; - ofs << " t[1] = a[" << order - 2 << "] * x2 + a[" << order - 4 << "];\n" ; - for(int item = order - 5; item >= 0; item -= 2) - { - ofs << " t[0] *= x2;\n"; - if(item - 1 >= 0) - ofs << " t[1] *= x2;\n"; - ofs << " t[0] += static_cast(a[" << item << "]);\n"; - if(item - 1 >= 0) - ofs << " t[1] += static_cast(a[" << item - 1 << "]);\n"; - } - ofs << " t[0] *= x;\n"; - ofs << " return t[0] + t[1];\n"; - } - ofs << "}\n\n"; - } - // - // And finally the boilerplate at the end of the header: - // - ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n"; - } -} - -void print_rationals(int max_order) -{ - for(int i = 2; i <= max_order; ++i) - { - std::stringstream filename; - filename << path_prefix2 << "horner1_" << i << ".hpp"; - std::ofstream ofs(filename.str().c_str()); - if(ofs.bad()) - break; - // - // Output the boilerplate at the top of the header: - // - ofs << copyright_string << - "// Polynomial evaluation using Horners rule\n" - "#ifndef BOOST_MATH_TOOLS_POLY_RAT_" << i << "_HPP\n" - "#define BOOST_MATH_TOOLS_POLY_RAT_" << i << "_HPP\n\n" - "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" - "template \n" - "inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)\n" - "{\n" - " return static_cast(0);\n" - "}\n" - "\n" - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)\n" - "{\n" - " return static_cast(a[0]) / static_cast(b[0]);\n" - "}\n\n"; - - for(int order = 2; order <= i; ++order) - { - ofs << - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<" << order << ">*)\n" - "{\n" - " if(x <= 1)\n" - " return static_cast(("; - - for(int bracket = 2; bracket < order; ++bracket) - ofs << "("; - ofs << "a[" << order - 1 << "] * x + a[" << order - 2 << "]" ; - for(int item = order - 3; item >= 0; --item) - { - ofs << ") * x + a[" << item << "]"; - } - - ofs << ") / ("; - for(int bracket = 2; bracket < order; ++bracket) - ofs << "("; - ofs << "b[" << order - 1 << "] * x + b[" << order - 2 << "]" ; - for(int item = order - 3; item >= 0; --item) - { - ofs << ") * x + b[" << item << "]"; - } - - ofs << "));\n else\n {\n V z = 1 / x;\n return static_cast(("; - - for(int bracket = order - 1; bracket > 1; --bracket) - ofs << "("; - ofs << "a[" << 0 << "] * z + a[" << 1 << "]" ; - for(int item = 2; item <= order - 1; ++item) - { - ofs << ") * z + a[" << item << "]"; - } - - ofs << ") / ("; - for(int bracket = 2; bracket < order; ++bracket) - ofs << "("; - ofs << "b[" << 0 << "] * z + b[" << 1 << "]" ; - for(int item = 2; item <= order - 1; ++item) - { - ofs << ") * z + b[" << item << "]"; - } - - ofs << "));\n }\n"; - - ofs << "}\n\n"; - } - // - // And finally the boilerplate at the end of the header: - // - ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n"; - - filename.str(""); - filename << path_prefix2 << "horner2_" << i << ".hpp"; - ofs.close(); - ofs.open(filename.str().c_str()); - if(ofs.bad()) - break; - // - // Output the boilerplate at the top of the header: - // - ofs << copyright_string << - "// Polynomial evaluation using second order Horners rule\n" - "#ifndef BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n" - "#define BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n\n" - "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)\n" - "{\n" - " return static_cast(0);\n" - "}\n" - "\n" - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)\n" - "{\n" - " return static_cast(a[0]) / static_cast(b[0]);\n" - "}\n\n" - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)\n" - "{\n" - " return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0]));\n" - "}\n\n" - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)\n" - "{\n" - " return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));\n" - "}\n\n" - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)\n" - "{\n" - " return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));\n" - "}\n\n"; - - for(int order = 5; order <= i; ++order) - { - ofs << - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<" << order << ">*)\n" - "{\n" - " if(x <= 1)\n {\n" - " V x2 = x * x;\n" - " return static_cast(("; - - if(order & 1) - { - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "a[" << order - 1 << "] * x2 + a[" << order - 3 << "]" ; - for(int item = order - 5; item >= 0; item -= 2) - { - ofs << ") * x2 + a[" << item << "]"; - } - ofs << " + "; - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "a[" << order - 2 << "] * x2 + a[" << order - 4 << "]" ; - for(int item = order - 6; item >= 0; item -= 2) - { - ofs << ") * x2 + a[" << item << "]"; - } - ofs << ") * x"; - } - else - { - for(int bracket = 0; bracket < (order - 1) / 2; ++bracket) - ofs << "("; - ofs << "a[" << order - 1 << "] * x2 + a[" << order - 3 << "]" ; - for(int item = order - 5; item >= 0; item -= 2) - { - ofs << ") * x2 + a[" << item << "]"; - } - ofs << ") * x + "; - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "a[" << order - 2 << "] * x2 + a[" << order - 4 << "]" ; - for(int item = order - 6; item >= 0; item -= 2) - { - ofs << ") * x2 + a[" << item << "]"; - } - } - ofs << ") / ("; - if(order & 1) - { - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "b[" << order - 1 << "] * x2 + b[" << order - 3 << "]" ; - for(int item = order - 5; item >= 0; item -= 2) - { - ofs << ") * x2 + b[" << item << "]"; - } - ofs << " + "; - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "b[" << order - 2 << "] * x2 + b[" << order - 4 << "]" ; - for(int item = order - 6; item >= 0; item -= 2) - { - ofs << ") * x2 + b[" << item << "]"; - } - ofs << ") * x"; - } - else - { - for(int bracket = 0; bracket < (order - 1) / 2; ++bracket) - ofs << "("; - ofs << "b[" << order - 1 << "] * x2 + b[" << order - 3 << "]" ; - for(int item = order - 5; item >= 0; item -= 2) - { - ofs << ") * x2 + b[" << item << "]"; - } - ofs << ") * x + "; - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "b[" << order - 2 << "] * x2 + b[" << order - 4 << "]" ; - for(int item = order - 6; item >= 0; item -= 2) - { - ofs << ") * x2 + b[" << item << "]"; - } - } - - ofs << "));\n }\n else\n {\n V z = 1 / x;\n V z2 = 1 / (x * x);\n return static_cast(("; - - if(order & 1) - { - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "a[" << 0 << "] * z2 + a[" << 2 << "]" ; - for(int item = 4; item < order; item += 2) - { - ofs << ") * z2 + a[" << item << "]"; - } - ofs << " + "; - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "a[" << 1 << "] * z2 + a[" << 3 << "]" ; - for(int item = 5; item < order; item += 2) - { - ofs << ") * z2 + a[" << item << "]"; - } - ofs << ") * z"; - } - else - { - for(int bracket = 0; bracket < (order - 1) / 2; ++bracket) - ofs << "("; - ofs << "a[" << 0 << "] * z2 + a[" << 2 << "]" ; - for(int item = 4; item < order; item += 2) - { - ofs << ") * z2 + a[" << item << "]"; - } - ofs << ") * z + "; - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "a[" << 1 << "] * z2 + a[" << 3 << "]" ; - for(int item = 5; item < order; item += 2) - { - ofs << ") * z2 + a[" << item << "]"; - } - } - - ofs << ") / ("; - - if(order & 1) - { - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "b[" << 0 << "] * z2 + b[" << 2 << "]" ; - for(int item = 4; item < order; item += 2) - { - ofs << ") * z2 + b[" << item << "]"; - } - ofs << " + "; - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "b[" << 1 << "] * z2 + b[" << 3 << "]" ; - for(int item = 5; item < order; item += 2) - { - ofs << ") * z2 + b[" << item << "]"; - } - ofs << ") * z"; - } - else - { - for(int bracket = 0; bracket < (order - 1) / 2; ++bracket) - ofs << "("; - ofs << "b[" << 0 << "] * z2 + b[" << 2 << "]" ; - for(int item = 4; item < order; item += 2) - { - ofs << ") * z2 + b[" << item << "]"; - } - ofs << ") * z + "; - for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) - ofs << "("; - ofs << "b[" << 1 << "] * z2 + b[" << 3 << "]" ; - for(int item = 5; item < order; item += 2) - { - ofs << ") * z2 + b[" << item << "]"; - } - } - ofs << "));\n }\n"; - - ofs << "}\n\n"; - } - // - // And finally the boilerplate at the end of the header: - // - ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n"; - - - filename.str(""); - filename << path_prefix2 << "horner3_" << i << ".hpp"; - ofs.close(); - ofs.open(filename.str().c_str()); - if(ofs.bad()) - break; - // - // Output the boilerplate at the top of the header: - // - ofs << copyright_string << - "// Polynomial evaluation using second order Horners rule\n" - "#ifndef BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n" - "#define BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n\n" - "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)\n" - "{\n" - " return static_cast(0);\n" - "}\n" - "\n" - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)\n" - "{\n" - " return static_cast(a[0]) / static_cast(b[0]);\n" - "}\n\n" - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)\n" - "{\n" - " return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0]));\n" - "}\n\n" - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)\n" - "{\n" - " return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));\n" - "}\n\n" - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)\n" - "{\n" - " return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));\n" - "}\n\n"; - - for(int order = 5; order <= i; ++order) - { - ofs << - "template \n" - "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<" << order << ">*)\n" - "{\n" - " if(x <= 1)\n {\n" - " V x2 = x * x;\n" - " V t[4];\n"; - - if(order & 1) - { - ofs << " t[0] = a[" << order - 1 << "] * x2 + a[" << order - 3 << "];\n" ; - ofs << " t[1] = a[" << order - 2 << "] * x2 + a[" << order - 4 << "];\n" ; - ofs << " t[2] = b[" << order - 1 << "] * x2 + b[" << order - 3 << "];\n" ; - ofs << " t[3] = b[" << order - 2 << "] * x2 + b[" << order - 4 << "];\n" ; - for(int item = order - 5; item >= 0; item -= 2) - { - ofs << " t[0] *= x2;\n"; - if(item - 1 >= 0) - ofs << " t[1] *= x2;\n"; - ofs << " t[2] *= x2;\n"; - if(item - 1 >= 0) - ofs << " t[3] *= x2;\n"; - ofs << " t[0] += static_cast(a[" << item << "]);\n"; - if(item - 1 >= 0) - ofs << " t[1] += static_cast(a[" << item - 1 << "]);\n"; - ofs << " t[2] += static_cast(b[" << item << "]);\n"; - if(item - 1 >= 0) - ofs << " t[3] += static_cast(b[" << item - 1 << "]);\n"; - } - ofs << " t[1] *= x;\n"; - ofs << " t[3] *= x;\n"; - } - else - { - ofs << " t[0] = a[" << order - 1 << "] * x2 + a[" << order - 3 << "];\n" ; - ofs << " t[1] = a[" << order - 2 << "] * x2 + a[" << order - 4 << "];\n" ; - ofs << " t[2] = b[" << order - 1 << "] * x2 + b[" << order - 3 << "];\n" ; - ofs << " t[3] = b[" << order - 2 << "] * x2 + b[" << order - 4 << "];\n" ; - for(int item = order - 5; item >= 0; item -= 2) - { - ofs << " t[0] *= x2;\n"; - if(item - 1 >= 0) - ofs << " t[1] *= x2;\n"; - ofs << " t[2] *= x2;\n"; - if(item - 1 >= 0) - ofs << " t[3] *= x2;\n"; - ofs << " t[0] += static_cast(a[" << item << "]);\n"; - if(item - 1 >= 0) - ofs << " t[1] += static_cast(a[" << item - 1 << "]);\n"; - ofs << " t[2] += static_cast(b[" << item << "]);\n"; - if(item - 1 >= 0) - ofs << " t[3] += static_cast(b[" << item - 1 << "]);\n"; - } - ofs << " t[0] *= x;\n"; - ofs << " t[2] *= x;\n"; - } - ofs << " return (t[0] + t[1]) / (t[2] + t[3]);\n"; - - ofs << " }\n else\n {\n V z = 1 / x;\n V z2 = 1 / (x * x);\n V t[4];\n"; - - if(order & 1) - { - ofs << " t[0] = a[" << 0 << "] * z2 + a[" << 2 << "];\n" ; - ofs << " t[1] = a[" << 1 << "] * z2 + a[" << 3 << "];\n" ; - ofs << " t[2] = b[" << 0 << "] * z2 + b[" << 2 << "];\n" ; - ofs << " t[3] = b[" << 1 << "] * z2 + b[" << 3 << "];\n" ; - for(int item = 4; item < order; item += 2) - { - ofs << " t[0] *= z2;\n"; - if(item + 1 < order) - ofs << " t[1] *= z2;\n"; - ofs << " t[2] *= z2;\n"; - if(item + 1 < order) - ofs << " t[3] *= z2;\n"; - ofs << " t[0] += static_cast(a[" << item << "]);\n"; - if(item + 1 < order) - ofs << " t[1] += static_cast(a[" << item + 1 << "]);\n"; - ofs << " t[2] += static_cast(b[" << item << "]);\n"; - if(item + 1 < order) - ofs << " t[3] += static_cast(b[" << item + 1 << "]);\n"; - } - ofs << " t[1] *= z;\n"; - ofs << " t[3] *= z;\n"; - } - else - { - ofs << " t[0] = a[" << 0 << "] * z2 + a[" << 2 << "];\n" ; - ofs << " t[1] = a[" << 1 << "] * z2 + a[" << 3 << "];\n" ; - ofs << " t[2] = b[" << 0 << "] * z2 + b[" << 2 << "];\n" ; - ofs << " t[3] = b[" << 1 << "] * z2 + b[" << 3 << "];\n" ; - for(int item = 4; item < order; item += 2) - { - ofs << " t[0] *= z2;\n"; - if(item + 1 < order) - ofs << " t[1] *= z2;\n"; - ofs << " t[2] *= z2;\n"; - if(item + 1 < order) - ofs << " t[3] *= z2;\n"; - ofs << " t[0] += static_cast(a[" << item << "]);\n"; - if(item + 1 < order) - ofs << " t[1] += static_cast(a[" << item + 1 << "]);\n"; - ofs << " t[2] += static_cast(b[" << item << "]);\n"; - if(item + 1 < order) - ofs << " t[3] += static_cast(b[" << item + 1 << "]);\n"; - } - ofs << " t[0] *= z;\n"; - ofs << " t[2] *= z;\n"; - } - ofs << " return (t[0] + t[1]) / (t[2] + t[3]);\n }\n"; - - ofs << "}\n\n"; - } - // - // And finally the boilerplate at the end of the header: - // - ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n"; - } -} - -int main() -{ - for(int i = 2; i <= max_order; ++i) - { - print_polynomials(i); - print_rationals(i); - } - return 0; -} - - - +// (C) Copyright John Maddock 2007. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include +#include + +int max_order = 20; +const char* path_prefix = "..\\..\\..\\boost\\math\\tools\\detail\\polynomial_"; +const char* path_prefix2 = "..\\..\\..\\boost\\math\\tools\\detail\\rational_"; + +const char* copyright_string = +"// (C) Copyright John Maddock 2007.\n" +"// Use, modification and distribution are subject to the\n" +"// Boost Software License, Version 1.0. (See accompanying file\n" +"// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" +"//\n" +"// This file is machine generated, do not edit by hand\n\n"; + + +void print_polynomials(int max_order) +{ + for(int i = 2; i <= max_order; ++i) + { + std::stringstream filename; + filename << path_prefix << "horner1_" << i << ".hpp"; + std::ofstream ofs(filename.str().c_str()); + if(ofs.bad()) + break; + // + // Output the boilerplate at the top of the header: + // + ofs << copyright_string << + "// Polynomial evaluation using Horners rule\n" + "#ifndef BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n" + "#define BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n\n" + "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)\n" + "{\n" + " return static_cast(0);\n" + "}\n" + "\n" + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)\n" + "{\n" + " return static_cast(a[0]);\n" + "}\n\n"; + + for(int order = 2; order <= i; ++order) + { + ofs << + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<" << order << ">*)\n" + "{\n" + " return static_cast("; + + for(int bracket = 2; bracket < order; ++bracket) + ofs << "("; + ofs << "a[" << order - 1 << "] * x + a[" << order - 2 << "]" ; + for(int item = order - 3; item >= 0; --item) + { + ofs << ") * x + a[" << item << "]"; + } + + ofs << ");\n" + "}\n\n"; + } + // + // And finally the boilerplate at the end of the header: + // + ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n"; + + filename.str(""); + filename << path_prefix << "horner2_" << i << ".hpp"; + ofs.close(); + ofs.open(filename.str().c_str()); + if(ofs.bad()) + break; + // + // Output the boilerplate at the top of the header: + // + ofs << copyright_string << + "// Polynomial evaluation using second order Horners rule\n" + "#ifndef BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n" + "#define BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n\n" + "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)\n" + "{\n" + " return static_cast(0);\n" + "}\n" + "\n" + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)\n" + "{\n" + " return static_cast(a[0]);\n" + "}\n\n" + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)\n" + "{\n" + " return static_cast(a[1] * x + a[0]);\n" + "}\n\n" + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)\n" + "{\n" + " return static_cast((a[2] * x + a[1]) * x + a[0]);\n" + "}\n\n" + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)\n" + "{\n" + " return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);\n" + "}\n\n"; + + for(int order = 5; order <= i; ++order) + { + ofs << + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<" << order << ">*)\n" + "{\n" + " V x2 = x * x;\n" + " return static_cast("; + + if(order & 1) + { + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "a[" << order - 1 << "] * x2 + a[" << order - 3 << "]" ; + for(int item = order - 5; item >= 0; item -= 2) + { + ofs << ") * x2 + a[" << item << "]"; + } + ofs << " + "; + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "a[" << order - 2 << "] * x2 + a[" << order - 4 << "]" ; + for(int item = order - 6; item >= 0; item -= 2) + { + ofs << ") * x2 + a[" << item << "]"; + } + ofs << ") * x"; + } + else + { + for(int bracket = 0; bracket < (order - 1) / 2; ++bracket) + ofs << "("; + ofs << "a[" << order - 1 << "] * x2 + a[" << order - 3 << "]" ; + for(int item = order - 5; item >= 0; item -= 2) + { + ofs << ") * x2 + a[" << item << "]"; + } + ofs << ") * x + "; + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "a[" << order - 2 << "] * x2 + a[" << order - 4 << "]" ; + for(int item = order - 6; item >= 0; item -= 2) + { + ofs << ") * x2 + a[" << item << "]"; + } + } + ofs << ");\n" + "}\n\n"; + } + // + // And finally the boilerplate at the end of the header: + // + ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n"; + + + filename.str(""); + filename << path_prefix << "horner3_" << i << ".hpp"; + ofs.close(); + ofs.open(filename.str().c_str()); + if(ofs.bad()) + break; + // + // Output the boilerplate at the top of the header: + // + ofs << copyright_string << + "// Unrolled polynomial evaluation using second order Horners rule\n" + "#ifndef BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n" + "#define BOOST_MATH_TOOLS_POLY_EVAL_" << i << "_HPP\n\n" + "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<0>*)\n" + "{\n" + " return static_cast(0);\n" + "}\n" + "\n" + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)\n" + "{\n" + " return static_cast(a[0]);\n" + "}\n\n" + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)\n" + "{\n" + " return static_cast(a[1] * x + a[0]);\n" + "}\n\n" + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)\n" + "{\n" + " return static_cast((a[2] * x + a[1]) * x + a[0]);\n" + "}\n\n" + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)\n" + "{\n" + " return static_cast(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);\n" + "}\n\n"; + + for(int order = 5; order <= i; ++order) + { + ofs << + "template \n" + "inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<" << order << ">*)\n" + "{\n" + " V x2 = x * x;\n" + " V t[2];\n"; + + if(order & 1) + { + ofs << " t[0] = static_cast(a[" << order - 1 << "] * x2 + a[" << order - 3 << "]);\n" ; + ofs << " t[1] = static_cast(a[" << order - 2 << "] * x2 + a[" << order - 4 << "]);\n" ; + for(int item = order - 5; item >= 0; item -= 2) + { + ofs << " t[0] *= x2;\n"; + if(item - 1 >= 0) + ofs << " t[1] *= x2;\n"; + ofs << " t[0] += static_cast(a[" << item << "]);\n"; + if(item - 1 >= 0) + ofs << " t[1] += static_cast(a[" << item - 1 << "]);\n"; + } + ofs << + " t[1] *= x;\n" + " return t[0] + t[1];\n"; + } + else + { + ofs << " t[0] = a[" << order - 1 << "] * x2 + a[" << order - 3 << "];\n" ; + ofs << " t[1] = a[" << order - 2 << "] * x2 + a[" << order - 4 << "];\n" ; + for(int item = order - 5; item >= 0; item -= 2) + { + ofs << " t[0] *= x2;\n"; + if(item - 1 >= 0) + ofs << " t[1] *= x2;\n"; + ofs << " t[0] += static_cast(a[" << item << "]);\n"; + if(item - 1 >= 0) + ofs << " t[1] += static_cast(a[" << item - 1 << "]);\n"; + } + ofs << " t[0] *= x;\n"; + ofs << " return t[0] + t[1];\n"; + } + ofs << "}\n\n"; + } + // + // And finally the boilerplate at the end of the header: + // + ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n"; + } +} + +void print_rationals(int max_order) +{ + for(int i = 2; i <= max_order; ++i) + { + std::stringstream filename; + filename << path_prefix2 << "horner1_" << i << ".hpp"; + std::ofstream ofs(filename.str().c_str()); + if(ofs.bad()) + break; + // + // Output the boilerplate at the top of the header: + // + ofs << copyright_string << + "// Polynomial evaluation using Horners rule\n" + "#ifndef BOOST_MATH_TOOLS_POLY_RAT_" << i << "_HPP\n" + "#define BOOST_MATH_TOOLS_POLY_RAT_" << i << "_HPP\n\n" + "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" + "template \n" + "inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*)\n" + "{\n" + " return static_cast(0);\n" + "}\n" + "\n" + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)\n" + "{\n" + " return static_cast(a[0]) / static_cast(b[0]);\n" + "}\n\n"; + + for(int order = 2; order <= i; ++order) + { + ofs << + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<" << order << ">*)\n" + "{\n" + " if(x <= 1)\n" + " return static_cast(("; + + for(int bracket = 2; bracket < order; ++bracket) + ofs << "("; + ofs << "a[" << order - 1 << "] * x + a[" << order - 2 << "]" ; + for(int item = order - 3; item >= 0; --item) + { + ofs << ") * x + a[" << item << "]"; + } + + ofs << ") / ("; + for(int bracket = 2; bracket < order; ++bracket) + ofs << "("; + ofs << "b[" << order - 1 << "] * x + b[" << order - 2 << "]" ; + for(int item = order - 3; item >= 0; --item) + { + ofs << ") * x + b[" << item << "]"; + } + + ofs << "));\n else\n {\n V z = 1 / x;\n return static_cast(("; + + for(int bracket = order - 1; bracket > 1; --bracket) + ofs << "("; + ofs << "a[" << 0 << "] * z + a[" << 1 << "]" ; + for(int item = 2; item <= order - 1; ++item) + { + ofs << ") * z + a[" << item << "]"; + } + + ofs << ") / ("; + for(int bracket = 2; bracket < order; ++bracket) + ofs << "("; + ofs << "b[" << 0 << "] * z + b[" << 1 << "]" ; + for(int item = 2; item <= order - 1; ++item) + { + ofs << ") * z + b[" << item << "]"; + } + + ofs << "));\n }\n"; + + ofs << "}\n\n"; + } + // + // And finally the boilerplate at the end of the header: + // + ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n"; + + filename.str(""); + filename << path_prefix2 << "horner2_" << i << ".hpp"; + ofs.close(); + ofs.open(filename.str().c_str()); + if(ofs.bad()) + break; + // + // Output the boilerplate at the top of the header: + // + ofs << copyright_string << + "// Polynomial evaluation using second order Horners rule\n" + "#ifndef BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n" + "#define BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n\n" + "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)\n" + "{\n" + " return static_cast(0);\n" + "}\n" + "\n" + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)\n" + "{\n" + " return static_cast(a[0]) / static_cast(b[0]);\n" + "}\n\n" + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)\n" + "{\n" + " return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0]));\n" + "}\n\n" + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)\n" + "{\n" + " return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));\n" + "}\n\n" + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)\n" + "{\n" + " return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));\n" + "}\n\n"; + + for(int order = 5; order <= i; ++order) + { + ofs << + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<" << order << ">*)\n" + "{\n" + " if(x <= 1)\n {\n" + " V x2 = x * x;\n" + " return static_cast(("; + + if(order & 1) + { + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "a[" << order - 1 << "] * x2 + a[" << order - 3 << "]" ; + for(int item = order - 5; item >= 0; item -= 2) + { + ofs << ") * x2 + a[" << item << "]"; + } + ofs << " + "; + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "a[" << order - 2 << "] * x2 + a[" << order - 4 << "]" ; + for(int item = order - 6; item >= 0; item -= 2) + { + ofs << ") * x2 + a[" << item << "]"; + } + ofs << ") * x"; + } + else + { + for(int bracket = 0; bracket < (order - 1) / 2; ++bracket) + ofs << "("; + ofs << "a[" << order - 1 << "] * x2 + a[" << order - 3 << "]" ; + for(int item = order - 5; item >= 0; item -= 2) + { + ofs << ") * x2 + a[" << item << "]"; + } + ofs << ") * x + "; + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "a[" << order - 2 << "] * x2 + a[" << order - 4 << "]" ; + for(int item = order - 6; item >= 0; item -= 2) + { + ofs << ") * x2 + a[" << item << "]"; + } + } + ofs << ") / ("; + if(order & 1) + { + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "b[" << order - 1 << "] * x2 + b[" << order - 3 << "]" ; + for(int item = order - 5; item >= 0; item -= 2) + { + ofs << ") * x2 + b[" << item << "]"; + } + ofs << " + "; + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "b[" << order - 2 << "] * x2 + b[" << order - 4 << "]" ; + for(int item = order - 6; item >= 0; item -= 2) + { + ofs << ") * x2 + b[" << item << "]"; + } + ofs << ") * x"; + } + else + { + for(int bracket = 0; bracket < (order - 1) / 2; ++bracket) + ofs << "("; + ofs << "b[" << order - 1 << "] * x2 + b[" << order - 3 << "]" ; + for(int item = order - 5; item >= 0; item -= 2) + { + ofs << ") * x2 + b[" << item << "]"; + } + ofs << ") * x + "; + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "b[" << order - 2 << "] * x2 + b[" << order - 4 << "]" ; + for(int item = order - 6; item >= 0; item -= 2) + { + ofs << ") * x2 + b[" << item << "]"; + } + } + + ofs << "));\n }\n else\n {\n V z = 1 / x;\n V z2 = 1 / (x * x);\n return static_cast(("; + + if(order & 1) + { + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "a[" << 0 << "] * z2 + a[" << 2 << "]" ; + for(int item = 4; item < order; item += 2) + { + ofs << ") * z2 + a[" << item << "]"; + } + ofs << " + "; + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "a[" << 1 << "] * z2 + a[" << 3 << "]" ; + for(int item = 5; item < order; item += 2) + { + ofs << ") * z2 + a[" << item << "]"; + } + ofs << ") * z"; + } + else + { + for(int bracket = 0; bracket < (order - 1) / 2; ++bracket) + ofs << "("; + ofs << "a[" << 0 << "] * z2 + a[" << 2 << "]" ; + for(int item = 4; item < order; item += 2) + { + ofs << ") * z2 + a[" << item << "]"; + } + ofs << ") * z + "; + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "a[" << 1 << "] * z2 + a[" << 3 << "]" ; + for(int item = 5; item < order; item += 2) + { + ofs << ") * z2 + a[" << item << "]"; + } + } + + ofs << ") / ("; + + if(order & 1) + { + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "b[" << 0 << "] * z2 + b[" << 2 << "]" ; + for(int item = 4; item < order; item += 2) + { + ofs << ") * z2 + b[" << item << "]"; + } + ofs << " + "; + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "b[" << 1 << "] * z2 + b[" << 3 << "]" ; + for(int item = 5; item < order; item += 2) + { + ofs << ") * z2 + b[" << item << "]"; + } + ofs << ") * z"; + } + else + { + for(int bracket = 0; bracket < (order - 1) / 2; ++bracket) + ofs << "("; + ofs << "b[" << 0 << "] * z2 + b[" << 2 << "]" ; + for(int item = 4; item < order; item += 2) + { + ofs << ") * z2 + b[" << item << "]"; + } + ofs << ") * z + "; + for(int bracket = 0; bracket < (order - 1) / 2 - 1; ++bracket) + ofs << "("; + ofs << "b[" << 1 << "] * z2 + b[" << 3 << "]" ; + for(int item = 5; item < order; item += 2) + { + ofs << ") * z2 + b[" << item << "]"; + } + } + ofs << "));\n }\n"; + + ofs << "}\n\n"; + } + // + // And finally the boilerplate at the end of the header: + // + ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n"; + + + filename.str(""); + filename << path_prefix2 << "horner3_" << i << ".hpp"; + ofs.close(); + ofs.open(filename.str().c_str()); + if(ofs.bad()) + break; + // + // Output the boilerplate at the top of the header: + // + ofs << copyright_string << + "// Polynomial evaluation using second order Horners rule\n" + "#ifndef BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n" + "#define BOOST_MATH_TOOLS_RAT_EVAL_" << i << "_HPP\n\n" + "namespace boost{ namespace math{ namespace tools{ namespace detail{\n\n" + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<0>*)\n" + "{\n" + " return static_cast(0);\n" + "}\n" + "\n" + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*)\n" + "{\n" + " return static_cast(a[0]) / static_cast(b[0]);\n" + "}\n\n" + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*)\n" + "{\n" + " return static_cast((a[1] * x + a[0]) / (b[1] * x + b[0]));\n" + "}\n\n" + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*)\n" + "{\n" + " return static_cast(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));\n" + "}\n\n" + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*)\n" + "{\n" + " return static_cast((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));\n" + "}\n\n"; + + for(int order = 5; order <= i; ++order) + { + ofs << + "template \n" + "inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<" << order << ">*)\n" + "{\n" + " if(x <= 1)\n {\n" + " V x2 = x * x;\n" + " V t[4];\n"; + + if(order & 1) + { + ofs << " t[0] = a[" << order - 1 << "] * x2 + a[" << order - 3 << "];\n" ; + ofs << " t[1] = a[" << order - 2 << "] * x2 + a[" << order - 4 << "];\n" ; + ofs << " t[2] = b[" << order - 1 << "] * x2 + b[" << order - 3 << "];\n" ; + ofs << " t[3] = b[" << order - 2 << "] * x2 + b[" << order - 4 << "];\n" ; + for(int item = order - 5; item >= 0; item -= 2) + { + ofs << " t[0] *= x2;\n"; + if(item - 1 >= 0) + ofs << " t[1] *= x2;\n"; + ofs << " t[2] *= x2;\n"; + if(item - 1 >= 0) + ofs << " t[3] *= x2;\n"; + ofs << " t[0] += static_cast(a[" << item << "]);\n"; + if(item - 1 >= 0) + ofs << " t[1] += static_cast(a[" << item - 1 << "]);\n"; + ofs << " t[2] += static_cast(b[" << item << "]);\n"; + if(item - 1 >= 0) + ofs << " t[3] += static_cast(b[" << item - 1 << "]);\n"; + } + ofs << " t[1] *= x;\n"; + ofs << " t[3] *= x;\n"; + } + else + { + ofs << " t[0] = a[" << order - 1 << "] * x2 + a[" << order - 3 << "];\n" ; + ofs << " t[1] = a[" << order - 2 << "] * x2 + a[" << order - 4 << "];\n" ; + ofs << " t[2] = b[" << order - 1 << "] * x2 + b[" << order - 3 << "];\n" ; + ofs << " t[3] = b[" << order - 2 << "] * x2 + b[" << order - 4 << "];\n" ; + for(int item = order - 5; item >= 0; item -= 2) + { + ofs << " t[0] *= x2;\n"; + if(item - 1 >= 0) + ofs << " t[1] *= x2;\n"; + ofs << " t[2] *= x2;\n"; + if(item - 1 >= 0) + ofs << " t[3] *= x2;\n"; + ofs << " t[0] += static_cast(a[" << item << "]);\n"; + if(item - 1 >= 0) + ofs << " t[1] += static_cast(a[" << item - 1 << "]);\n"; + ofs << " t[2] += static_cast(b[" << item << "]);\n"; + if(item - 1 >= 0) + ofs << " t[3] += static_cast(b[" << item - 1 << "]);\n"; + } + ofs << " t[0] *= x;\n"; + ofs << " t[2] *= x;\n"; + } + ofs << " return (t[0] + t[1]) / (t[2] + t[3]);\n"; + + ofs << " }\n else\n {\n V z = 1 / x;\n V z2 = 1 / (x * x);\n V t[4];\n"; + + if(order & 1) + { + ofs << " t[0] = a[" << 0 << "] * z2 + a[" << 2 << "];\n" ; + ofs << " t[1] = a[" << 1 << "] * z2 + a[" << 3 << "];\n" ; + ofs << " t[2] = b[" << 0 << "] * z2 + b[" << 2 << "];\n" ; + ofs << " t[3] = b[" << 1 << "] * z2 + b[" << 3 << "];\n" ; + for(int item = 4; item < order; item += 2) + { + ofs << " t[0] *= z2;\n"; + if(item + 1 < order) + ofs << " t[1] *= z2;\n"; + ofs << " t[2] *= z2;\n"; + if(item + 1 < order) + ofs << " t[3] *= z2;\n"; + ofs << " t[0] += static_cast(a[" << item << "]);\n"; + if(item + 1 < order) + ofs << " t[1] += static_cast(a[" << item + 1 << "]);\n"; + ofs << " t[2] += static_cast(b[" << item << "]);\n"; + if(item + 1 < order) + ofs << " t[3] += static_cast(b[" << item + 1 << "]);\n"; + } + ofs << " t[1] *= z;\n"; + ofs << " t[3] *= z;\n"; + } + else + { + ofs << " t[0] = a[" << 0 << "] * z2 + a[" << 2 << "];\n" ; + ofs << " t[1] = a[" << 1 << "] * z2 + a[" << 3 << "];\n" ; + ofs << " t[2] = b[" << 0 << "] * z2 + b[" << 2 << "];\n" ; + ofs << " t[3] = b[" << 1 << "] * z2 + b[" << 3 << "];\n" ; + for(int item = 4; item < order; item += 2) + { + ofs << " t[0] *= z2;\n"; + if(item + 1 < order) + ofs << " t[1] *= z2;\n"; + ofs << " t[2] *= z2;\n"; + if(item + 1 < order) + ofs << " t[3] *= z2;\n"; + ofs << " t[0] += static_cast(a[" << item << "]);\n"; + if(item + 1 < order) + ofs << " t[1] += static_cast(a[" << item + 1 << "]);\n"; + ofs << " t[2] += static_cast(b[" << item << "]);\n"; + if(item + 1 < order) + ofs << " t[3] += static_cast(b[" << item + 1 << "]);\n"; + } + ofs << " t[0] *= z;\n"; + ofs << " t[2] *= z;\n"; + } + ofs << " return (t[0] + t[1]) / (t[2] + t[3]);\n }\n"; + + ofs << "}\n\n"; + } + // + // And finally the boilerplate at the end of the header: + // + ofs << "\n}}}} // namespaces\n\n#endif // include guard\n\n"; + } +} + +int main() +{ + for(int i = 2; i <= max_order; ++i) + { + print_polynomials(i); + print_rationals(i); + } + return 0; +} + + + diff --git a/tune/main.cpp b/tune/main.cpp index d54c66446..b47908b02 100644 --- a/tune/main.cpp +++ b/tune/main.cpp @@ -1,123 +1,123 @@ - -#include -#include -#include "../performance/performance_measure.hpp" -#include "../performance/test_reference.cpp" - -extern void polynomial_evaluate_0(); -extern void polynomial_evaluate_1(); -extern void polynomial_evaluate_2(); -extern void polynomial_evaluate_3(); -extern void polynomial_evaluate_m0(); -extern void polynomial_evaluate_m1(); -extern void polynomial_evaluate_m2(); -extern void polynomial_evaluate_m3(); -extern void rational_evaluate_0(); -extern void rational_evaluate_1(); -extern void rational_evaluate_2(); -extern void rational_evaluate_3(); -extern void rational_evaluate_m0(); -extern void rational_evaluate_m1(); -extern void rational_evaluate_m2(); -extern void rational_evaluate_m3(); - -double total = 0; - -int main(int argc) -{ - double reference_time = performance_measure(reference_evaluate); - double test_time; - - std::cout << std::setprecision(3); - - // - // BOOST_MATH_POLY_METHOD: - // - std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_POLY_METHOD=0"; - test_time = performance_measure(polynomial_evaluate_0); - std::cout << test_time - reference_time << std::endl; - - std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_POLY_METHOD=1"; - test_time = performance_measure(polynomial_evaluate_1); - std::cout << test_time - reference_time << std::endl; - - std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_POLY_METHOD=2"; - test_time = performance_measure(polynomial_evaluate_2); - std::cout << test_time - reference_time << std::endl; - - std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_POLY_METHOD=3"; - test_time = performance_measure(polynomial_evaluate_3); - std::cout << test_time - reference_time << std::endl; - // - // Mixed polynomial Arithmetic: - // - std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_POLY_METHOD=0"; - test_time = performance_measure(polynomial_evaluate_0); - std::cout << test_time - reference_time << std::endl; - - std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_POLY_METHOD=1"; - test_time = performance_measure(polynomial_evaluate_1); - std::cout << test_time - reference_time << std::endl; - - std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_POLY_METHOD=2"; - test_time = performance_measure(polynomial_evaluate_2); - std::cout << test_time - reference_time << std::endl; - - std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_POLY_METHOD=3"; - test_time = performance_measure(polynomial_evaluate_3); - std::cout << test_time - reference_time << std::endl; - - // - // BOOST_MATH_RATIONAL_METHOD: - // - std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_RATIONAL_METHOD=0"; - test_time = performance_measure(rational_evaluate_0); - std::cout << test_time - reference_time << std::endl; - - std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_RATIONAL_METHOD=1"; - test_time = performance_measure(rational_evaluate_1); - std::cout << test_time - reference_time << std::endl; - - std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_RATIONAL_METHOD=2"; - test_time = performance_measure(rational_evaluate_2); - std::cout << test_time - reference_time << std::endl; - - std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_RATIONAL_METHOD=3"; - test_time = performance_measure(rational_evaluate_3); - std::cout << test_time - reference_time << std::endl; - // - // Mixed rational Arithmetic: - // - std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_RATIONAL_METHOD=0"; - test_time = performance_measure(rational_evaluate_0); - std::cout << test_time - reference_time << std::endl; - - std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_RATIONAL_METHOD=1"; - test_time = performance_measure(rational_evaluate_1); - std::cout << test_time - reference_time << std::endl; - - std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_RATIONAL_METHOD=2"; - test_time = performance_measure(rational_evaluate_2); - std::cout << test_time - reference_time << std::endl; - - std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_RATIONAL_METHOD=3"; - test_time = performance_measure(rational_evaluate_3); - std::cout << test_time - reference_time << std::endl; - - if(argc > 100000) - std::cerr << total << std::endl; - - return 0; -} - - -void consume_result(double x) -{ - // Do nothing proceedure, don't let whole program optimisation - // optimise this away - doing so may cause false readings.... - total += x; -} - -void set_call_count(int i) -{} - + +#include +#include +#include "../performance/performance_measure.hpp" +#include "../performance/test_reference.cpp" + +extern void polynomial_evaluate_0(); +extern void polynomial_evaluate_1(); +extern void polynomial_evaluate_2(); +extern void polynomial_evaluate_3(); +extern void polynomial_evaluate_m0(); +extern void polynomial_evaluate_m1(); +extern void polynomial_evaluate_m2(); +extern void polynomial_evaluate_m3(); +extern void rational_evaluate_0(); +extern void rational_evaluate_1(); +extern void rational_evaluate_2(); +extern void rational_evaluate_3(); +extern void rational_evaluate_m0(); +extern void rational_evaluate_m1(); +extern void rational_evaluate_m2(); +extern void rational_evaluate_m3(); + +double total = 0; + +int main(int argc) +{ + double reference_time = performance_measure(reference_evaluate); + double test_time; + + std::cout << std::setprecision(3); + + // + // BOOST_MATH_POLY_METHOD: + // + std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_POLY_METHOD=0"; + test_time = performance_measure(polynomial_evaluate_0); + std::cout << test_time - reference_time << std::endl; + + std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_POLY_METHOD=1"; + test_time = performance_measure(polynomial_evaluate_1); + std::cout << test_time - reference_time << std::endl; + + std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_POLY_METHOD=2"; + test_time = performance_measure(polynomial_evaluate_2); + std::cout << test_time - reference_time << std::endl; + + std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_POLY_METHOD=3"; + test_time = performance_measure(polynomial_evaluate_3); + std::cout << test_time - reference_time << std::endl; + // + // Mixed polynomial Arithmetic: + // + std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_POLY_METHOD=0"; + test_time = performance_measure(polynomial_evaluate_0); + std::cout << test_time - reference_time << std::endl; + + std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_POLY_METHOD=1"; + test_time = performance_measure(polynomial_evaluate_1); + std::cout << test_time - reference_time << std::endl; + + std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_POLY_METHOD=2"; + test_time = performance_measure(polynomial_evaluate_2); + std::cout << test_time - reference_time << std::endl; + + std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_POLY_METHOD=3"; + test_time = performance_measure(polynomial_evaluate_3); + std::cout << test_time - reference_time << std::endl; + + // + // BOOST_MATH_RATIONAL_METHOD: + // + std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_RATIONAL_METHOD=0"; + test_time = performance_measure(rational_evaluate_0); + std::cout << test_time - reference_time << std::endl; + + std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_RATIONAL_METHOD=1"; + test_time = performance_measure(rational_evaluate_1); + std::cout << test_time - reference_time << std::endl; + + std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_RATIONAL_METHOD=2"; + test_time = performance_measure(rational_evaluate_2); + std::cout << test_time - reference_time << std::endl; + + std::cout << std::setw(70) << std::left << std::scientific << "Testing BOOST_MATH_RATIONAL_METHOD=3"; + test_time = performance_measure(rational_evaluate_3); + std::cout << test_time - reference_time << std::endl; + // + // Mixed rational Arithmetic: + // + std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_RATIONAL_METHOD=0"; + test_time = performance_measure(rational_evaluate_0); + std::cout << test_time - reference_time << std::endl; + + std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_RATIONAL_METHOD=1"; + test_time = performance_measure(rational_evaluate_1); + std::cout << test_time - reference_time << std::endl; + + std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_RATIONAL_METHOD=2"; + test_time = performance_measure(rational_evaluate_2); + std::cout << test_time - reference_time << std::endl; + + std::cout << std::setw(70) << std::left << std::scientific << "Testing int/double arithmetic with BOOST_MATH_RATIONAL_METHOD=3"; + test_time = performance_measure(rational_evaluate_3); + std::cout << test_time - reference_time << std::endl; + + if(argc > 100000) + std::cerr << total << std::endl; + + return 0; +} + + +void consume_result(double x) +{ + // Do nothing proceedure, don't let whole program optimisation + // optimise this away - doing so may cause false readings.... + total += x; +} + +void set_call_count(int i) +{} + diff --git a/tune/polynomial.cpp b/tune/polynomial.cpp index 9602779f1..ea6cecea1 100644 --- a/tune/polynomial.cpp +++ b/tune/polynomial.cpp @@ -1,397 +1,397 @@ - -#include "../performance/performance_measure.hpp" -#include - -static const double num[13] = { - static_cast(56906521.91347156388090791033559122686859L), - static_cast(103794043.1163445451906271053616070238554L), - static_cast(86363131.28813859145546927288977868422342L), - static_cast(43338889.32467613834773723740590533316085L), - static_cast(14605578.08768506808414169982791359218571L), - static_cast(3481712.15498064590882071018964774556468L), - static_cast(601859.6171681098786670226533699352302507L), - static_cast(75999.29304014542649875303443598909137092L), - static_cast(6955.999602515376140356310115515198987526L), - static_cast(449.9445569063168119446858607650988409623L), - static_cast(19.51992788247617482847860966235652136208L), - static_cast(0.5098416655656676188125178644804694509993L), - static_cast(0.006061842346248906525783753964555936883222L) -}; -static const double denom[13] = { - static_cast(0u), - static_cast(39916800u), - static_cast(120543840u), - static_cast(150917976u), - static_cast(105258076u), - static_cast(45995730u), - static_cast(13339535u), - static_cast(2637558u), - static_cast(357423u), - static_cast(32670u), - static_cast(1925u), - static_cast(66u), - static_cast(1u) -}; -static const boost::uint32_t denom_int[13] = { - static_cast(0u), - static_cast(39916800u), - static_cast(120543840u), - static_cast(150917976u), - static_cast(105258076u), - static_cast(45995730u), - static_cast(13339535u), - static_cast(2637558u), - static_cast(357423u), - static_cast(32670u), - static_cast(1925u), - static_cast(66u), - static_cast(1u) -}; - -template -U evaluate_polynomial_0(const T* poly, U const& z, std::size_t count) -{ - U sum = static_cast(poly[count - 1]); - for(int i = static_cast(count) - 2; i >= 0; --i) - { - sum *= z; - sum += static_cast(poly[i]); - } - return sum; -} - -template -inline V evaluate_polynomial_1(const T* a, const V& x) -{ - return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); -} - -template -inline V evaluate_polynomial_2(const T* a, const V& x) -{ - V x2 = x * x; - return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); -} - -template -inline V evaluate_polynomial_3(const T* a, const V& x) -{ - V x2 = x * x; - V t[2]; - t[0] = static_cast(a[12] * x2 + a[10]); - t[1] = static_cast(a[11] * x2 + a[9]); - t[0] *= x2; - t[1] *= x2; - t[0] += a[8]; - t[1] += a[7]; - t[0] *= x2; - t[1] *= x2; - t[0] += a[6]; - t[1] += a[5]; - t[0] *= x2; - t[1] *= x2; - t[0] += a[4]; - t[1] += a[3]; - t[0] *= x2; - t[1] *= x2; - t[0] += a[2]; - t[1] += a[1]; - t[0] *= x2; - t[0] += a[0]; - t[1] *= x; - return t[0] + t[1]; -} - -template -V evaluate_rational_0(const T* num, const U* denom, const V& z_, std::size_t count) -{ - V z(z_); - V s1, s2; - if(z <= 1) - { - s1 = static_cast(num[count-1]); - s2 = static_cast(denom[count-1]); - for(int i = (int)count - 2; i >= 0; --i) - { - s1 *= z; - s2 *= z; - s1 += num[i]; - s2 += denom[i]; - } - } - else - { - z = 1 / z; - s1 = static_cast(num[0]); - s2 = static_cast(denom[0]); - for(unsigned i = 1; i < count; ++i) - { - s1 *= z; - s2 *= z; - s1 += num[i]; - s2 += denom[i]; - } - } - return s1 / s2; -} - -template -inline V evaluate_rational_1(const T* a, const U* b, const V& x) -{ - if(x <= 1) - return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); - else - { - V z = 1 / x; - return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); - } -} - -template -inline V evaluate_rational_2(const T* a, const U* b, const V& x) -{ - if(x <= 1) - { - V x2 = x * x; - return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); - } -} - -template -inline V evaluate_rational_3(const T* a, const U* b, const V& x) -{ - if(x <= 1) - { - V x2 = x * x; - V t[4]; - t[0] = a[12] * x2 + a[10]; - t[1] = a[11] * x2 + a[9]; - t[2] = b[12] * x2 + b[10]; - t[3] = b[11] * x2 + b[9]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += a[8]; - t[1] += a[7]; - t[2] += b[8]; - t[3] += b[7]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += a[6]; - t[1] += a[5]; - t[2] += b[6]; - t[3] += b[5]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += a[4]; - t[1] += a[3]; - t[2] += b[4]; - t[3] += b[3]; - t[0] *= x2; - t[1] *= x2; - t[2] *= x2; - t[3] *= x2; - t[0] += a[2]; - t[1] += a[1]; - t[2] += b[2]; - t[3] += b[1]; - t[0] *= x2; - t[2] *= x2; - t[0] += a[0]; - t[2] += b[0]; - t[1] *= x; - t[3] *= x; - return (t[0] + t[1]) / (t[2] + t[3]); - } - else - { - V z = 1 / x; - V z2 = 1 / (x * x); - V t[4]; - t[0] = a[0] * z2 + a[2]; - t[1] = a[1] * z2 + a[3]; - t[2] = b[0] * z2 + b[2]; - t[3] = b[1] * z2 + b[3]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += a[4]; - t[1] += a[5]; - t[2] += b[4]; - t[3] += b[5]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += a[6]; - t[1] += a[7]; - t[2] += b[6]; - t[3] += b[7]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += a[8]; - t[1] += a[9]; - t[2] += b[8]; - t[3] += b[9]; - t[0] *= z2; - t[1] *= z2; - t[2] *= z2; - t[3] *= z2; - t[0] += a[10]; - t[1] += a[11]; - t[2] += b[10]; - t[3] += b[11]; - t[0] *= z2; - t[2] *= z2; - t[0] += a[12]; - t[2] += b[12]; - t[1] *= z; - t[3] *= z; - return (t[0] + t[1]) / (t[2] + t[3]); - } -} - - - -void polynomial_evaluate_0() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_polynomial_0(num, i, 13) / evaluate_polynomial_0(denom, i, 13); - consume_result(result); -} - -void polynomial_evaluate_1() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_polynomial_1(num, i) / evaluate_polynomial_1(denom, i); - consume_result(result); -} - -void polynomial_evaluate_2() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_polynomial_2(num, i) / evaluate_polynomial_2(denom, i); - consume_result(result); -} - -void polynomial_evaluate_3() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_polynomial_3(num, i) / evaluate_polynomial_3(denom, i); - consume_result(result); -} - -void polynomial_evaluate_m0() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_polynomial_0(num, i, 13) / evaluate_polynomial_0(denom_int, i, 13); - consume_result(result); -} - -void polynomial_evaluate_m1() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_polynomial_1(num, i) / evaluate_polynomial_1(denom_int, i); - consume_result(result); -} - -void polynomial_evaluate_m2() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_polynomial_2(num, i) / evaluate_polynomial_2(denom_int, i); - consume_result(result); -} - -void polynomial_evaluate_m3() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_polynomial_3(num, i) / evaluate_polynomial_3(denom_int, i); - consume_result(result); -} - -void rational_evaluate_0() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_rational_0(num, denom, i, 13); - consume_result(result); -} - -void rational_evaluate_1() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_rational_1(num, denom, i); - consume_result(result); -} - -void rational_evaluate_2() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_rational_2(num, denom, i); - consume_result(result); -} - -void rational_evaluate_3() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_rational_3(num, denom, i); - consume_result(result); -} - -void rational_evaluate_m0() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_rational_0(num, denom_int, i, 13); - consume_result(result); -} - -void rational_evaluate_m1() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_rational_1(num, denom_int, i); - consume_result(result); -} - -void rational_evaluate_m2() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_rational_2(num, denom_int, i); - consume_result(result); -} - -void rational_evaluate_m3() -{ - double result = 0; - for(double i = 1; i < 100; i += 0.5) - result += evaluate_rational_3(num, denom_int, i); - consume_result(result); -} - + +#include "../performance/performance_measure.hpp" +#include + +static const double num[13] = { + static_cast(56906521.91347156388090791033559122686859L), + static_cast(103794043.1163445451906271053616070238554L), + static_cast(86363131.28813859145546927288977868422342L), + static_cast(43338889.32467613834773723740590533316085L), + static_cast(14605578.08768506808414169982791359218571L), + static_cast(3481712.15498064590882071018964774556468L), + static_cast(601859.6171681098786670226533699352302507L), + static_cast(75999.29304014542649875303443598909137092L), + static_cast(6955.999602515376140356310115515198987526L), + static_cast(449.9445569063168119446858607650988409623L), + static_cast(19.51992788247617482847860966235652136208L), + static_cast(0.5098416655656676188125178644804694509993L), + static_cast(0.006061842346248906525783753964555936883222L) +}; +static const double denom[13] = { + static_cast(0u), + static_cast(39916800u), + static_cast(120543840u), + static_cast(150917976u), + static_cast(105258076u), + static_cast(45995730u), + static_cast(13339535u), + static_cast(2637558u), + static_cast(357423u), + static_cast(32670u), + static_cast(1925u), + static_cast(66u), + static_cast(1u) +}; +static const boost::uint32_t denom_int[13] = { + static_cast(0u), + static_cast(39916800u), + static_cast(120543840u), + static_cast(150917976u), + static_cast(105258076u), + static_cast(45995730u), + static_cast(13339535u), + static_cast(2637558u), + static_cast(357423u), + static_cast(32670u), + static_cast(1925u), + static_cast(66u), + static_cast(1u) +}; + +template +U evaluate_polynomial_0(const T* poly, U const& z, std::size_t count) +{ + U sum = static_cast(poly[count - 1]); + for(int i = static_cast(count) - 2; i >= 0; --i) + { + sum *= z; + sum += static_cast(poly[i]); + } + return sum; +} + +template +inline V evaluate_polynomial_1(const T* a, const V& x) +{ + return static_cast((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]); +} + +template +inline V evaluate_polynomial_2(const T* a, const V& x) +{ + V x2 = x * x; + return static_cast((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x); +} + +template +inline V evaluate_polynomial_3(const T* a, const V& x) +{ + V x2 = x * x; + V t[2]; + t[0] = static_cast(a[12] * x2 + a[10]); + t[1] = static_cast(a[11] * x2 + a[9]); + t[0] *= x2; + t[1] *= x2; + t[0] += a[8]; + t[1] += a[7]; + t[0] *= x2; + t[1] *= x2; + t[0] += a[6]; + t[1] += a[5]; + t[0] *= x2; + t[1] *= x2; + t[0] += a[4]; + t[1] += a[3]; + t[0] *= x2; + t[1] *= x2; + t[0] += a[2]; + t[1] += a[1]; + t[0] *= x2; + t[0] += a[0]; + t[1] *= x; + return t[0] + t[1]; +} + +template +V evaluate_rational_0(const T* num, const U* denom, const V& z_, std::size_t count) +{ + V z(z_); + V s1, s2; + if(z <= 1) + { + s1 = static_cast(num[count-1]); + s2 = static_cast(denom[count-1]); + for(int i = (int)count - 2; i >= 0; --i) + { + s1 *= z; + s2 *= z; + s1 += num[i]; + s2 += denom[i]; + } + } + else + { + z = 1 / z; + s1 = static_cast(num[0]); + s2 = static_cast(denom[0]); + for(unsigned i = 1; i < count; ++i) + { + s1 *= z; + s2 *= z; + s1 += num[i]; + s2 += denom[i]; + } + } + return s1 / s2; +} + +template +inline V evaluate_rational_1(const T* a, const U* b, const V& x) +{ + if(x <= 1) + return static_cast(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0])); + else + { + V z = 1 / x; + return static_cast(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12])); + } +} + +template +inline V evaluate_rational_2(const T* a, const U* b, const V& x) +{ + if(x <= 1) + { + V x2 = x * x; + return static_cast(((((((a[12] * x2 + a[10]) * x2 + a[8]) * x2 + a[6]) * x2 + a[4]) * x2 + a[2]) * x2 + a[0] + (((((a[11] * x2 + a[9]) * x2 + a[7]) * x2 + a[5]) * x2 + a[3]) * x2 + a[1]) * x) / ((((((b[12] * x2 + b[10]) * x2 + b[8]) * x2 + b[6]) * x2 + b[4]) * x2 + b[2]) * x2 + b[0] + (((((b[11] * x2 + b[9]) * x2 + b[7]) * x2 + b[5]) * x2 + b[3]) * x2 + b[1]) * x)); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + return static_cast(((((((a[0] * z2 + a[2]) * z2 + a[4]) * z2 + a[6]) * z2 + a[8]) * z2 + a[10]) * z2 + a[12] + (((((a[1] * z2 + a[3]) * z2 + a[5]) * z2 + a[7]) * z2 + a[9]) * z2 + a[11]) * z) / ((((((b[0] * z2 + b[2]) * z2 + b[4]) * z2 + b[6]) * z2 + b[8]) * z2 + b[10]) * z2 + b[12] + (((((b[1] * z2 + b[3]) * z2 + b[5]) * z2 + b[7]) * z2 + b[9]) * z2 + b[11]) * z)); + } +} + +template +inline V evaluate_rational_3(const T* a, const U* b, const V& x) +{ + if(x <= 1) + { + V x2 = x * x; + V t[4]; + t[0] = a[12] * x2 + a[10]; + t[1] = a[11] * x2 + a[9]; + t[2] = b[12] * x2 + b[10]; + t[3] = b[11] * x2 + b[9]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += a[8]; + t[1] += a[7]; + t[2] += b[8]; + t[3] += b[7]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += a[6]; + t[1] += a[5]; + t[2] += b[6]; + t[3] += b[5]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += a[4]; + t[1] += a[3]; + t[2] += b[4]; + t[3] += b[3]; + t[0] *= x2; + t[1] *= x2; + t[2] *= x2; + t[3] *= x2; + t[0] += a[2]; + t[1] += a[1]; + t[2] += b[2]; + t[3] += b[1]; + t[0] *= x2; + t[2] *= x2; + t[0] += a[0]; + t[2] += b[0]; + t[1] *= x; + t[3] *= x; + return (t[0] + t[1]) / (t[2] + t[3]); + } + else + { + V z = 1 / x; + V z2 = 1 / (x * x); + V t[4]; + t[0] = a[0] * z2 + a[2]; + t[1] = a[1] * z2 + a[3]; + t[2] = b[0] * z2 + b[2]; + t[3] = b[1] * z2 + b[3]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += a[4]; + t[1] += a[5]; + t[2] += b[4]; + t[3] += b[5]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += a[6]; + t[1] += a[7]; + t[2] += b[6]; + t[3] += b[7]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += a[8]; + t[1] += a[9]; + t[2] += b[8]; + t[3] += b[9]; + t[0] *= z2; + t[1] *= z2; + t[2] *= z2; + t[3] *= z2; + t[0] += a[10]; + t[1] += a[11]; + t[2] += b[10]; + t[3] += b[11]; + t[0] *= z2; + t[2] *= z2; + t[0] += a[12]; + t[2] += b[12]; + t[1] *= z; + t[3] *= z; + return (t[0] + t[1]) / (t[2] + t[3]); + } +} + + + +void polynomial_evaluate_0() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_polynomial_0(num, i, 13) / evaluate_polynomial_0(denom, i, 13); + consume_result(result); +} + +void polynomial_evaluate_1() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_polynomial_1(num, i) / evaluate_polynomial_1(denom, i); + consume_result(result); +} + +void polynomial_evaluate_2() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_polynomial_2(num, i) / evaluate_polynomial_2(denom, i); + consume_result(result); +} + +void polynomial_evaluate_3() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_polynomial_3(num, i) / evaluate_polynomial_3(denom, i); + consume_result(result); +} + +void polynomial_evaluate_m0() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_polynomial_0(num, i, 13) / evaluate_polynomial_0(denom_int, i, 13); + consume_result(result); +} + +void polynomial_evaluate_m1() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_polynomial_1(num, i) / evaluate_polynomial_1(denom_int, i); + consume_result(result); +} + +void polynomial_evaluate_m2() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_polynomial_2(num, i) / evaluate_polynomial_2(denom_int, i); + consume_result(result); +} + +void polynomial_evaluate_m3() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_polynomial_3(num, i) / evaluate_polynomial_3(denom_int, i); + consume_result(result); +} + +void rational_evaluate_0() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_rational_0(num, denom, i, 13); + consume_result(result); +} + +void rational_evaluate_1() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_rational_1(num, denom, i); + consume_result(result); +} + +void rational_evaluate_2() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_rational_2(num, denom, i); + consume_result(result); +} + +void rational_evaluate_3() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_rational_3(num, denom, i); + consume_result(result); +} + +void rational_evaluate_m0() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_rational_0(num, denom_int, i, 13); + consume_result(result); +} + +void rational_evaluate_m1() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_rational_1(num, denom_int, i); + consume_result(result); +} + +void rational_evaluate_m2() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_rational_2(num, denom_int, i); + consume_result(result); +} + +void rational_evaluate_m3() +{ + double result = 0; + for(double i = 1; i < 100; i += 0.5) + result += evaluate_rational_3(num, denom_int, i); + consume_result(result); +} +