ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
[boost] Re: [math constants] a new approach (perhaps)
by Thorsten Ottosen other posts by this author
Mar 1 2004 12:06AM messages near this date
[boost] Re: [math constants] a new approach (perhaps) | [boost] Re: [math constants] a new approach (perhaps)
"Paul A Bristow" <boost@[...].com>  wrote in message
news:002c01c3ff13$be46d340$0c010101@[...]..
>  Looks interesting - but what is in "math_constant.hpp" ?

David Abrahams:
> So, umm, are you going to show us the definition of "pi"?

Yes, of course. BTW, I've attached the file since
my messages seems to format the code like ****.

br

Thorsten

namespace std
{

#define CNAME( Var ) Var##_constant_t

#define OVERLOAD_CONTEXT( ConstType, FP, FPV )  inline FP operator+( FP l, ConstType )      
    { return l + FPV; }                             inline FP operator+( ConstType, FP r )  
        { return r + FPV; }                             inline FP operator-( FP l, ConstType
 )          { return l - FPV; }                             inline FP operator-( ConstType, 
FP r )          { return FPV - r; }                             inline FP operator*( FP l, C
onstType )          { return l * FPV; }                             inline FP operator*( Con
stType, FP r )          { return r * FPV; }                             inline FP operator/(
 FP l, ConstType )          { return l / FPV; }                             inline FP operat
or/( ConstType, FP r )          { return FPV / r; }                             
#define DEFINE_FP_CONSTANT( Name, FV, DV, LDV )     struct CNAME( Name )                    
            {                                                     CNAME( Name ) ()          
   {}                     operator float() const       { return FV; }         operator doubl
e() const      { return DV; }         operator long double() const { return LDV; }      };  
                                                OVERLOAD_CONTEXT( CNAME( Name ), float, FV )
        OVERLOAD_CONTEXT( CNAME( Name ), double, DV )       OVERLOAD_CONTEXT( CNAME( Name ),
 long double, LDV ) const CNAME( Name ) Name;

DEFINE_FP_CONSTANT( pi, 3.14F, 3.14232, 3.1423211223L )

} // namespace std




