include(`../prg/largenum.txt'):
include(`../prg/factorial.txt'):

func(tayeul,{
  sub({let(a,[x]):let(b,[y]):let(c,[z]):
  print_
  sub({
    let(r,0+0):
    let(k,0):
    [c]:do:
    anchor_start:
    let(g,(((largepow([a],[k]))(zeros([b])))
        [l/]
        (largefac([k])))):
    let(e,left(largeabs([g]),[b]+2)):
    let(r,largeadd([r],[g])):
    if_[e]=+0.(zeros([b])) @ success:
    let(k,[k]+1):
    loop:
    print_`fail':
    goto_exit:
    anchor_success:
    print_largetrim([r],[b]):
    anchor_exit})})}):

func(taycos,{
  sub({let(a,[x]):let(b,[y]):let(c,[z]):
  print_
  sub({
    let(r,0+0): `result':
    let(j,0): `linear loop iter':
    let(k,0): `special loop iter':
    [c]:do:
    anchor_start:
    let(g,(((largepow([a],[k]))(zeros([b])))
          [l/]
          (largefac([k])))):
    let(e,left(largeabs([g]),[b]+2)):
    iff([j]%2,
      {let(r,largesub([r],[g]))},
      {let(r,largeadd([r],[g]))}
    ):
    if_[e]=+0.(zeros([b])) @ success:
    let(j,[j]+1):
    let(k,[k]+2):
    loop:
    print_`fail':
    goto_exit:
    anchor_success:
    print_largetrim([r],[b]):
    anchor_exit})})}):

func(taysin,{
  sub({let(a,[x]):let(b,[y]):let(c,[z]):
  print_
  sub({
    let(r,0+0): `result':
    let(j,1): `linear loop iter':
    let(k,1): `special loop iter':
    [c]:do:
    anchor_start:
    let(g,(((largepow([a],[k]))(zeros([b])))
          [l/]
          (largefac([k])))):
    let(e,left(largeabs([g]),[b]+2)):
    iff([j]%2,
      {let(r,largeadd([r],[g]))},
      {let(r,largesub([r],[g]))}
    ):
    if_[e]=+0.(zeros([b])) @ success:
    let(j,[j]+1):
    let(k,[k]+2):
    loop:
    print_`fail':
    goto_exit:
    anchor_success:
    print_largetrim([r],[b]):
    anchor_exit})})}):

func(taycosh,{
  sub({let(a,[x]):let(b,[y]):let(c,[z]):
  print_
  sub({
    let(r,0+0): `result':
    let(j,0): `linear loop iter':
    let(k,0): `special loop iter':
    [c]:do:
    anchor_start:
    let(g,(((largepow([a],[k]))(zeros([b])))
          [l/]
          (largefac([k])))):
    let(e,left(largeabs([g]),[b]+2)):
    let(r,largeadd([r],[g])):
    if_[e]=+0.(zeros([b])) @ success:
    let(j,[j]+1):
    let(k,[k]+2):
    loop:
    print_`fail':
    goto_exit:
    anchor_success:
    print_largetrim([r],[b]):
    anchor_exit})})}):

func(taysinh,{
  sub({let(a,[x]):let(b,[y]):let(c,[z]):
  print_
  sub({
    let(r,0+0): `result':
    let(j,1): `linear loop iter':
    let(k,1): `special loop iter':
    [c]:do:
    anchor_start:
    let(g,(((largepow([a],[k]))(zeros([b])))
          [l/]
          (largefac([k])))):
    let(e,left(largeabs([g]),[b]+2)):
    let(r,largeadd([r],[g])):
    if_[e]=+0.(zeros([b])) @ success:
    let(j,[j]+1):
    let(k,[k]+2):
    loop:
    print_`fail':
    goto_exit:
    anchor_success:
    print_largetrim([r],[b]):
    anchor_exit})})}):

func(tayatanh,{
  sub({let(a,[x]):let(b,[y]):let(c,[z]):
  print_
  sub({
    let(r,0+0): `result':
    let(j,1): `linear loop iter':
    let(k,1): `special loop iter':
    [c]:do:
    anchor_start:
    let(g,(((largepow([a],[k]))(zeros([b])))
          [l/]
          ([k]))):
    let(e,left(largeabs([g]),[b]+2)):
    let(r,largeadd([r],[g])):
    if_[e]=+0.(zeros([b])) @ success:
    let(j,[j]+1):
    let(k,[k]+2):
    loop:
    print_`fail':
    goto_exit:
    anchor_success:
    print_largetrim([r],[b]):
    anchor_exit})})}):

func(tayln,{
  sub({let(a,[x]):let(b,[y]):let(c,[z]):
  let(p,([a]-1)[l/]([a]+1)):
  print_largetrim(
    largemul(+2.0,tayatanh([p],[b],[c]))
  ,[b])})}):

func(taycoslegacy,{sub({let(a,[x]):let(b,[y]):let(c,[z]):
  print_largetrim((for(<k,0,[b],2>,{
    (((largepow([a],[k]))(zeros([b])))
    [l/]
    (largefac([k]))) (iff([k]%2,{[l+]},{[l-]}))
  })0),[c])
})}):

print_tayln(.75,40,180):