File: cxsc_poly.C

package info (click to toggle)
gap-float 0.9.1%2Bds-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 612 kB
  • sloc: ansic: 2,537; cpp: 1,998; xml: 184; makefile: 103; sh: 1
file content (78 lines) | stat: -rw-r--r-- 1,521 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/****************************************************************************
 *
 * cxsc_poly.C                                              Laurent Bartholdi
 *
 *   @(#)$id: fr_dll.c,v 1.18 2010/10/26 05:19:40 gap exp $
 *
 * Copyright (c) 2011, Laurent Bartholdi
 *
 ****************************************************************************
 *
 * driver for cpoly.C, using cxsc complex numbers
 *
 ****************************************************************************/

#include <real.hpp>
#include <complex.hpp>

#define cpoly cpoly_CXSC

#define xMAX_EXP DBL_MAX_EXP
#define xMIN_EXP DBL_MIN_EXP
#define xINFIN DBL_MAX
  
typedef double xreal;
typedef cxsc::complex xcomplex;

static const xreal xabs(const xcomplex &newz)
{
  return _double(abs(newz));
}

static const xreal xabs(const xreal &newz){
  return fabs(newz);
}

static const xreal xnorm(const xcomplex &newz)
{
  return _double(abs2(newz));
}

static const xreal xroot(xreal x, int n)
{
  return pow(x,1.0/n);
}

static const xreal xsqrt(xreal x)
{
  return sqrt(x);
}

static const int xbits(const xcomplex &z)
{
  return 53;
}

static const xreal xeta(const xcomplex &z)
{
  return _double(cxsc::Epsilon);
}

static const long int xlogb(const xcomplex &newz)
{
  long e0 = expo(Re(newz)), e1 = expo(Im(newz));
  return e0 > e1 ? e0 : e1;
}

static void xscalbln(xcomplex *z, long int a)
{
  cxsc::real re = Re(*z), im = Im(*z);
  
  times2pown(re,a);
  times2pown(im,a);
  *z = cxsc::complex(re,im);
}

int default_prec;

#include "cpoly.C"