begin 666 math_constant.hpp
M+RHJ#0H@*B H0RD@5&AO<G-T96X@3W1T;W-E;BP@,C P- T*("H@0V]N=&%C
M=#H@;F5S;W1T;T!C<RYA=6,N9&L-"B J( T*("H@17AA;7!L92!O9B!H;W<@
M=&\@:6UP;&5M96YT(&9L97AI86)L92!M871H(&-O;G-T86YT<R!S+G0N#0H@
M*B -"B J(#$I('1H92!E> '!R97-S:6]N('=H97)E('1H92!C;VYS=&%N="!A
M<'!E87)S(&1E8VED97,@=&AE#0H@*B @("!T> 7!E(&]F('1H92!C;VYS=&%N
M= T*("H@,BD@=&AE(&-O;G-T86YT<R!C86X@<&%S<V5D('1O(&YO<FUA;"!M
M871H(&9U;F-T:6]N<PT*("H@,RD@;F\@;W)D97(@9&5P96YD96YC:65S(&]C
M8W5R<PT*("H@-"D@;6EX+6UO9&4@87)I=&AM971I8R!I<R!N;W0@<&]S<VEB
M;&4@=VET:&]U="!E> '!L:6-I="!A8W1I;VX@9G)O;2!T:&4-"B J(" @('!R
M;V=R86UM97(-"B J(#4I('1E<W1S(')E=F5A;"!T:&%T('1H97)E(&ES(&YO
M(&]V97)H96%D#0H@*B -"B J("@R*2P@*#,I(&%N9" H-2D@87)E(&$@;75S
M="!W:&EL92 H,2D@86YD("@T*2!M96%N<R!T:&%T('5N=V%N=&5D(&-O;G9E
M<G-I;VYS#0H@*B!C86X@8F4@97AP;&EC:71L> 2!C;VYT<F]L;&5D+B!&;W)C
M:6YG('1H92!P<F]G<F%M;65R('1O(&UA:V4@=&AA="!C:&]I8V4-"B J(&ES
M('-E96X@87,@82!G;V]D('!R;W!E<G1Y+@T*("HO#0H@( T*#0IN86UE<W!A
M8V4@<W1D#0I[#0H-"B-D969I;F4@0TY!344H(%9A<B I(%9A<B,C7V-O;G-T
M86YT7W0-"@T*(V1E9FEN92!/5D523$]!1%]#3TY415A4*"!#;VYS=%1Y<&4L
M($90+"!&4%8@*2 @7 T*:6YL:6YE($90(&]P97)A=&]R*R@@1E @;"P@0V]N
M<W14> 7!E("D@(" @(" @(" @7 T*>R!R971U<FX@;" K($905CL@?2 @(" @
M(" @(" @(" @(" @(" @(" @(" @(" @7 T*:6YL:6YE($90(&]P97)A=&]R
M*R@@0V]N<W14> 7!E+"!&4"!R("D@(" @(" @(" @7 T*>R!R971U<FX@<B K
M($905CL@?2 @(" @(" @(" @(" @(" @(" @(" @(" @(" @7 T*:6YL:6YE
M($90(&]P97)A=&]R+2@@1E @;"P@0V]N<W14> 7!E("D@(" @(" @(" @7 T*
M> R!R971U<FX@;" M($905CL@?2 @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @7 T*:6YL:6YE($90(&]P97)A=&]R+2@@0V]N<W14> 7!E+"!&4"!R("D@
M(" @(" @(" @7 T*> R!R971U<FX@1E!6("T@<CL@?2 @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @7 T*:6YL:6YE($90(&]P97)A=&]R*B@@1E @;"P@
M0V]N<W14> 7!E("D@(" @(" @(" @7 T*>R!R971U<FX@;" J($905CL@?2 @
M(" @(" @(" @(" @(" @(" @(" @(" @(" @7 T*:6YL:6YE($90(&]P97)A
M=&]R*B@@0V]N<W14> 7!E+"!&4"!R("D@(" @(" @(" @7 T*>R!R971U<FX@
M<B J($905CL@?2 @(" @(" @(" @(" @(" @(" @(" @(" @(" @7 T*:6YL
M:6YE($90(&]P97)A=&]R+R@@1E @;"P@0V]N<W14> 7!E("D@(" @(" @(" @
M7 T*> R!R971U<FX@;" O($905CL@?2 @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @7 T*:6YL:6YE($90(&]P97)A=&]R+R@@0V]N<W14> 7!E+"!&4"!R
M("D@(" @(" @(" @7 T*> R!R971U<FX@1E!6("\@<CL@?2 @(" @(" @(" @
M(" @(" @(" @(" @(" @(" @7 T*#0HC9&5F:6YE($1%1DE.15]&4%]#3TY3
M5$%.5"@@3F%M92P@1E8L($16+"!,1%8@*2 @(" @7 T*<W1R=6-T($-.04U%
M*"!.86UE("D@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(%P-"GL@
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @("!<#0H@($-.04U%*"!.86UE("D@*"D@(" @(" @(" @(" @> WT@(" @
M(" @(" @(" @(" @(" @7 T*("!O<&5R871O<B!F;&]A="@I(&-O;G-T(" @
M(" @('L@<F5T=7)N($96.R!](" @(" @(%P-"B @;W!E<F%T;W(@9&]U8FQE
M*"D@8V]N<W0@(" @("![(')E='5R;B!$5CL@?2 @(" @("!<#0H@(&]P97)A
M=&]R(&QO;F<@9&]U8FQE*"D@8V]N<W0@> R!R971U<FX@3$16.R!](" @(" @
M7 T*?3L@(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(%P-"D]615),3T%$7T-/3E1%6%0H($-.04U%*"!.86UE("DL
M(&9L;V%T+"!&5B I(" @(" @("!<#0I/5D523$]!1%]#3TY415A4*"!#3D%-
M12@@3F%M92 I+"!D;W5B;&4L($16("D@(" @(" @7 T*3U9%4DQ/041?0T].
M5$585"@@0TY!344H($YA;64@*2P@;&]N9R!D;W5B;&4L($Q$5B I(%P-"F-O
M;G-T($-.04U%*"!.86UE("D@3F%M93L-"@T*1$5&24Y%7T907T-/3E-404Y4
M*"!P:2P@,RXQ-$8L(#,N,30R,S(L(#,N,30R,S(Q,3(R,TP@*0T*#0I]("\O
4(&YA;65S<&%C92!S=&0-"@T*#0H`
`
end


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Thorsten Ottosen
Thorsten Ottosen
Daniel Frey
Thorsten Ottosen
Daniel Frey
Thorsten Ottosen
Daniel Frey
Thorsten Ottosen
Guillaume Melquiond
Daniel Frey
Bronek Kozicki
Bronek Kozicki
Bronek Kozicki
Daniel Frey
Bronek Kozicki
Daniel Frey
Daniel Frey
Bronek Kozicki
Daniel Frey
Daniel Frey
Bronek Kozicki
Daniel Frey
Bronek Kozicki
Bronek Kozicki
Daniel Frey
Paul A Bristow
Paul A Bristow
Paul A Bristow
Paul A Bristow
Phil Richards
Daniel Frey
Paul A Bristow
David Abrahams
Paul A Bristow
David Abrahams

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved