File: txfp.h

package info (click to toggle)
tralics 2.14.4-2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch, wheezy
  • size: 17,152 kB
  • ctags: 8,260
  • sloc: cpp: 49,403; xml: 18,145; sh: 140; makefile: 118
file content (82 lines) | stat: -rw-r--r-- 2,344 bytes parent folder | download
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
79
80
81
82
// -*- C++ -*-
// $Id: txfp.h,v 2.3 2008/02/21 17:45:58 grimm Exp $
// TRALICS, copyright (C) INRIA/apics (Jose' Grimm) 2006, 2007,2008

// This software is governed by the CeCILL license under French law and
// abiding by the rules of distribution of free software.  You can  use, 
// modify and/ or redistribute the software under the terms of the CeCILL
// license as circulated by CEA, CNRS and INRIA at the following URL
// "http://www.cecill.info". 
// (See the file COPYING in the main directory for details)

// for the fp package. this implements fixed point arithmetic
class FpNum {
 public:
  bool sign; // sign of the number
  unsigned int data[4]; // the digits

  FpNum(Digit a, Digit b, Digit c, Digit d)
    { data[0]=a; data[1]=b; data[2] = c; data[3] =d; sign=true; } 
  FpNum(): sign(true) {data[0]=data[1]=data[2]=data[3]=0;}
  void init(Digit a, Digit b, Digit c, Digit d)
    { data[0]=a; data[1]=b; data[2] = c; data[3] =d;} 
  bool is_zero() const ;
  void reset() { data[0] = data[1] = data[2] = data[3] = 0; }
  void correct_sign();
  bool create(Buffer&);
  TokenList to_list() const;
  void add(FpNum);
  void set_xmax(Digit* x, int & xmin, int&xmax);
  void prop_carry(Digit* z);
  void finish_mul(bool xs, Digit*z);
  void unsplit_mul4(const Digit*);
  void add_int(FpNum);
  void div(int n);
  void sin0();
  void cos0();
  void sincos_loop(int n, FpNum x, FpNum p);
  void add_abs(FpNum);
  void sub_abs(FpNum);
  void neg_sub_abs(FpNum);
  void mod2pi();
  int count_times(FpNum);
  String to_string() const;
  void neg();
  void mul_split(unsigned int*) const;
  void mul_by_10();
  void mul_by_2();
  void mul(FpNum X);
  void div(FpNum X);
  void div_by_10();
  void add_digit(int);
  void sgn();
  void truncate(int);
  void round(int);
  void round0();
  void exec_ln();
  void exec_ln_a();
  void exec_exp();
  bool large_exp();
  void mul(FpNum,FpNum);
  void mul(FpNum,int);
  void div(FpNum,FpNum);
  void pow(FpNum,FpNum,subtypes);
  void divide2();
  int octand();
  void sin1(int);
  void cos1(int);
  void mean(FpNum a, FpNum b);
  bool sincos_transform();
  bool arcsincos_loop();
  void trigo_xy(int);
  void trigo_inv();
  void trigo_sqrt();
  void arctan();
  void arctan1();
  void sqrt();
  void croot();
  void sub(FpNum,FpNum);
  void add(FpNum,FpNum);
  void cosine();
  void random();
};