Trigonometric functions: Difference between revisions
→{{header|ooRexx}}: improved rxmlog performance using Vladimir Zabrodsky's code
(Add Nimrod) |
Walterpachl (talk | contribs) (→{{header|ooRexx}}: improved rxmlog performance using Vladimir Zabrodsky's code) |
||
Line 1,636:
rxmsin(1) =0.84147098480789650665250232163029899962256306079837</pre>
<lang oorexx>/
* Package rxm
* implements the functions available in RxMath with high precision
Line 1,656:
* 24.04.2014 WP arcsin verbessert. courtesy Horst Wegscheider
* 28.04.2014 WP run ooRexxDoc
* 11.08.2014 WP replace log algorithm with Vladimir Zabrodsky's code
**********************************************************************/
.local~my.rxm=.rxm~new(16,"D")
Line 1,936:
Expose precision
Use Strict Arg x,xprec=(precision),xbase=''
iprec=xprec+
Numeric Digits iprec
Select
When x=0 Then Return '-infinity'
When x<0 Then Return 'nan'
When x<
z=(x-1)/(x+1)▼
do M = 0 until (2 ** M) > X; end
o=z▼
N = Zeta; Ln = Zeta; Zetasup2 = Zeta * Zeta
do J
r= M * self~LN2P(xprec) - 2 * Ln
End▼
End
k=1▼
End▼
▲ Otherwise /* 1.5<=x */ Do
o=1/z▼
End
End
Line 1,987 ⟶ 1,965:
End
Return r
::Method ln2p
Parse Arg p
Numeric Digits p+10
If p<=1000 Then
Return self~ln2()
ln=n
zetasup2=1/9
n=n*zetasup2
If newln=ln Then
ln=newln
::Method LN2
V = V || 0.69314718055994530941723212145817656807
V = V || 5500134360255254120680009493393621969694
V = V || 7156058633269964186875420014810205706857
V = V || 3368552023575813055703267075163507596193
V = V || 0727570828371435190307038623891673471123350
v=''
v=v||0.69314718055994530941723212145817656807
v=v||5500134360255254120680009493393621969694
v=v||7156058633269964186875420014810205706857
v=v||3368552023575813055703267075163507596193
v=v||0727570828371435190307038623891673471123
v=v||3501153644979552391204751726815749320651
v=v||5552473413952588295045300709532636664265
v=v||4104239157814952043740430385500801944170
v=v||6416715186447128399681717845469570262716
v=v||3106454615025720740248163777338963855069
v=v||5260668341137273873722928956493547025762
v=v||6520988596932019650585547647033067936544
v=v||3254763274495125040606943814710468994650
v=v||6220167720424524529612687946546193165174
v=v||6813926725041038025462596568691441928716
v=v||0829380317271436778265487756648508567407
v=v||7648451464439940461422603193096735402574
v=v||4460703080960850474866385231381816767514
v=v||3866747664789088143714198549423151997354
v=v||8803751658612753529166100071053558249879
v=v||4147295092931138971559982056543928717000
v=v||7218085761025236889213244971389320378439
v=v||3530887748259701715591070882368362758984
v=v||2589185353024363421436706118923678919237
v=v||231467232172053401649256872747782344535348
return V
::Method log10
Line 2,629 ⟶ 2,659:
return .my.rxm~tanh(x,xprec)
::routine rxmhelp public
Line 2,643 ⟶ 2,672:
Say " .locaL~my.rxm~precision=50"
Say " .locaL~my.rxm~type='R'"
return 0
=={{header|Oz}}==
|