QDouble.st
author Claus Gittinger <cg@exept.de>
Fri, 29 Nov 2019 15:00:42 +0100
changeset 5311 835f7dc80d6a
parent 5310 0b6380408893
child 5312 52a17656aa5b
permissions -rw-r--r--
#FEATURE by cg class: QDouble changed: #ln
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
     1
"{ Encoding: utf8 }"
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
     2
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
 COPYRIGHT (c) 2017 by eXept Software AG
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
     5
	      All Rights Reserved
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 This software is furnished under a license and may be used
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
 hereby transferred.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ Package: 'stx:libbasic2' }"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
"{ NameSpace: Smalltalk }"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
LimitedPrecisionReal variableByteSubclass:#QDouble
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	instanceVariableNames:''
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
    20
	classVariableNames:'DefaultPrintFormat E Epsilon FMax FMin InvFact Ln10 Ln2 NaN Pi
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
    21
		QDoubleOne QDoubleZero'
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	poolDictionaries:''
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
	category:'Magnitude-Numbers'
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
!QDouble primitiveDefinitions!
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    27
%{
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    28
#include <stdio.h>
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    29
#include <errno.h>
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    30
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    31
#define __USE_ISOC9X 1
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    32
#define __USE_ISOC99 1
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    33
#include <math.h>
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    34
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    35
/*
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    36
 * on some systems, errno is a macro ... check for it here
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    37
 */
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    38
#ifndef errno
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    39
 extern errno;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    40
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    41
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    42
#if !defined (__win32__)
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    43
# include <locale.h>
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    44
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    45
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    46
#if defined (__aix__)
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    47
# include <float.h>
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    48
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    49
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    50
#if defined(__irix__) || defined(__solaris__) || defined(__sunos__)
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    51
# include <nan.h>
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    52
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    53
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    54
#if defined(__linux__)
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    55
# ifndef NAN
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    56
#  include <bits/nan.h>
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    57
# endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    58
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    59
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    60
#ifdef __win32__
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    61
# ifndef isinf
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    62
#  define isinf(x) \
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    63
	((((unsigned int *)(&x))[0] == 0x00000000) && \
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    64
	 ((((unsigned int *)(&x))[1] & 0x7FF00000) == 0x7FF00000))
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    65
# endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    66
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    67
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    68
#if defined(__x86__) || defined(__x86_64__)
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    69
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    70
# ifndef _FPU_EXTENDED
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    71
#  define _FPU_EXTENDED 0x0300
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    72
# endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    73
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    74
# ifndef _FPU_DOUBLE
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    75
#  define _FPU_DOUBLE 0x0200
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    76
# endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    77
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    78
# if defined( __win32__ ) && (defined( __BORLANDC__ ) || defined( __VISUALC__ ))
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    79
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    80
#  define fpu_fix_start(old_cw_ptr)\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    81
    {\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    82
	*old_cw_ptr = _control87(0, 0); \
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    83
	_control87(_FPU_DOUBLE, _FPU_EXTENDED);\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    84
    }
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    85
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    86
#  define fpu_fix_end(old_cw_ptr)\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    87
    {\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    88
	_control87(*old_cw_ptr, _FPU_EXTENDED);\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    89
    }
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    90
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    91
# else // assume MINGW, GCC or CLANG
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    92
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    93
#  ifndef _FPU_GETCW
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    94
#   define _FPU_GETCW(x) asm volatile ("fnstcw %0":"=m" (x));
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    95
#  endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    96
#  ifndef _FPU_SETCW
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    97
#   define _FPU_SETCW(x) asm volatile ("fldcw %0": :"m" (x));
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    98
#  endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
    99
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   100
#  define fpu_fix_start(old_cw_ptr)\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   101
    {\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   102
	volatile unsigned short cw, new_cw;\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   103
	_FPU_GETCW(cw);\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   104
	new_cw = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE;\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   105
	_FPU_SETCW(new_cw);\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   106
	*old_cw_ptr = cw;\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   107
    }
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   108
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   109
#  define fpu_fix_end(old_cw_ptr)\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   110
    {\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   111
	volatile unsigned short cw = *old_cw_ptr;\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   112
	_FPU_SETCW(cw);\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   113
    }
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   114
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   115
# endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   116
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   117
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   118
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   119
#define __qNew_qdReal(newQD, d0,d1,d2,d3) { \
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   120
    double* __d__;  \
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   121
    __qNew(newQD, sizeof(struct __qDoubleStruct));   \
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   122
    __stx_setClass(newQD, QDouble);                  \
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   123
    __d__ = __QDoubleInstPtr(newQD)->d_qDoubleValue; \
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   124
    __d__[0] = d0;   \
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   125
    __d__[1] = d1;   \
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   126
    __d__[2] = d2;   \
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   127
    __d__[3] = d3;   \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   128
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   129
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   130
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   131
// sigh: not all compilers (borland) support inline functions;
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   132
// therefore we have to use macros...
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   133
// sigh2: c-macros are unhygienic - to avoid catching/hiding variable bindings,
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   134
// use different names in each macros (i.e. a_xxx)
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   135
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   136
#define _QD_SPLITTER 134217729.0               // = 2^27 + 1
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   137
#define _QD_SPLIT_THRESH 6.69692879491417e+299 // = 2^996
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   138
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   139
#define m_quick_two_sum(rslt_1, a_1, b_1, err_1)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   140
{\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   141
    double s_1 = (a_1) + (b_1);\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   142
    (err_1) = (b_1) - (s_1 - (a_1));\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   143
    (rslt_1) = s_1; \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   144
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   145
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   146
#define m_quick_two_diff(rslt_2, a_2, b_2, err_2)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   147
{\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   148
    double s_2 = (a_2) - (b_2);\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   149
    (err_2) = ((a_2) - s_2) - (b_2);\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   150
    (rslt_2) = s_2;\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   151
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   152
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   153
#define m_two_sum(rslt_3, a_3, b_3, err_3)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   154
{\
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   155
    double s_3 = (a_3) + (b_3);\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   156
    double v_3 = s_3 - (a_3);\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   157
    (err_3) = ((a_3) - (s_3 - v_3)) + ((b_3) - v_3);\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   158
    (rslt_3) = s_3;\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   159
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   160
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   161
/* Computes fl(a-b) and err(a-b).  */
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   162
#define m_two_diff(rslt_4, a_4, b_4, err_4)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   163
{\
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   164
    double s_4 = (a_4) - (b_4);\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   165
    double bb_4 = s_4 - (a_4);\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   166
    (err_4) = ((a_4) - (s_4 - bb_4)) - ((b_4) + bb_4);\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   167
    (rslt_4) = s_4;\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   168
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   169
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   170
#define m_three_sum(a_5, b_5, c_5)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   171
{ \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   172
    double t1_5, t2_5, t3_5; \
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   173
    m_two_sum(t1_5, (a_5), (b_5), t2_5); \
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   174
    m_two_sum((a_5), (c_5), t1_5, t3_5); \
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   175
    m_two_sum((b_5), t2_5, t3_5, (c_5)); \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   176
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   177
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   178
#define m_three_sum2(a_6, b_6, c_6)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   179
{\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   180
    double t1_6, t2_6, t3_6;\
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   181
    m_two_sum(t1_6, (a_6), (b_6), t2_6);\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   182
    m_two_sum((a_6), (c_6), t1_6, t3_6);\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   183
    (b_6) = t2_6 + t3_6;\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   184
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   185
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   186
#ifndef QD_FMS
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   187
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   188
/* Computes high word and lo word of a */
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   189
#define m_split(a_7, hi_7, lo_7)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   190
{\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   191
    double temp_7;\
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   192
    double thi_7, tlo_7;\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   193
    if ((a_7) > _QD_SPLIT_THRESH || (a_7) < -_QD_SPLIT_THRESH) {\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   194
	(a_7) *= 3.7252902984619140625e-09;\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   195
	temp_7 = _QD_SPLITTER * (a_7);\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   196
	thi_7 = temp_7 - (temp_7 - (a_7));\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   197
	tlo_7 = (a_7) - thi_7;\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   198
	thi_7 *= 268435456.0;\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   199
	tlo_7 *= 268435456.0;\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   200
    } else {\
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   201
	temp_7 = _QD_SPLITTER * (a_7);\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   202
	thi_7 = temp_7 - (temp_7 - (a_7));\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   203
	tlo_7 = (a_7) - thi_7;\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   204
    }\
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   205
    (hi_7) = thi_7; \
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   206
    (lo_7) = tlo_7; \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   207
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   208
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   209
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   210
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   211
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   212
#ifdef QD_FMS
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   213
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   214
/* Computes fl(a*b) and err(a*b). */
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   215
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   216
#define m_two_prod(rslt_8, a_8, b_8, err_8)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   217
{\
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   218
    double p_8 = (a_8) * (b_8);\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   219
    err_8 = QD_FMS((a_8), (b_8), p_8);\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   220
    rslt_8 = p_8; \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   221
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   222
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   223
#else
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   224
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   225
#define m_two_prod(rslt_8, a_8, b_8, err_8)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   226
{\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   227
    double a_hi_8, a_lo_8, b_hi_8, b_lo_8;\
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   228
    double p_8 = (a_8) * (b_8);\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   229
    m_split(a_8, a_hi_8, a_lo_8);\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   230
    m_split(b_8, b_hi_8, b_lo_8);\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   231
    err_8 = ((a_hi_8 * b_hi_8 - p_8) + a_hi_8 * b_lo_8 + a_lo_8 * b_hi_8) + a_lo_8 * b_lo_8;\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   232
    rslt_8 = p_8; \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   233
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   234
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   235
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   236
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   237
#ifdef QD_FMS
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   238
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   239
#define m_two_sqr(rslt_9, a_9, err_9)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   240
{\
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   241
    double p_9 = (a_9) * (a_9);\
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   242
    err_9 = QD_FMS((a_9), (a_9), p_9);\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   243
    rslt_9 = p_9;\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   244
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   245
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   246
#else
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   247
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   248
#define m_two_sqr(rslt_9, a_9, err_9)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   249
{\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   250
    double hi_9, lo_9;\
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
   251
    double q_9 = (a_9) * (a_9);\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   252
    m_split(a_9, hi_9, lo_9);\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   253
    err_9 = ((hi_9 * hi_9 - q_9) + 2.0 * hi_9 * lo_9) + lo_9 * lo_9;\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   254
    rslt_9 = q_9;\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   255
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   256
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   257
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   258
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   259
#define m_renorm4(c0_10, c1_10, c2_10, c3_10)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   260
{\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   261
    double s0_10, s1_10, s2_10 = 0.0, s3_10 = 0.0;\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   262
\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   263
    if (! isinf(c0_10)) { \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   264
\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   265
	m_quick_two_sum(s0_10, c2_10, c3_10, c3_10);\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   266
	m_quick_two_sum(s0_10, c1_10, s0_10, c2_10);\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   267
	m_quick_two_sum(c0_10, c0_10, s0_10, c1_10);\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   268
\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   269
	s0_10 = c0_10;\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   270
	s1_10 = c1_10;\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   271
	if (s1_10 != 0.0) {\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   272
	     m_quick_two_sum(s1_10, s1_10, c2_10, s2_10);\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   273
	    if (s2_10 != 0.0) {\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   274
		 m_quick_two_sum(s2_10, s2_10, c3_10, s3_10);\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   275
	    } else {\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   276
		 m_quick_two_sum(s1_10, s1_10, c3_10, s2_10);\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   277
	    }\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   278
	} else {\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   279
	    m_quick_two_sum(s0_10, s0_10, c2_10, s1_10);\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   280
	    if (s1_10 != 0.0) {\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   281
		 m_quick_two_sum(s1_10, s1_10, c3_10, s2_10);\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   282
	    } else {\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   283
		 m_quick_two_sum(s0_10, s0_10, c3_10, s1_10);\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   284
	    }\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   285
	}\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   286
\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   287
	c0_10 = s0_10;\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   288
	c1_10 = s1_10;\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   289
	c2_10 = s2_10;\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   290
	c3_10 = s3_10;\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   291
    }\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   292
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   293
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   294
#define m_renorm5(c0_11, c1_11, c2_11, c3_11, c4_11)\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   295
{\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   296
    double s0_11, s1_11, s2_11 = 0.0, s3_11 = 0.0; \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   297
\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   298
    if (! isinf(c0_11)) { \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   299
	m_quick_two_sum(s0_11, c3_11, c4_11, c4_11); \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   300
	m_quick_two_sum(s0_11, c2_11, s0_11, c3_11); \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   301
	m_quick_two_sum(s0_11, c1_11, s0_11, c2_11); \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   302
	m_quick_two_sum(c0_11, c0_11, s0_11, c1_11); \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   303
\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   304
	s0_11 = c0_11; \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   305
	s1_11 = c1_11; \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   306
\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   307
	m_quick_two_sum(s0_11, c0_11, c1_11, s1_11); \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   308
	if (s1_11 != 0.0) { \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   309
	    m_quick_two_sum(s1_11, s1_11, c2_11, s2_11); \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   310
	    if (s2_11 != 0.0) { \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   311
		m_quick_two_sum(s2_11 ,s2_11, c3_11, s3_11); \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   312
		if (s3_11 != 0.0) {\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   313
		    s3_11 += c4_11; \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   314
		} else {\
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   315
		    s2_11 += c4_11;\
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   316
		}\
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   317
	    } else { \
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   318
		m_quick_two_sum(s1_11, s1_11, c3_11, s2_11); \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   319
		if (s2_11 != 0.0) {\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   320
		    m_quick_two_sum(s2_11, s2_11, c4_11, s3_11); \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   321
		} else { \
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   322
		    m_quick_two_sum(s1_11, s1_11, c4_11, s2_11); \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   323
		} \
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   324
	    } \
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   325
	} else { \
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   326
	    m_quick_two_sum(s0_11,s0_11, c2_11, s1_11); \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   327
	    if (s1_11 != 0.0) { \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   328
		m_quick_two_sum(s1_11,s1_11, c3_11, s2_11); \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   329
		if (s2_11 != 0.0) {\
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   330
		    m_quick_two_sum(s2_11,s2_11, c4_11, s3_11); \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   331
		} else { \
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   332
		    m_quick_two_sum(s1_11 ,s1_11, c4_11, s2_11); \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   333
		} \
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   334
	    } else { \
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   335
		m_quick_two_sum(s0_11,s0_11, c3_11, s1_11); \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   336
		if (s1_11 != 0.0) { \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   337
		    m_quick_two_sum(s1_11,s1_11, c4_11, s2_11); \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   338
		} else { \
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   339
		    m_quick_two_sum(s0_11,s0_11, c4_11, s1_11); \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   340
		} \
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   341
	    } \
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   342
	} \
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   343
 \
4420
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   344
	c0_11 = s0_11; \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   345
	c1_11 = s1_11; \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   346
	c2_11 = s2_11; \
2ec5ce5062eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   347
	c3_11 = s3_11; \
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   348
    } \
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   349
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   350
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   351
%}
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
! !
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
!QDouble primitiveFunctions!
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   355
%{
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
   356
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   357
#ifdef __BORLANDC__#
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   358
# define INLINE /* */
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   359
#else
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   360
# define INLINE inline
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   361
#endif
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   362
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   363
// routines
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   364
// fast_two_sum : s + e = a + b, s = fl(a + b), e = err(a + b), assumption |a|>|b|, Dekker('71)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   365
// two_sum      : s + e = a + b, s = fl(a + b), e = err(a + b), Knuth('69)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   366
// three_sum    : d + e + f = a + b + c, def are nonoverlapping, Bailey
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   367
// three_sum2   : d + e = a + b + c, de are nonoverlapping, Bailey
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   368
// two_prod     : s + e = a * b, s = fl(a * b), e = err(a * b), Verkamp and Dekker
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   369
// sqr          : s + e = a^2, s = fl(a * a), e = err(a * a)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   370
// renormalize  : renormalization algorithm
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   371
// qd_add_s  : qd + double
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   372
// qd_add_qd : qd + qd (sloppy add)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   373
// s_sub_qd  : double - qd
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   374
// qd_sub_qd : qd - qd
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   375
// s_mul_qd  : double * qd
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   376
// qd_mul_qd : qd * qd
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   377
// qd_div_qd : qd / qd
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   378
// qd_sqr  : qd ^ 2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   379
// qdsqrt_sci : square root (scalar)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   380
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   381
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   382
fast_two_sum(double *s, double *e, double a, double b)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   383
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   384
    double v;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   385
    s[0] = 0.0; e[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   386
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   387
    s[0] = a + b;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   388
    v = s[0] - a;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   389
    e[0] = b - v;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   390
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   391
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   392
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   393
two_sum(double *s, double *e, double a, double b)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   394
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   395
    double v;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   396
    s[0] = 0.0; e[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   397
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   398
    s[0] = a + b;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   399
    v = s[0] - a;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   400
    e[0] = (a - (s[0] - v)) + (b - v);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   401
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   402
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   403
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   404
three_sum(double *d, double *e, double *f, double a, double b, double c)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   405
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   406
    double t1,t2,t3,v;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   407
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   408
    d[0] = 0.0; e[0] = 0.0; f[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   409
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   410
    t1= a + b;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   411
    v = t1 - a;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   412
    t2= (a - (t1 - v))+(b - v);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   413
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   414
    d[0] = t1 + c;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   415
    v = d[0] - t1;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   416
    t3= (t1 - (d[0] - v))+(c - v);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   417
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   418
    e[0] = t2 + t3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   419
    v = e[0] - t2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   420
    f[0] = (t2 - (e[0] - v))+(t3 - v);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   421
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   422
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   423
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   424
three_sum2(double *d, double *e, double a, double b, double c)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   425
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   426
    double t1,t2,t3,v;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   427
    d[0] = 0.0; e[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   428
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   429
    t1= a + b;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   430
    v = t1 - a;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   431
    t2= (a - (t1 - v))+(b - v);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   432
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   433
    d[0] = t1 + c;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   434
    v = d[0] - t1;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   435
    t3= (t1 - (d[0] - v))+(c - v);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   436
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   437
    e[0] = t2 + t3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   438
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   439
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   440
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   441
two_prod(double *p, double *e, double a, double b)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   442
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   443
    double t,ah,al,bh,bl;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   444
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   445
    p[0] = a * b;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   446
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   447
    t = 134217729 * a;       // splitter: 2^27 + 1
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   448
    ah = t -(t - a);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   449
    al = a - ah;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   450
    t = 134217729 * b;       // splitter: 2^27 + 1
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   451
    bh = t -(t - b);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   452
    bl = b - bh;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   453
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   454
    e[0] = ((ah*bh - p[0]) + ah*bl + al*bh) + al*bl;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   455
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   456
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   457
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   458
sqr(double *p, double *e, double a)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   459
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   460
    double t,ah,al;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   461
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   462
    p[0] = a * a;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   463
    t = 134217729 * a;          // splitter: 2^27 + 1
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   464
    ah = t -(t - a);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   465
    al = a - ah;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   466
    e[0] = ((ah*ah - p[0]) + (ah*al)*2.0) + al*al;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   467
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   468
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   469
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   470
renorm(double *b0, double *b1, double *b2, double *b3, double a0, double a1, double a2, double a3, double a4)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   471
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   472
    double t0,t1,t2,t3,t4,s,ss;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   473
    s = 0.0; ss = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   474
    t0 = 0.0;t1 = 0.0;t2 = 0.0;t3 = 0.0;t4 = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   475
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   476
//    fast_two_sum(&x, &y, a3, a4);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   477
//    s = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   478
//    t4 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   479
//    fast_two_sum(&x, &y, a2, s);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   480
//    s = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   481
//    t3 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   482
//    fast_two_sum(&x, &y, a1, s);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   483
//    s = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   484
//    t2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   485
//    fast_two_sum(&x, &y, a0, s);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   486
//    t0 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   487
//    t1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   488
//    if(t1 != 0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   489
//        fast_two_sum(&x, &y, t1, t2);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   490
//        t1 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   491
//        t2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   492
//        if(t2 != 0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   493
//            fast_two_sum(&x, &y,t2, t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   494
//            t2 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   495
//            t3 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   496
//            if(t3 != 0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   497
//                t3 += t4;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   498
//            } else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   499
//                t2 += t4;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   500
//            }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   501
//        } else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   502
//            fast_two_sum(&x, &y, t1, t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   503
//            t1 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   504
//            t2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   505
//            if(t2 != 0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   506
//                fast_two_sum(&x, &y, t2, t4);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   507
//                t2 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   508
//                t3 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   509
//            } else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   510
//                fast_two_sum(&x, &y, t1, t4);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   511
//                t1 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   512
//                t2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   513
//            }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   514
//        }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   515
//    } else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   516
//        fast_two_sum(&x, &y, t0, t2);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   517
//        t0 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   518
//        t1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   519
//        if(t1 != 0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   520
//            fast_two_sum(&x, &y, t1, t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   521
//            t1 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   522
//            t2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   523
//            if(t2 != 0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   524
//                fast_two_sum(&x, &y, t2, t4);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   525
//                t2 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   526
//                t3 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   527
//            } else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   528
//                fast_two_sum(&x, &y, t1, t4);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   529
//                t1 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   530
//                t2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   531
//            }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   532
//        } else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   533
//            fast_two_sum(&x, &y, t0, t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   534
//            t0 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   535
//            t1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   536
//            if(t1 != 0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   537
//                fast_two_sum(&x, &y, t1, t4);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   538
//                t1 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   539
//                t2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   540
//            } else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   541
//                fast_two_sum(&x, &y, t0, t4);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   542
//                t0 = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   543
//                t1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   544
//            }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   545
//        }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   546
//    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   547
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   548
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   549
    //[s,t4] = fast_two_sum(a4,a5);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   550
    s = a3 + a4;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   551
    t3 = a4 - (s - a3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   552
    //[ss,t3] = fast_two_sum(a3,s);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   553
    ss = a2 + s;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   554
    t2 = s - (ss - a2);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   555
    //[s,t2] = fast_two_sum(a2,ss);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   556
    s  = a1 + ss;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   557
    t1 = ss - (s - a1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   558
    //[b1,t1] = fast_two_sum(a1,s);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   559
    b0[0] = a0 + s;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   560
    t0 = s - (b0[0] - a0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   561
    //[s,t3] = fast_two_sum(t3,t4);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   562
    s = t2 + t3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   563
    t2 = t3 - (s - t2);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   564
    //[ss,t2] = fast_two_sum(t2,s);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   565
    ss = t1 + s;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   566
    t1 = s - (ss - t1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   567
    //[b2,t1] = fast_two_sum(t1,ss);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   568
    b1[0] = t0 + ss;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   569
    t0 = ss - (b1[0] - t0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   570
    //[s,t2] = fast_two_sum(t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   571
    s = t1 + t2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   572
    t1 = t2 - (s -t1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   573
    //[b3,t1] = fast_two_sum(t1,s);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   574
    b2[0] = t0 + s;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   575
    t0 = s - (b2[0] - t0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   576
    b3[0] = t0 + t1;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   577
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   578
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   579
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   580
renorm4(double *c0Ptr, double *c1Ptr, double *c2Ptr, double *c3Ptr) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   581
    double s0, s1, s2 = 0.0, s3 = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   582
    double c0 = *c0Ptr;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   583
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   584
    if (isinf(c0)) return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   585
    fast_two_sum(&s0, c3Ptr, *c2Ptr, *c3Ptr);    // s0 = fast_two_sum(*c2Ptr, *c3Ptr, c3Ptr);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   586
    fast_two_sum(&s0, c2Ptr, *c1Ptr, s0);        // s0 = quick_two_sum(*c1Ptr, s0, c2Ptr);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   587
    fast_two_sum(&c0, c1Ptr, c0, s0);            // c0 = quick_two_sum(c0, s0, c1Ptr);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   588
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   589
    s0 = c0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   590
    s1 = *c1Ptr;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   591
    if (s1 != 0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   592
	fast_two_sum(&s1, &s2, s1, *c2Ptr);   // s1 = quick_two_sum(s1, *c2Ptr, &s2);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   593
	if (s2 != 0.0)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   594
	    fast_two_sum(&s2, &s3, s2, *c3Ptr);   // s2 = quick_two_sum(s2, *c3Ptr, &s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   595
	else
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   596
	    fast_two_sum(&s1, &s2, s1, *c3Ptr);   // s1 = quick_two_sum(s1, *c3Ptr, &s2);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   597
    } else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   598
	fast_two_sum(&s0, &s1, s0, *c2Ptr);   // s0 = quick_two_sum(s0, *c2Ptr, &s1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   599
	if (s1 != 0.0)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   600
	    fast_two_sum(&s1, &s2, s1, *c3Ptr);   // s1 = quick_two_sum(s1, *c3Ptr, &s2);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   601
	else
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   602
	    fast_two_sum(&s0, &s1, s0, *c3Ptr);   // s0 = quick_two_sum(s0, *c3Ptr, &s1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   603
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   604
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   605
    *c0Ptr = s0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   606
    *c1Ptr = s1;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   607
    *c2Ptr = s2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   608
    *c3Ptr = s3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   609
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   610
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   611
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   612
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   613
// quad-double square
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   614
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   615
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   616
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   617
qd_sqr(double *c0, double *c1, double *c2, double *c3, double a0, double a1, double a2, double a3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   618
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   619
    double p01,p11,p02,p03,p12,e00,e01,e11,e02,x,y,w,z,s0,s1,t0,t1;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   620
    c0[0] = 0.0; c1[0] = 0.0; c2[0] = 0.0; c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   621
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   622
    //O(1) term
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   623
    sqr(&x, &y, a0);                c0[0] = x;      e00 = y;        //O(1) term ok
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   624
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   625
    //O(eps) term
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   626
    two_prod(&x, &y, a0, a1);       p01 = 2.0*x;    e01 = 2.0*y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   627
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   628
    //O(eps^2) terms
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   629
    two_prod(&x, &y, a0, a2);       p02 = 2.0*x;    e02 = 2.0*y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   630
    sqr(&x, &y, a1);                p11 = x;        e11 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   631
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   632
    two_sum(&x, &y, p01, e00);      c1[0] = x;      e00 = y;                //O(eps) term ok
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   633
    two_sum(&x, &y, e00, e01);      e00 = x;        e01 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   634
    two_sum(&x, &y, p02, p11);      p02 = x;        p11 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   635
    two_sum(&x, &y, e00, p02);      s0 = x;         t0 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   636
    two_sum(&x, &y, e01, p11);      s1 = x;         t1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   637
    two_sum(&x, &y, s1, t0);        s1 = x;         t0 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   638
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   639
    t0 = t0 + t1;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   640
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   641
    fast_two_sum(&x, &y, s1, t0);   s1 = x;         t0 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   642
    fast_two_sum(&x, &y, s0, s1);   c2[0] = x;      t1 = y;         //O(eps^2) term ok
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   643
    fast_two_sum(&x, &y, t1, t0);   p11 = x;        e00 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   644
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   645
    //O(eps^3) terms
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   646
    p03 = 2.0 * a0 * a3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   647
    p12 = 2.0 * a1 * a2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   648
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   649
    two_sum(&x, &y, p03, p12);      p03 = x;        p12 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   650
    two_sum(&x, &y, e02, e11);      e02 = x;        e11 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   651
    two_sum(&x, &y, p03, e02);      t0 = x;         t1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   652
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   653
    t1 = t1 + p12 + e11;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   654
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   655
    two_sum(&x, &y, p11, t0);       c3[0] = x;      p03 = y;                //O(eps^3) term ok
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   656
    p03 = p03 + e00 + t1;                                                   //O(eps^4) term ok
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   657
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   658
    renorm(&x, &y, &w, &z, c0[0], c1[0], c2[0], c3[0], p03);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   659
    c0[0] = x;      c1[0] = y;      c2[0] = w;      c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   660
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   661
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   662
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   663
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   664
// addition quad-double + double
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   665
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   666
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   667
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   668
qd_add_s(double *c0, double *c1, double *c2, double *c3, double a0, double a1, double a2, double a3, double b)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   669
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   670
    double e,x,y,w,z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   671
    c0[0] = 0.0; c1[0] = 0.0; c2[0] = 0.0; c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   672
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   673
    two_sum(&x, &y, a0, b);         c0[0] = x;      e = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   674
    two_sum(&x, &y, a1, e);         c1[0] = x;      e = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   675
    two_sum(&x, &y, a2, e);         c2[0] = x;      e = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   676
    two_sum(&x, &y, a3, e);         c3[0] = x;      e = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   677
    renorm(&x, &y, &w, &z, c0[0], c1[0], c2[0], c3[0], e);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   678
    c0[0] = x; c1[0] = y; c2[0] = w; c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   679
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   680
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   681
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   682
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   683
// addition quad-double + double-double
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   684
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   685
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   686
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   687
qd_add_dd(double *c0, double *c1, double *c2, double *c3, double a0, double a1, double a2, double a3, double b0, double b1)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   688
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   689
    double e1,e2,x,y,w,z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   690
    c0[0] = 0.0; c1[0] = 0.0; c2[0] = 0.0; c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   691
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   692
    two_sum(&x, &y, a0, b0);    c0[0] = x;      e1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   693
    two_sum(&x, &y, a1, b1);    c1[0] = x;      e2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   694
    two_sum(&x, &y, c1[0], e1); c1[0] = x;      e1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   695
    two_sum(&x, &y, a2, e2);    c2[0] = x;      e2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   696
    two_sum(&x, &y, c2[0], e1); c2[0] = x;      e1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   697
    two_sum(&x, &y, e1, e2);    e1 = x;         e2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   698
    two_sum(&x, &y, a3, e1);    c3[0] = x;      e1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   699
    e1 = e1 + e2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   700
    renorm(&x, &y, &w, &z, c0[0], c1[0], c2[0], c3[0], e1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   701
    c0[0] = x;  c1[0] = y;      c2[0] = w;      c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   702
    return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   703
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   704
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   705
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   706
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   707
// addition quad-double + quad-double
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   708
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   709
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   710
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   711
qd_add_qd(double *c0, double *c1, double *c2, double *c3, double a0, double a1, double a2, double a3, double b0, double b1, double b2, double b3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   712
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   713
    double e1,e2,e3,e4,x,y,w,z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   714
    c0[0] = 0.0; c1[0] = 0.0; c2[0] = 0.0; c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   715
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   716
    two_sum(&x, &y, a0, b0);        c0[0] = x;      e1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   717
    two_sum(&x, &y, a1, b1);        c1[0] = x;      e2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   718
    two_sum(&x, &y, c1[0], e1);     c1[0] = x;      e1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   719
    two_sum(&x, &y, a2, b2);        c2[0] = x;      e3 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   720
    three_sum(&x, &y, &z, c2[0], e2, e1);   c2[0] = x;      e1 = y; e2 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   721
    two_sum(&x, &y, a3, b3);        c3[0] = x;      e4 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   722
    three_sum2(&x, &y, c3[0], e3, e1);              c3[0] = x;      e1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   723
    e1 = e1 + e2 + e4;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   724
    renorm(&x, &y, &w, &z, c0[0], c1[0], c2[0], c3[0], e1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   725
    c0[0] = x;      c1[0] = y;      c2[0] = w;      c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   726
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   727
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   728
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   729
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   730
// subtraction double - quad-double
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   731
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   732
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   733
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   734
s_sub_qd(double *c0, double *c1, double *c2, double *c3, double a, double b0, double b1, double b2, double b3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   735
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   736
	double e,x,y,w,z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   737
	e=0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   738
	c0[0] = 0.0; c1[0] = 0.0; c2[0] = 0.0; c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   739
	b0=-b0; b1=-b1; b2=-b2; b3=-b3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   740
	two_sum(&x, &y, a, b0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   741
	c0[0] = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   742
	e = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   743
	two_sum(&x, &y, b1, e);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   744
	c1[0] = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   745
	e = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   746
	two_sum(&x, &y, b2, e);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   747
	c2[0] = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   748
	e = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   749
	two_sum(&x, &y, b3, e);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   750
	c3[0] = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   751
	e = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   752
	renorm(&x, &y, &w, &z, c0[0], c1[0], c2[0], c3[0], e);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   753
	c0[0] = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   754
	c1[0] = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   755
	c2[0] = w;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   756
	c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   757
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   758
    return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   759
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   760
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   761
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   762
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   763
// subtraction quad-double - quad-double
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   764
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   765
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   766
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   767
qd_sub_qd(double *c0, double *c1, double *c2, double *c3, double a0, double a1, double a2, double a3, double b0, double b1, double b2, double b3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   768
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   769
    double e1,e2,e3,e4,x,y,w,z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   770
    b0 = -b0; b1 = -b1;     b2 = -b2; b3 = -b3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   771
    c0[0] = 0.0; c1[0] = 0.0; c2[0] = 0.0; c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   772
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   773
    two_sum(&x, &y, a0, b0);        c0[0] = x;      e1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   774
    two_sum(&x, &y, a1, b1);        c1[0] = x;      e2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   775
    two_sum(&x, &y, c1[0], e1);     c1[0] = x;      e1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   776
    two_sum(&x, &y, a2, b2);        c2[0] = x;      e3 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   777
    three_sum(&x, &y, &z, c2[0], e2, e1);   c2[0] = x;      e1 = y; e2 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   778
    two_sum(&x, &y, a3, b3);        c3[0] = x;      e4 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   779
    three_sum2(&x, &y, c3[0], e3, e1);              c3[0] = x;      e1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   780
    e1 = e1 + e2 + e4;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   781
    renorm(&x, &y, &w, &z, c0[0], c1[0], c2[0], c3[0], e1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   782
    c0[0] = x;      c1[0] = y;      c2[0] = w;      c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   783
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   784
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   785
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   786
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   787
// multiplication double * quad-double
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   788
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   789
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   790
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   791
s_mul_qd(double *c0, double *c1, double *c2, double *c3, double b, double a0, double a1, double a2, double a3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   792
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   793
    double e0,e1,e2,x,y,w,z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   794
    c0[0] = 0.0; c1[0] = 0.0; c2[0] = 0.0; c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   795
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   796
    two_prod(&x, &y, a0, b);        c0[0] = x;      e0 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   797
    two_prod(&x, &y, a1, b);        c1[0] = x;      e1 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   798
    two_sum(&x, &y, c1[0], e0);     c1[0] = x;      e0 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   799
    two_prod(&x, &y, a2, b);        c2[0] = x;      e2 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   800
    three_sum(&x, &y, &z, c2[0], e1, e0);   c2[0] = x;      e0 = y; e1 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   801
    c3[0] = a3*b;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   802
    three_sum2(&x, &y, c3[0], e2, e0);              c3[0] = x;      e0 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   803
    e0 = e0 + e1;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   804
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   805
    renorm(&x, &y, &w, &z, c0[0], c1[0], c2[0], c3[0], e0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   806
    c0[0] = x;      c1[0] = y;      c2[0] = w;      c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   807
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   808
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   809
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   810
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   811
// multiplication quad-double * quad-double
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   812
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   813
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   814
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   815
qd_mul_qd(double *c0, double *c1, double *c2, double *c3, double a0, double a1, double a2, double a3, double b0, double b1, double b2, double b3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   816
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   817
    double p10,p01,p11,p20,p02,e00,e10,e01,e11,e20,e02,x,y,w,z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   818
    c0[0] = 0.0; c1[0] = 0.0; c2[0] = 0.0; c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   819
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   820
    //O(1) terms
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   821
    two_prod(&x, &y, a0, b0);       c0[0] = x;      e00 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   822
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   823
    //O(eps) terms
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   824
    two_prod(&x, &y, a0, b1);       p01 = x;        e01 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   825
    two_prod(&x, &y, a1, b0);       p10 = x;        e10 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   826
    three_sum(&x, &y, &z, p01, p10, e00);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   827
    c1[0] = x;      //O(eps)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   828
    p10 = y;        //O(eps^2)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   829
    p01 = z;        //O(eps^3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   830
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   831
    //O(eps^2) terms
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   832
    two_prod(&x, &y, a0, b2);       p02 = x;        e02 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   833
    two_prod(&x, &y, a1, b1);       p11 = x;        e11 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   834
    two_prod(&x, &y, a2, b0);       p20 = x;        e20 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   835
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   836
    //six three sum for p10, e01, e10, p02, p11, p20
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   837
    three_sum(&x, &y, &z, p10, e01, e10);       p10 = x;        e01 = y;        e10 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   838
    three_sum(&x, &y, &z, p02, p11, p20);       p02 = x;        p11 = y;        p20 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   839
    two_sum(&x, &y, p02, p10);                  c2[0] = x;      p10 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   840
    two_sum(&x, &y, p11, e01);                  p11 = x;        e01 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   841
    two_sum(&x, &y, p10, p11);                  p10 = x;        p11 = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   842
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   843
    e10 = e10 + p20 + e01 + p11;    //O(eps^4) terms
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   844
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   845
    //O(eps^3) terms
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   846
    c3[0] = p10 + a0*b3 + a1*b2 + a2*b1 + a3*b0 + e02 + e11 + e20;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   847
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   848
    renorm(&x, &y, &w, &z, c0[0], c1[0], c2[0], c3[0], e10);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   849
    c0[0] = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   850
    c1[0] = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   851
    c2[0] = w;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   852
    c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   853
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   854
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   855
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   856
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   857
// division quad-double / double
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   858
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   859
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   860
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   861
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   862
qd_div_s(double *c0, double *c1, double *c2, double *c3, double a0, double a1, double a2, double a3, double b)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   863
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   864
    double x,y,w,z,t0,t1,r0,r1,r2,r3,e;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   865
    c0[0] = 0.0; c1[0] = 0.0; c2[0] = 0.0; c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   866
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   867
    c0[0] = a0/b;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   868
    // reminder a - c_0*b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   869
    two_prod(&x, &y, c0[0], b);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   870
    t0 = -x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   871
    t1 = -y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   872
    //qd subtruction (a - t)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   873
    qd_add_dd(&x, &y, &w, &z, a0, a1, a2, a3, t0, t1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   874
    r0 = x;     r1 = y; r2 = w; r3 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   875
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   876
    c1[0] = r0/b;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   877
    // reminder r - c_1*b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   878
    two_prod(&x, &y, c1[0], b);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   879
    t0 = -x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   880
    t1 = -y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   881
    //qd subtruction (r - t)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   882
    qd_add_dd(&x, &y, &w, &z, r0, r1, r2, r3, t0, t1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   883
    r0 = x;     r1 = y; r2 = w; r3 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   884
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   885
    c2[0] = r0/b;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   886
    // reminder r - c_2*b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   887
    two_prod(&x, &y, c2[0], b);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   888
    t0 = -x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   889
    t1 = -y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   890
    //qd subtruction (r - t)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   891
    qd_add_dd(&x, &y, &w, &z, r0, r1, r2, r3, t0, t1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   892
    r0 = x;     r1 = y; r2 = w; r3 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   893
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   894
    c3[0] = r0/b;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   895
    // reminder r - c_3*b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   896
    two_prod(&x, &y, c3[0], b);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   897
    t0 = -x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   898
    t1 = -y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   899
    //qd subtruction (r - t)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   900
    qd_add_dd(&x, &y, &w, &z, r0, r1, r2, r3, t0, t1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   901
    r0 = x;     r1 = y; r2 = w; r3 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   902
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   903
    e = r0/b;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   904
    renorm(&x, &y, &w, &z, c0[0], c1[0], c2[0], c3[0], e);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   905
    c0[0] = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   906
    c1[0] = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   907
    c2[0] = w;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   908
    c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   909
    return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   910
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   911
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   912
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   913
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   914
// division quad-double / quad-double
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   915
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   916
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   917
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   918
qd_div_qd(double *c0, double *c1, double *c2, double *c3, double a0, double a1, double a2, double a3, double b0, double b1, double b2, double b3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   919
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   920
    double x,y,w,z,t0,t1,t2,t3,r0,r1,r2,r3,e;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   921
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   922
    c0[0] = 0.0; c1[0] = 0.0; c2[0] = 0.0; c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   923
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   924
    c0[0] = a0/b0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   925
    // reminder a - c_0*b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   926
    //multiplication
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   927
    s_mul_qd(&x, &y, &w, &z, c0[0], b0, b1, b2, b3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   928
    t0 = -x;        t1 = -y;        t2 = -w;        t3 = -z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   929
    //qd subtruction (a - t)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   930
    qd_add_qd(&x, &y, &w, &z, a0, a1, a2, a3, t0, t1, t2, t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   931
    r0 = x; r1 = y; r2 = w; r3 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   932
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   933
    c1[0] = r0/b0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   934
    // reminder r - c_1*b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   935
    //multiplication
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   936
    s_mul_qd(&x, &y, &w, &z, c1[0], b0, b1, b2, b3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   937
    t0 = -x;        t1 = -y;        t2 = -w;        t3 = -z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   938
    //qd subtruction (r - t)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   939
    qd_add_qd(&x, &y, &w, &z, r0, r1, r2, r3, t0, t1, t2, t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   940
    r0 = x; r1 = y; r2 = w; r3 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   941
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   942
    c2[0] = r0/b0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   943
    // reminder r - c_2*b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   944
    //multiplication
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   945
    s_mul_qd(&x, &y, &w, &z, c2[0], b0, b1, b2, b3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   946
    t0 = -x;        t1 = -y;        t2 = -w;        t3 = -z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   947
    //qd subtruction (r - t)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   948
    qd_add_qd(&x, &y, &w, &z, r0, r1, r2, r3, t0, t1, t2, t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   949
    r0 = x; r1 = y; r2 = w; r3 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   950
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   951
    c3[0] = r0/b0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   952
    // reminder r - c_3*b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   953
    //multiplication
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   954
    s_mul_qd(&x, &y, &w, &z, c3[0], b0, b1, b2, b3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   955
    t0 = -x;        t1 = -y;        t2 = -w;        t3 = -z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   956
    //qd subtruction (r - t)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   957
    qd_add_qd(&x, &y, &w, &z, r0, r1, r2, r3, t0, t1, t2, t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   958
    r0 = x; r1 = y; r2 = w; r3 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   959
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   960
    e = r0/b0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   961
    renorm(&x, &y, &w, &z, c0[0], c1[0], c2[0], c3[0], e);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   962
    c0[0] = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   963
    c1[0] = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   964
    c2[0] = w;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   965
    c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   966
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   967
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   968
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   969
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   970
// division double / quad-double sloppy
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   971
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   972
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   973
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   974
s_div_qd(double *c0, double *c1, double *c2, double *c3, double a, double b0, double b1, double b2, double b3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   975
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   976
    double x,y,w,z,t0,t1,t2,t3,r0,r1,r2,r3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   977
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   978
    c0[0] = 0.0; c1[0] = 0.0; c2[0] = 0.0; c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   979
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   980
    c0[0] = a/b0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   981
    // reminder a - c_0*b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   982
    //multiplication
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   983
    s_mul_qd(&x, &y, &w, &z, c0[0], b0, b1, b2, b3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   984
    t0 = -x;        t1 = -y;        t2 = -w;        t3 = -z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   985
    //qd subtruction (a - t)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   986
    qd_add_s(&x, &y, &w, &z, t0, t1, t2, t3, a);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   987
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   988
    r0 = x; r1 = y; r2 = w; r3 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   989
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   990
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   991
    c1[0] = r0/b0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   992
    // reminder r - c_1*b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   993
    s_mul_qd(&x, &y, &w, &z, c1[0], b0, b1, b2, b3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   994
    t0 = -x;        t1 = -y;        t2 = -w;        t3 = -z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   995
    //qd subtruction (r - t)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   996
    qd_add_qd(&x, &y, &w, &z, r0, r1, r2, r3, t0, t1, t2, t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   997
    r0 = x; r1 = y; r2 = w; r3 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   998
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
   999
    c2[0] = r0/b0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1000
    // reminder r - c_2*b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1001
    s_mul_qd(&x, &y, &w, &z, c2[0], b0, b1, b2, b3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1002
    t0 = -x;        t1 = -y;        t2 = -w;        t3 = -z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1003
    //qd subtruction (r - t)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1004
    qd_add_qd(&x, &y, &w, &z, r0, r1, r2, r3, t0, t1, t2, t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1005
    r0 = x; r1 = y; r2 = w; r3 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1006
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1007
    c3[0] = r0/b0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1008
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1009
    renorm(&x, &y, &w, &z, c0[0], c1[0], c2[0], c3[0], 0.0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1010
    c0[0] = x;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1011
    c1[0] = y;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1012
    c2[0] = w;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1013
    c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1014
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1015
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1016
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1017
qdsqrt(double *c0, double *c1, double *c2, double *c3, double a0, double a1, double a2, double a3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1018
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1019
    double h0,h1,h2,h3,x0,x1,x2,x3,p,q,r,s;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1020
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1021
    c0[0] = 0.0;    c1[0] = 0.0;    c2[0] = 0.0;    c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1022
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1023
    c0[0] = 1.0/sqrt(a0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1024
    h0 = 0.5*a0;    h1 = 0.5*a1;    h2 = 0.5*a2;    h3 = 0.5*a3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1025
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1026
    qd_sqr(&x0, &x1, &x2, &x3, c0[0], c1[0], c2[0], c3[0]);                                 //x_k^2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1027
    qd_mul_qd(&p, &q, &r, &s, h0, h1, h2, h3, x0, x1, x2, x3);                              //0.5 * a * x_k^2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1028
    x0 = -p;        x1 = -q;        x2 = -r;        x3 = -s;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1029
    qd_add_s(&p, &q, &r, &s, x0, x1, x2, x3, 0.5);                                                  //0.5 - 0.5 * a * x_k^2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1030
    qd_mul_qd(&x0, &x1, &x2, &x3, p, q, r, s, c0[0], c1[0], c2[0], c3[0]);  //(0.5 - 0.5 * a * x_k^2)*x_k
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1031
    qd_add_qd(&p, &q, &r, &s, c0[0], c1[0], c2[0], c3[0], x0, x1, x2, x3);  //x_k+1 = x_k + (0.5 - 0.5 * a * x_k^2)*x_k
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1032
    c0[0] = p; c1[0] = q; c2[0] = r; c3[0] = s;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1033
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1034
    qd_sqr(&x0, &x1, &x2, &x3, c0[0], c1[0], c2[0], c3[0]);                                 //x_k^2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1035
    qd_mul_qd(&p, &q, &r, &s, h0, h1, h2, h3, x0, x1, x2, x3);                              //0.5 * a * x_k^2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1036
    x0 = -p;        x1 = -q;        x2 = -r;        x3 = -s;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1037
    qd_add_s(&p, &q, &r, &s, x0, x1, x2, x3, 0.5);                                                  //0.5 - 0.5 * a * x_k^2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1038
    qd_mul_qd(&x0, &x1, &x2, &x3, p, q, r, s, c0[0], c1[0], c2[0], c3[0]);  //(0.5 - 0.5 * a * x_k^2)*x_k
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1039
    qd_add_qd(&p, &q, &r, &s, c0[0], c1[0], c2[0], c3[0], x0, x1, x2, x3);  //x_k+1 = x_k + (0.5 - 0.5 * a * x_k^2)*x_k
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1040
    c0[0] = p; c1[0] = q; c2[0] = r; c3[0] = s;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1041
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1042
    qd_sqr(&x0, &x1, &x2, &x3, c0[0], c1[0], c2[0], c3[0]);                                 //x_k^2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1043
    qd_mul_qd(&p, &q, &r, &s, h0, h1, h2, h3, x0, x1, x2, x3);                              //0.5 * a * x_k^2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1044
    x0 = -p;        x1 = -q;        x2 = -r;        x3 = -s;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1045
    qd_add_s(&p, &q, &r, &s, x0, x1, x2, x3, 0.5);                                                  //0.5 - 0.5 * a * x_k^2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1046
    qd_mul_qd(&x0, &x1, &x2, &x3, p, q, r, s, c0[0], c1[0], c2[0], c3[0]);  //(0.5 - 0.5 * a * x_k^2)*x_k
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1047
    qd_add_qd(&p, &q, &r, &s, c0[0], c1[0], c2[0], c3[0], x0, x1, x2, x3);  //x_k+1 = x_k + (0.5 - 0.5 * a * x_k^2)*x_k
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1048
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1049
    qd_mul_qd(&x0, &x1, &x2, &x3, a0, a1, a2, a3, p, q, r, s);      //(0.5 - 0.5 * a * x_k^2)*x_k*a
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1050
    c0[0] = x0; c1[0] = x1; c2[0] = x2; c3[0] = x3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1051
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1052
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1053
static void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1054
qdpow(double *c0, double *c1, double *c2, double *c3, double a0, double a1, double a2, double a3, int p)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1055
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1056
    double r0,r1,r2,r3,x,y,w,z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1057
    int abs_p;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1058
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1059
    c0[0] = 0.0;        c1[0] = 0.0;    c2[0] = 0.0;    c3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1060
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1061
    if (p == 0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1062
	c0[0] = 1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1063
    } else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1064
	r0 = a0; r1 = a1; r2 = a2; r3 = a3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1065
	c0[0] = 1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1066
	abs_p = abs(p);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1067
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1068
	if (abs_p > 1) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1069
	    while (abs_p > 0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1070
		if ((abs_p % 2)==1) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1071
		    qd_mul_qd(&x, &y, &w, &z, c0[0], c1[0], c2[0], c3[0], r0, r1, r2, r3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1072
		    c0[0] = x;  c1[0] = y;      c2[0] = w;      c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1073
		}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1074
		abs_p = abs_p / 2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1075
		if (abs_p > 0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1076
		    qd_sqr(&x, &y, &w, &z, r0, r1, r2, r3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1077
		    r0 = x; r1 = y; r2 = w; r3 = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1078
		}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1079
	    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1080
	} else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1081
	    c0[0] = r0; c1[0] = r1;     c2[0] = r2;     c3[0] = r3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1082
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1083
	if (p < 0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1084
	    s_div_qd(&x, &y, &w, &z, 1.0, c0[0], c1[0], c2[0], c3[0]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1085
	    c0[0] = x;  c1[0] = y;      c2[0] = w;      c3[0] = z;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1086
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1087
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1088
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1089
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1090
// round to nearest integer
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1091
#define round(x)  (floor((x)+0.5))
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1092
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1093
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1094
nint_qd(double *x0, double *x1, double *x2, double *x3, double a0, double a1, double a2, double a3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1095
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1096
    x0[0]=round(a0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1097
    x1[0]=0.0; x2[0]=0.0; x3[0]=0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1098
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1099
    if(x0[0]==a0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1100
	x1[0]=round(a1);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1101
	if(x1[0]==a1) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1102
	    x2[0]=round(a2);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1103
	    if(x2[0]==a2) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1104
		x3[0]=round(a3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1105
	    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1106
	    else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1107
		if(((int)fabs(x2[0]-a2)==0.5) && (a3<0.0)) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1108
		    x2[0]=x2[0]-1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1109
		}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1110
	    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1111
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1112
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1113
	    if(((int)fabs(x1[0]-a1)==0.5) && (a2<0.0)) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1114
		x1[0]=x1[0]-1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1115
	    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1116
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1117
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1118
    else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1119
	if(((int)fabs(x0[0]-a0)==0.5) && (a1<0.0)) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1120
	    x0[0]=x0[0]-1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1121
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1122
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1123
    renorm(&x0[0],&x1[0],&x2[0],&x3[0],x0[0],x1[0],x2[0],x3[0],0.0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1124
    return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1125
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1126
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1127
static double s_table[256][4]= {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1128
    {3.0679567629659761e-03, 1.2690279085455925e-19,       5.2879464245328389e-36, -1.7820334081955298e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1129
    {6.1358846491544753e-03, 9.0545257482474933e-20,       1.6260113133745320e-37, -9.7492001208767410e-55},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1130
    {9.2037547820598194e-03, -1.2136591693535934e-19,       5.5696903949425567e-36, 1.2505635791936951e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1131
    {1.2271538285719925e-02, 6.9197907640283170e-19,       -4.0203726713435555e-36, -2.0688703606952816e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1132
    {1.5339206284988102e-02, -8.4462578865401696e-19,       4.6535897505058629e-35, -1.3923682978570467e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1133
    {1.8406729905804820e-02, 7.4195533812833160e-19,       3.9068476486787607e-35, 3.6393321292898614e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1134
    {2.1474080275469508e-02, -4.5407960207688566e-19,       -2.2031770119723005e-35, 1.2709814654833741e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1135
    {2.4541228522912288e-02, -9.1868490125778782e-20,       4.8706148704467061e-36, -2.8153947855469224e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1136
    {2.7608145778965743e-02, -1.5932358831389269e-18,       -7.0475416242776030e-35, -2.7518494176602744e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1137
    {3.0674803176636626e-02, -1.6936054844107918e-20,       -2.0039543064442544e-36, -1.6267505108658196e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1138
    {3.3741171851377587e-02, -2.0096074292368340e-18,       -1.3548237016537134e-34, 6.5554881875899973e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1139
    {3.6807222941358832e-02, 6.1060088803529842e-19,       -4.0448721259852727e-35, -2.1111056765671495e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1140
    {3.9872927587739811e-02, 4.6657453481183289e-19,       3.4119333562288684e-35, 2.4007534726187511e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1141
    {4.2938256934940820e-02, 2.8351940588660907e-18,       1.6991309601186475e-34, 6.8026536098672629e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1142
    {4.6003182130914630e-02, -1.1182813940157788e-18,       7.5235020270378946e-35, 4.1187304955493722e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1143
    {4.9067674327418015e-02, -6.7961037205182801e-19,       -4.4318868124718325e-35, -9.9376628132525316e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1144
    {5.2131704680283324e-02, -2.4243695291953779e-18,       -1.3675405320092298e-34, -8.3938137621145070e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1145
    {5.5195244349689941e-02, -1.3340299860891103e-18,       -3.4359574125665608e-35, 1.1911462755409369e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1146
    {5.8258264500435759e-02, 2.3299905496077492e-19,       1.9376108990628660e-36, -5.1273775710095301e-53},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1147
    {6.1320736302208578e-02, -5.1181134064638108e-19,       -4.2726335866706313e-35, 2.6368495557440691e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1148
    {6.4382630929857465e-02, -4.2325997000052705e-18,       3.3260117711855937e-35, 1.4736267706718352e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1149
    {6.7443919563664065e-02, -6.9221796556983636e-18,       1.5909286358911040e-34, -7.8828946891835218e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1150
    {7.0504573389613870e-02, -6.8552791107342883e-18,       -1.9961177630841580e-34, 2.0127129580485300e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1151
    {7.3564563599667426e-02, -2.7784941506273593e-18,       -9.1240375489852821e-35, -1.9589752023546795e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1152
    {7.6623861392031492e-02, 2.3253700287958801e-19,       -1.3186083921213440e-36, -4.9927872608099673e-53},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1153
    {7.9682437971430126e-02, -4.4867664311373041e-18,       2.8540789143650264e-34, 2.8491348583262741e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1154
    {8.2740264549375692e-02, 1.4735983530877760e-18,       3.7284093452233713e-35, 2.9024430036724088e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1155
    {8.5797312344439894e-02, -3.3881893830684029e-18,       -1.6135529531508258e-34, 7.7294651620588049e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1156
    {8.8853552582524600e-02, -3.7501775830290691e-18,       3.7543606373911573e-34, 2.2233701854451859e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1157
    {9.1908956497132724e-02, 4.7631594854274564e-18,       1.5722874642939344e-34, -4.8464145447831456e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1158
    {9.4963495329639006e-02, -6.5885886400417564e-18,       -2.1371116991641965e-34, 1.3819370559249300e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1159
    {9.8017140329560604e-02, -1.6345823622442560e-18,       -1.3209238810006454e-35, -3.5691060049117942e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1160
    {1.0106986275482782e-01, 3.3164325719308656e-18,       -1.2004224885132282e-34, 7.2028828495418631e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1161
    {1.0412163387205457e-01, 6.5760254085385100e-18,       1.7066246171219214e-34, -4.9499340996893514e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1162
    {1.0717242495680884e-01, 6.4424044279026198e-18,       -8.3956976499698139e-35, -4.0667730213318321e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1163
    {1.1022220729388306e-01, -5.6789503537823233e-19,       1.0380274792383233e-35, 1.5213997918456695e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1164
    {1.1327095217756435e-01, 2.7100481012132900e-18,       1.5323292999491619e-35, 4.9564432810360879e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1165
    {1.1631863091190477e-01, 1.0294914877509705e-18,       -9.3975734948993038e-35, 1.3534827323719708e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1166
    {1.1936521481099137e-01, -3.9500089391898506e-18,       3.5317349978227311e-34, 1.8856046807012275e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1167
    {1.2241067519921620e-01, 2.8354501489965335e-18,       1.8151655751493305e-34, -2.8716592177915192e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1168
    {1.2545498341154623e-01, 4.8686751763148235e-18,       5.9878105258097936e-35, -3.3534629098722107e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1169
    {1.2849811079379317e-01, 3.8198603954988802e-18,       -1.8627501455947798e-34, -2.4308161133527791e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1170
    {1.3154002870288312e-01, -5.0039708262213813e-18,       -1.2983004159245552e-34, -4.6872034915794122e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1171
    {1.3458070850712620e-01, -9.1670359171480699e-18,       1.5916493007073973e-34, 4.0237002484366833e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1172
    {1.3762012158648604e-01, 6.6253255866774482e-18,       -2.3746583031401459e-34, -9.3703876173093250e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1173
    {1.4065823933284924e-01, -7.9193932965524741e-18,       6.0972464202108397e-34, 2.4566623241035797e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1174
    {1.4369503315029444e-01, 1.1472723016618666e-17,       -5.1884954557576435e-35, -4.2220684832186607e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1175
    {1.4673047445536175e-01, 3.7269471470465677e-18,       3.7352398151250827e-34, -4.0881822289508634e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1176
    {1.4976453467732151e-01, 8.0812114131285151e-18,       1.2979142554917325e-34, 9.9380667487736254e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1177
    {1.5279718525844344e-01, -7.6313573938416838e-18,       5.7714690450284125e-34, -3.7731132582986687e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1178
    {1.5582839765426523e-01, 3.0351307187678221e-18,       -1.0976942315176184e-34, 7.8734647685257867e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1179
    {1.5885814333386145e-01, -4.0163200573859079e-18,       -9.2840580257628812e-35, -2.8567420029274875e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1180
    {1.6188639378011183e-01, 1.1850519643573528e-17,       -5.0440990519162957e-34, 3.0510028707928009e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1181
    {1.6491312048996992e-01, -7.0405288319166738e-19,       3.3211107491245527e-35, 8.6663299254686031e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1182
    {1.6793829497473117e-01, 5.4284533721558139e-18,       -3.3263339336181369e-34, -1.8536367335123848e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1183
    {1.7096188876030122e-01, 9.1919980181759094e-18,       -6.7688743940982606e-34, -1.0377711384318389e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1184
    {1.7398387338746382e-01, 5.8151994618107928e-18,       -1.6751014298301606e-34, -6.6982259797164963e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1185
    {1.7700422041214875e-01, 6.7329300635408167e-18,       2.8042736644246623e-34, 3.6786888232793599e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1186
    {1.8002290140569951e-01, 7.9701826047392143e-18,       -7.0765920110524977e-34, 1.9622512608461784e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1187
    {1.8303988795514095e-01, 7.7349918688637383e-18,       -4.4803769968145083e-34, 1.1201148793328890e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1188
    {1.8605515166344666e-01, -1.2564893007679552e-17,       7.5953844248530810e-34, -3.8471695132415039e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1189
    {1.8906866414980622e-01, -7.6208955803527778e-18,       -4.4792298656662981e-34, -4.4136824096645007e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1190
    {1.9208039704989244e-01, 4.3348343941174903e-18,       -2.3404121848139937e-34, 1.5789970962611856e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1191
    {1.9509032201612828e-01, -7.9910790684617313e-18,       6.1846270024220713e-34, -3.5840270918032937e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1192
    {1.9809841071795359e-01, -1.8434411800689445e-18,       1.4139031318237285e-34, 1.0542811125343809e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1193
    {2.0110463484209190e-01, 1.1010032669300739e-17,       -3.9123576757413791e-34, 2.4084852500063531e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1194
    {2.0410896609281687e-01, 6.0941297773957752e-18,       -2.8275409970449641e-34, 4.6101008563532989e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1195
    {2.0711137619221856e-01, -1.0613362528971356e-17,       2.2456805112690884e-34, 1.3483736125280904e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1196
    {2.1011183688046961e-01, 1.1561548476512844e-17,       6.0355905610401254e-34, 3.3329909618405675e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1197
    {2.1311031991609136e-01, 1.2031873821063860e-17,       -3.4142699719695635e-34, -1.2436262780241778e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1198
    {2.1610679707621952e-01, -1.0111196082609117e-17,       7.2789545335189643e-34, -2.9347540365258610e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1199
    {2.1910124015686980e-01, -3.6513812299150776e-19,       -2.3359499418606442e-35, 3.1785298198458653e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1200
    {2.2209362097320354e-01, -3.0337210995812162e-18,       6.6654668033632998e-35, 2.0110862322656942e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1201
    {2.2508391135979283e-01, 3.9507040822556510e-18,       2.4287993958305375e-35, 5.6662797513020322e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1202
    {2.2807208317088573e-01, 8.2361837339258012e-18,       6.9786781316397937e-34, -6.4122962482639504e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1203
    {2.3105810828067111e-01, 1.0129787149761869e-17,       -6.9359234615816044e-34, -2.8877355604883782e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1204
    {2.3404195858354343e-01, -6.9922402696101173e-18,       -5.7323031922750280e-34, 5.3092579966872727e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1205
    {2.3702360599436720e-01, 8.8544852285039918e-18,       1.3588480826354134e-34, 1.0381022520213867e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1206
    {2.4000302244874150e-01, -1.2137758975632164e-17,       -2.6448807731703891e-34, -1.9929733800670473e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1207
    {2.4298017990326390e-01, -8.7514315297196632e-18,       -6.5723260373079431e-34, -1.0333158083172177e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1208
    {2.4595505033579462e-01, -1.1129044052741832e-17,       4.3805998202883397e-34, 1.2219399554686291e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1209
    {2.4892760574572018e-01, -8.1783436100020990e-18,       5.5666875261111840e-34, 3.8080473058748167e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1210
    {2.5189781815421697e-01, -1.7591436032517039e-17,       -1.0959681232525285e-33, 5.6209426020232456e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1211
    {2.5486565960451457e-01, -1.3602299806901461e-19,       -6.0073844642762535e-36, -3.0072751311893878e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1212
    {2.5783110216215899e-01, 1.8480038630879957e-17,       3.3201664714047599e-34, -5.5547819290576764e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1213
    {2.6079411791527551e-01, 4.2721420983550075e-18,       5.6782126934777920e-35, 3.1428338084365397e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1214
    {2.6375467897483140e-01, -1.8837947680038700e-17,       1.3720129045754794e-33, -8.2763406665966033e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1215
    {2.6671275747489837e-01, 2.0941222578826688e-17,       -1.1303466524727989e-33, 1.9954224050508963e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1216
    {2.6966832557291509e-01, 1.5765657618133259e-17,       -6.9696142173370086e-34, -4.0455346879146776e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1217
    {2.7262135544994898e-01, 7.8697166076387850e-18,       6.6179388602933372e-35, -2.7642903696386267e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1218
    {2.7557181931095814e-01, 1.9320328962556582e-17,       1.3932094180100280e-33, 1.3617253920018116e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1219
    {2.7851968938505312e-01, -1.0030273719543544e-17,       7.2592115325689254e-34, -1.0068516296655851e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1220
    {2.8146493792575800e-01, -1.2322299641274009e-17,       -1.0564788706386435e-34, 7.5137424251265885e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1221
    {2.8440753721127182e-01, 2.2209268510661475e-17,       -9.1823095629523708e-34, -5.2192875308892218e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1222
    {2.8734745954472951e-01, 1.5461117367645717e-17,       -6.3263973663444076e-34, -2.2982538416476214e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1223
    {2.9028467725446239e-01, -1.8927978707774251e-17,       1.1522953157142315e-33, 7.4738655654716596e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1224
    {2.9321916269425863e-01, 2.2385430811901833e-17,       1.3662484646539680e-33, -4.2451325253996938e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1225
    {2.9615088824362384e-01, -2.0220736360876938e-17,       -7.9252212533920413e-35, -2.8990577729572470e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1226
    {2.9907982630804048e-01, 1.6701181609219447e-18,       8.6091151117316292e-35, 3.9931286230012102e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1227
    {3.0200594931922808e-01, -1.7167666235262474e-17,       2.3336182149008069e-34, 8.3025334555220004e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1228
    {3.0492922973540243e-01, -2.2989033898191262e-17,       -1.4598901099661133e-34, 3.7760487693121827e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1229
    {3.0784964004153487e-01, 2.7074088527245185e-17,       1.2568858206899284e-33, 7.2931815105901645e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1230
    {3.1076715274961147e-01, 2.0887076364048513e-17,       -3.0130590791065942e-34, 1.3876739009935179e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1231
    {3.1368174039889146e-01, 1.4560447299968912e-17,       3.6564186898011595e-34, 1.1654264734999375e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1232
    {3.1659337555616585e-01, 2.1435292512726283e-17,       1.2338169231377316e-33, 3.3963542100989293e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1233
    {3.1950203081601569e-01, -1.3981562491096626e-17,       8.1730000697411350e-34, -7.7671096270210952e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1234
    {3.2240767880106985e-01, -4.0519039937959398e-18,       3.7438302780296796e-34, 8.7936731046639195e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1235
    {3.2531029216226293e-01, 7.9171249463765892e-18,       -6.7576622068146391e-35, 2.3021655066929538e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1236
    {3.2820984357909255e-01, -2.6693140719641896e-17,       7.8928851447534788e-34, 2.5525163821987809e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1237
    {3.3110630575987643e-01, -2.7469465474778694e-17,       -1.3401245916610206e-33, 6.5531762489976163e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1238
    {3.3399965144200938e-01, 2.2598986806288142e-17,       7.8063057192586115e-34, 2.0427600895486683e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1239
    {3.3688985339222005e-01, -4.2000940033475092e-19,       -2.9178652969985438e-36, -1.1597376437036749e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1240
    {3.3977688440682685e-01, 6.6028679499418282e-18,       1.2575009988669683e-34, 2.5569067699008304e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1241
    {3.4266071731199438e-01, 1.9261518449306319e-17,       -9.2754189135990867e-34, 8.5439996687390166e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1242
    {3.4554132496398904e-01, 2.7251143672916123e-17,       7.0138163601941737e-34, -1.4176292197454015e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1243
    {3.4841868024943456e-01, 3.6974420514204918e-18,       3.5532146878499996e-34, 1.9565462544501322e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1244
    {3.5129275608556715e-01, -2.2670712098795844e-17,       -1.6994216673139631e-34, -1.2271556077284517e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1245
    {3.5416352542049040e-01, -1.6951763305764860e-17,       1.2772331777814617e-33, -3.3703785435843310e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1246
    {3.5703096123343003e-01, -4.8218191137919166e-19,       -4.1672436994492361e-35, -7.1531167149364352e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1247
    {3.5989503653498817e-01, -1.7601687123839282e-17,       1.3375125473046791e-33, 7.9467815593584340e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1248
    {3.6275572436739723e-01, -9.1668352663749849e-18,       -7.4317843956936735e-34, -2.0199582511804564e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1249
    {3.6561299780477385e-01, 1.6217898770457546e-17,       1.1286970151961055e-33, -7.1825287318139010e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1250
    {3.6846682995337232e-01, 1.0463640796159268e-17,       2.0554984738517304e-35, 1.0441861305618769e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1251
    {3.7131719395183754e-01, 3.4749239648238266e-19,       -7.5151053042866671e-37, -2.8153468438650851e-53},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1252
    {3.7416406297145799e-01, 8.0114103761962118e-18,       5.3429599813406052e-34, 1.0351378796539210e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1253
    {3.7700741021641826e-01, -2.7255302041956930e-18,       6.3646586445018137e-35, 8.3048657176503559e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1254
    {3.7984720892405116e-01, 9.9151305855172370e-18,       4.8761409697224886e-34, 1.4025084000776705e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1255
    {3.8268343236508978e-01, -1.0050772696461588e-17,       -2.0605316302806695e-34, -1.2717724698085205e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1256
    {3.8551605384391885e-01, 1.5177665396472313e-17,       1.4198230518016535e-33, 5.8955167159904235e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1257
    {3.8834504669882630e-01, -1.0053770598398717e-17,       7.5942999255057131e-34, -3.1967974046654219e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1258
    {3.9117038430225387e-01, 1.7997787858243995e-17,       -1.0613482402609856e-33, -5.4582148817791032e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1259
    {3.9399204006104810e-01, 9.7649241641239336e-18,       -2.1233599441284617e-34, -5.5529836795340819e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1260
    {3.9680998741671031e-01, 2.0545063670840126e-17,       6.1347058801922842e-34, 1.0733788150636430e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1261
    {3.9962419984564684e-01, -1.5065497476189372e-17,       -9.9653258881867298e-34, -5.7524323712725355e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1262
    {4.0243465085941843e-01, 1.0902619339328270e-17,       7.3998528125989765e-34, 2.2745784806823499e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1263
    {4.0524131400498986e-01, 9.9111401942899884e-18,       -2.5169070895434648e-34, 9.2772984818436573e-53},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1264
    {4.0804416286497869e-01, -7.0006015137351311e-18,       -1.4108207334268228e-34, 1.5175546997577136e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1265
    {4.1084317105790397e-01, -2.4219835190355499e-17,       -1.1418902925313314e-33, -2.0996843165093468e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1266
    {4.1363831223843456e-01, -1.0393984940597871e-17,       -1.1481681174503880e-34, -2.0281052851028680e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1267
    {4.1642956009763721e-01, -2.5475580413131732e-17,       -3.4482678506112824e-34, 7.1788619351865480e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1268
    {4.1921688836322396e-01, -4.2232463750110590e-18,       -3.6053023045255790e-34, -2.2209673210025631e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1269
    {4.2200027079979968e-01, 4.3543266994128527e-18,       3.1734310272251190e-34, -1.3573247980738668e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1270
    {4.2477968120910881e-01, 2.7462312204277281e-17,       -4.6552847802111948e-34, 6.5961781099193122e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1271
    {4.2755509343028208e-01, 9.4111898162954726e-18,       -1.7446682426598801e-34, -2.2054492626480169e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1272
    {4.3032648134008261e-01, 2.2259686974092690e-17,       8.5972591314085075e-34, -2.9420897889003020e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1273
    {4.3309381885315196e-01, 1.1224283329847517e-17,       5.3223748041075651e-35, 5.3926192627014212e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1274
    {4.3585707992225547e-01, 1.6230515450644527e-17,       -6.4371449063579431e-35, -6.9102436481386757e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1275
    {4.3861623853852766e-01, -2.0883315831075090e-17,       -1.4259583540891877e-34, 6.3864763590657077e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1276
    {4.4137126873171667e-01, 2.2360783886964969e-17,       1.1864769603515770e-34, -3.8087003266189232e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1277
    {4.4412214457042926e-01, -2.4218874422178315e-17,       2.2205230838703907e-34, 9.2133035911356258e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1278
    {4.4686884016237421e-01, -1.9222136142309382e-17,       -4.4425678589732049e-35, -1.3673609292149535e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1279
    {4.4961132965460660e-01, 4.8831924232035243e-18,       2.7151084498191381e-34, -1.5653993171613154e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1280
    {4.5234958723377089e-01, -1.4827977472196122e-17,       -7.6947501088972324e-34, 1.7656856882031319e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1281
    {4.5508358712634384e-01, -1.2379906758116472e-17,       5.5289688955542643e-34, -8.5382312840209386e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1282
    {4.5781330359887723e-01, -8.4554254922295949e-18,       -6.3770394246764263e-34, 3.1778253575564249e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1283
    {4.6053871095824001e-01, 1.8488777492177872e-17,       -1.0527732154209725e-33, 3.3235593490947102e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1284
    {4.6325978355186020e-01, -7.3514924533231707e-18,       6.7175396881707035e-34, 3.9594127612123379e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1285
    {4.6597649576796618e-01, -3.3023547778235135e-18,       3.4904677050476886e-35, 3.4483855263874246e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1286
    {4.6868882203582796e-01, -2.2949251681845054e-17,       -1.1364757641823658e-33, 6.8840522501918612e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1287
    {4.7139673682599764e-01, 6.5166781360690130e-18,       2.9457546966235984e-34, -6.2159717738836630e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1288
    {4.7410021465055002e-01, -8.1451601548978075e-18,       -3.4789448555614422e-34, -1.1681943974658508e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1289
    {4.7679923006332214e-01, -1.0293515338305794e-17,       -3.6582045008369952e-34, 1.7424131479176475e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1290
    {4.7949375766015301e-01, 1.8419999662684771e-17,       -1.3040838621273312e-33, 1.0977131822246471e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1291
    {4.8218377207912277e-01, -2.5861500925520442e-17,       -6.2913197606500007e-36, 4.0802359808684726e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1292
    {4.8486924800079112e-01, -1.8034004203262245e-17,       -3.5244276906958044e-34, -1.7138318654749246e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1293
    {4.8755016014843594e-01, 1.4231090931273653e-17,       -1.8277733073262697e-34, -1.5208291790429557e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1294
    {4.9022648328829116e-01, -5.1496145643440404e-18,       -3.6903027405284104e-34, 1.5172940095151304e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1295
    {4.9289819222978404e-01, -1.0257831676562186e-18,       6.9520817760885069e-35, -2.4260961214090389e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1296
    {4.9556526182577254e-01, -9.4323241942365362e-18,       3.1212918657699143e-35, 4.2009072375242736e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1297
    {4.9822766697278187e-01, -1.6126383830540798e-17,       -1.5092897319298871e-33, 1.1049298890895917e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1298
    {5.0088538261124083e-01, -3.9604015147074639e-17,       -2.2208395201898007e-33, 1.3648202735839417e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1299
    {5.0353838372571758e-01, -1.6731308204967497e-17,       -1.0140233644074786e-33, 4.0953071937671477e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1300
    {5.0618664534515534e-01, -4.8321592986493711e-17,       9.2858107226642252e-34, 4.2699802401037005e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1301
    {5.0883014254310699e-01, 4.7836968268014130e-17,       -1.0727022928806035e-33, 2.7309374513672757e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1302
    {5.1146885043797041e-01, -1.3088001221007579e-17,       4.0929033363366899e-34, -3.7952190153477926e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1303
    {5.1410274419322177e-01, -4.5712707523615624e-17,       1.5488279442238283e-33, -2.5853959305521130e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1304
    {5.1673179901764987e-01, 8.3018617233836515e-18,       5.8251027467695202e-34, -2.2812397190535076e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1305
    {5.1935599016558964e-01, -5.5331248144171145e-17,       -3.1628375609769026e-35, -2.4091972051188571e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1306
    {5.2197529293715439e-01, -4.6555795692088883e-17,       4.6378980936850430e-34, -3.3470542934689532e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1307
    {5.2458968267846895e-01, -4.3068869040082345e-17,       -4.2013155291932055e-34, -1.5096069926700274e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1308
    {5.2719913478190139e-01, -4.2202983480560619e-17,       8.5585916184867295e-34, 7.9974339336732307e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1309
    {5.2980362468629472e-01, -4.8067841706482342e-17,       5.8309721046630296e-34, -8.9740761521756660e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1310
    {5.3240312787719801e-01, -4.1020306135800895e-17,       -1.9239996374230821e-33, -1.5326987913812184e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1311
    {5.3499761988709726e-01, -5.3683132708358134e-17,       -1.3900569918838112e-33, 2.7154084726474092e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1312
    {5.3758707629564551e-01, -2.2617365388403054e-17,       -5.9787279033447075e-34, 3.1204419729043625e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1313
    {5.4017147272989285e-01, 2.7072447965935839e-17,       1.1698799709213829e-33, -5.9094668515881500e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1314
    {5.4275078486451589e-01, 1.7148261004757101e-17,       -1.3525905925200870e-33, 4.9724411290727323e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1315
    {5.4532498842204646e-01, -4.1517817538384258e-17,       -1.5318930219385941e-33, 6.3629921101413974e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1316
    {5.4789405917310019e-01, -2.4065878297113363e-17,       -3.5639213669362606e-36, -2.6013270854271645e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1317
    {5.5045797293660481e-01, -8.3319903015807663e-18,       -2.3058454035767633e-34, -2.1611290432369010e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1318
    {5.5301670558002758e-01, -4.7061536623798204e-17,       -1.0617111545918056e-33, -1.6196316144407379e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1319
    {5.5557023301960218e-01, 4.7094109405616768e-17,       -2.0640520383682921e-33, 1.2290163188567138e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1320
    {5.5811853122055610e-01, 1.3481176324765226e-17,       -5.5016743873011438e-34, -2.3484822739335416e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1321
    {5.6066157619733603e-01, -7.3956418153476152e-18,       3.9680620611731193e-34, 3.1995952200836223e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1322
    {5.6319934401383409e-01, 2.3835775146854829e-17,       1.3511793173769814e-34, 9.3201311581248143e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1323
    {5.6573181078361323e-01, -3.4096079596590466e-17,       -1.7073289744303546e-33, 8.9147089975404507e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1324
    {5.6825895267013160e-01, -5.0935673642769248e-17,       -1.6274356351028249e-33, 9.8183151561702966e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1325
    {5.7078074588696726e-01, 2.4568151455566208e-17,       -1.2844481247560350e-33, -1.8037634376936261e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1326
    {5.7329716669804220e-01, 8.5176611669306400e-18,       -6.4443208788026766e-34, 2.2546105543273003e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1327
    {5.7580819141784534e-01, -3.7909495458942734e-17,       -2.7433738046854309e-33, 1.1130841524216795e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1328
    {5.7831379641165559e-01, -2.6237691512372831e-17,       1.3679051680738167e-33, -3.1409808935335900e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1329
    {5.8081395809576453e-01, 1.8585338586613408e-17,       2.7673843114549181e-34, 1.9605349619836937e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1330
    {5.8330865293769829e-01, 3.4516601079044858e-18,       1.8065977478946306e-34, -6.3953958038544646e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1331
    {5.8579785745643886e-01, -3.7485501964311294e-18,       2.7965403775536614e-34, -7.1816936024157202e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1332
    {5.8828154822264533e-01, -2.9292166725006846e-17,       -2.3744954603693934e-33, -1.1571631191512480e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1333
    {5.9075970185887428e-01, -4.7013584170659542e-17,       2.4808417611768356e-33, 1.2598907673643198e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1334
    {5.9323229503979980e-01, 1.2892320944189053e-17,       5.3058364776359583e-34, 4.1141674699390052e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1335
    {5.9569930449243336e-01, -1.3438641936579467e-17,       -6.7877687907721049e-35, -5.6046937531684890e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1336
    {5.9816070699634227e-01, 3.8801885783000657e-17,       -1.2084165858094663e-33, -4.0456610843430061e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1337
    {6.0061647938386897e-01, -4.6398198229461932e-17,       -1.6673493003710801e-33, 5.1982824378491445e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1338
    {6.0306659854034816e-01, 3.7323357680559650e-17,       2.7771920866974305e-33, -1.6194229649742458e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1339
    {6.0551104140432555e-01, -3.1202672493305677e-17,       1.2761267338680916e-33, -4.0859368598379647e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1340
    {6.0794978496777363e-01, 3.5160832362096660e-17,       -2.5546242776778394e-34, -1.4085313551220694e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1341
    {6.1038280627630948e-01, -2.2563265648229169e-17,       1.3185575011226730e-33, 8.2316691420063460e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1342
    {6.1281008242940971e-01, -4.2693476568409685e-18,       2.5839965886650320e-34, 1.6884412005622537e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1343
    {6.1523159058062682e-01, 2.6231417767266950e-17,       -1.4095366621106716e-33, 7.2058690491304558e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1344
    {6.1764730793780398e-01, -4.7478594510902452e-17,       -7.2986558263123996e-34, -3.0152327517439154e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1345
    {6.2005721176328921e-01, -2.7983410837681118e-17,       1.1649951056138923e-33, -5.4539089117135207e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1346
    {6.2246127937414997e-01, 5.2940728606573002e-18,       -4.8486411215945827e-35, 1.2696527641980109e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1347
    {6.2485948814238634e-01, 3.3671846037243900e-17,       -2.7846053391012096e-33, 5.6102718120012104e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1348
    {6.2725181549514408e-01, 3.0763585181253225e-17,       2.7068930273498138e-34, -1.1172240309286484e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1349
    {6.2963823891492698e-01, 4.1115334049626806e-17,       -1.9167473580230747e-33, 1.1118424028161730e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1350
    {6.3201873593980906e-01, -4.0164942296463612e-17,       -7.2208643641736723e-34, 3.7828920470544344e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1351
    {6.3439328416364549e-01, 1.0420901929280035e-17,       4.1174558929280492e-34, -1.4464152986630705e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1352
    {6.3676186123628420e-01, 3.1419048711901611e-17,       -2.2693738415126449e-33, -1.6023584204297388e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1353
    {6.3912444486377573e-01, 1.2416796312271043e-17,       -6.2095419626356605e-34, 2.7762065999506603e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1354
    {6.4148101280858316e-01, -9.9883430115943310e-18,       4.1969230376730128e-34, 5.6980543799257597e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1355
    {6.4383154288979150e-01, -3.2084798795046886e-17,       -1.2595311907053305e-33, -4.0205885230841536e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1356
    {6.4617601298331639e-01, -2.9756137382280815e-17,       -1.0275370077518259e-33, 8.0852478665893014e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1357
    {6.4851440102211244e-01, 3.9870270313386831e-18,       1.9408388509540788e-34, -5.1798420636193190e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1358
    {6.5084668499638088e-01, 3.9714670710500257e-17,       2.9178546787002963e-34, 3.8140635508293278e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1359
    {6.5317284295377676e-01, 8.5695642060026238e-18,       -6.9165322305070633e-34, 2.3873751224185395e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1360
    {6.5549285299961535e-01, 3.5638734426385005e-17,       1.2695365790889811e-33, 4.3984952865412050e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1361
    {6.5780669329707864e-01, 1.9580943058468545e-17,       -1.1944272256627192e-33, 2.8556402616436858e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1362
    {6.6011434206742048e-01, -1.3960054386823638e-19,       6.1515777931494047e-36, 5.3510498875622660e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1363
    {6.6241577759017178e-01, -2.2615508885764591e-17,       5.0177050318126862e-34, 2.9162532399530762e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1364
    {6.6471097820334490e-01, -3.6227793598034367e-17,       -9.0607934765540427e-34, 3.0917036342380213e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1365
    {6.6699992230363747e-01, 3.5284364997428166e-17,       -1.0382057232458238e-33, 7.3812756550167626e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1366
    {6.6928258834663612e-01, -5.4592652417447913e-17,       -2.5181014709695152e-33, -1.6867875999437174e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1367
    {6.7155895484701844e-01, -4.0489037749296692e-17,       3.1995835625355681e-34, -1.4044414655670960e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1368
    {6.7382900037875604e-01, 2.3091901236161086e-17,       5.7428037192881319e-34, 1.1240668354625977e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1369
    {6.7609270357531592e-01, 3.7256902248049466e-17,       1.7059417895764375e-33, 9.7326347795300652e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1370
    {6.7835004312986147e-01, 1.8302093041863122e-17,       9.5241675746813072e-34, 5.0328101116133503e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1371
    {6.8060099779545302e-01, 2.8473293354522047e-17,       4.1331805977270903e-34, 4.2579030510748576e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1372
    {6.8284554638524808e-01, -1.2958058061524531e-17,       1.8292386959330698e-34, 3.4536209116044487e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1373
    {6.8508366777270036e-01, 2.5948135194645137e-17,       -8.5030743129500702e-34, -6.9572086141009930e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1374
    {6.8731534089175916e-01, -5.5156158714917168e-17,       1.1896489854266829e-33, -7.8505896218220662e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1375
    {6.8954054473706694e-01, -1.5889323294806790e-17,       9.1242356240205712e-34, 3.8315454152267638e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1376
    {6.9175925836415775e-01, 2.7406078472410668e-17,       1.3286508943202092e-33, 1.0651869129580079e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1377
    {6.9397146088965400e-01, 7.4345076956280137e-18,       7.5061528388197460e-34, -1.5928000240686583e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1378
    {6.9617713149146299e-01, -4.1224081213582889e-17,       -3.1838716762083291e-35, -3.9625587412119131e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1379
    {6.9837624940897280e-01, 4.8988282435667768e-17,       1.9134010413244152e-33, 2.6161153243793989e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1380
    {7.0056879394324834e-01, 3.1027960192992922e-17,       9.5638250509179997e-34, 4.5896916138107048e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1381
    {7.0275474445722530e-01, 2.5278294383629822e-18,       -8.6985561210674942e-35, -5.6899862307812990e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1382
    {7.0493408037590488e-01, 2.7608725585748502e-17,       2.9816599471629137e-34, 1.1533044185111206e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1383
    {7.0710678118654757e-01, -4.8336466567264567e-17,       2.0693376543497068e-33, 2.4677734957341755e-50}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1384
};
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1385
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1386
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1387
sin_table_qd(double *s0, double *s1, double *s2, double *s3, double j)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1388
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1389
    int int_j=(int)j;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1390
    s0[0]=s_table[int_j-1][0];
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1391
    s1[0]=s_table[int_j-1][1];
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1392
    s2[0]=s_table[int_j-1][2];
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1393
    s3[0]=s_table[int_j-1][3];
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1394
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1395
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1396
static double c_table[265][4] = {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1397
    {9.9999529380957619e-01, -1.9668064285322189e-17,       -6.3053955095883481e-34, 5.3266110855726731e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1398
    {9.9998117528260111e-01, 3.3568103522895585e-17,       -1.4740132559368063e-35, 9.8603097594755596e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1399
    {9.9995764455196390e-01, -3.1527836866647287e-17,       2.6363251186638437e-33, 1.0007504815488399e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1400
    {9.9992470183914450e-01, 3.7931082512668012e-17,       -8.5099918660501484e-35, -4.9956973223295153e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1401
    {9.9988234745421256e-01, -3.5477814872408538e-17,       1.7102001035303974e-33, -1.0725388519026542e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1402
    {9.9983058179582340e-01, 1.8825140517551119e-17,       -5.1383513457616937e-34, -3.8378827995403787e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1403
    {9.9976940535121528e-01, 4.2681177032289012e-17,       1.9062302359737099e-33, -6.0221153262881160e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1404
    {9.9969881869620425e-01, -2.9851486403799753e-17,       -1.9084787370733737e-33, 5.5980260344029202e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1405
    {9.9961882249517864e-01, -4.1181965521424734e-17,       2.0915365593699916e-33, 8.1403390920903734e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1406
    {9.9952941750109314e-01, 2.0517917823755591e-17,       -4.7673802585706520e-34, -2.9443604198656772e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1407
    {9.9943060455546173e-01, 3.9644497752257798e-17,       -2.3757223716722428e-34, -1.2856759011361726e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1408
    {9.9932238458834954e-01, -4.2858538440845682e-17,       3.3235101605146565e-34, -8.3554272377057543e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1409
    {9.9920475861836389e-01, 9.1796317110385693e-18,       5.5416208185868570e-34, 8.0267046717615311e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1410
    {9.9907772775264536e-01, 2.1419007653587032e-17,       -7.9048203318529618e-34, -5.3166296181112712e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1411
    {9.9894129318685687e-01, -2.0610641910058638e-17,       -1.2546525485913485e-33, -7.5175888806157064e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1412
    {9.9879545620517241e-01, -1.2291693337075465e-17,       2.4468446786491271e-34, 1.0723891085210268e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1413
    {9.9864021818026527e-01, -4.8690254312923302e-17,       -2.9470881967909147e-34, -1.3000650761346907e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1414
    {9.9847558057329477e-01, -2.2002931182778795e-17,       -1.2371509454944992e-33, -2.4911225131232065e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1415
    {9.9830154493389289e-01, -5.1869402702792278e-17,       1.0480195493633452e-33, -2.8995649143155511e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1416
    {9.9811811290014918e-01, 2.7935487558113833e-17,       2.4423341255830345e-33, -6.7646699175334417e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1417
    {9.9792528619859600e-01, 1.7143659778886362e-17,       5.7885840902887460e-34, -9.2601432603894597e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1418
    {9.9772306664419164e-01, -2.6394475274898721e-17,       -1.6176223087661783e-34, -9.9924942889362281e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1419
    {9.9751145614030345e-01, 5.6007205919806937e-18,       -5.9477673514685690e-35, -1.4166807162743627e-54},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1420
    {9.9729045667869021e-01, 9.1647695371101735e-18,       6.7824134309739296e-34, -8.6191392795543357e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1421
    {9.9706007033948296e-01, 1.6734093546241963e-17,       -1.3169951440780028e-33, 1.0311048767952477e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1422
    {9.9682029929116567e-01, 4.7062820708615655e-17,       2.8412041076474937e-33, -8.0006155670263622e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1423
    {9.9657114579055484e-01, 1.1707179088390986e-17,       -7.5934413263024663e-34, 2.8474848436926008e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1424
    {9.9631261218277800e-01, 1.1336497891624735e-17,       3.4002458674414360e-34, 7.7419075921544901e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1425
    {9.9604470090125197e-01, 2.2870031707670695e-17,       -3.9184839405013148e-34, -3.7081260416246375e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1426
    {9.9576741446765982e-01, -2.3151908323094359e-17,       -1.6306512931944591e-34, -1.5925420783863192e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1427
    {9.9548075549192694e-01, 3.2084621412226554e-18,       -4.9501292146013023e-36, -2.7811428850878516e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1428
    {9.9518472667219693e-01, -4.2486913678304410e-17,       1.3315510772504614e-33, 6.7927987417051888e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1429
    {9.9487933079480562e-01, 4.2130813284943662e-18,       -4.2062597488288452e-35, 2.5157064556087620e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1430
    {9.9456457073425542e-01, 3.6745069641528058e-17,       -3.0603304105471010e-33, 1.0397872280487526e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1431
    {9.9424044945318790e-01, 4.4129423472462673e-17,       -3.0107231708238066e-33, 7.4201582906861892e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1432
    {9.9390697000235606e-01, -1.8964849471123746e-17,       -1.5980853777937752e-35, -8.5374807150597082e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1433
    {9.9356413552059530e-01, 2.9752309927797428e-17,       -4.5066707331134233e-34, -3.3548191633805036e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1434
    {9.9321194923479450e-01, 3.3096906261272262e-17,       1.5592811973249567e-33, 1.4373977733253592e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1435
    {9.9285041445986510e-01, -1.4094517733693302e-17,       -1.1954558131616916e-33, 1.8761873742867983e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1436
    {9.9247953459870997e-01, 3.1093055095428906e-17,       -1.8379594757818019e-33, -3.9885758559381314e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1437
    {9.9209931314219180e-01, -3.9431926149588778e-17,       -6.2758062911047230e-34, -1.2960929559212390e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1438
    {9.9170975366909953e-01, -2.3372891311883661e-18,       2.7073298824968591e-35, -1.2569459441802872e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1439
    {9.9131085984611544e-01, -2.5192111583372105e-17,       -1.2852471567380887e-33, 5.2385212584310483e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1440
    {9.9090263542778001e-01, 1.5394565094566704e-17,       -1.0799984133184567e-33, 2.7451115960133595e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1441
    {9.9048508425645709e-01, -5.5411437553780867e-17,       -1.4614017210753585e-33, -3.8339374397387620e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1442
    {9.9005821026229712e-01, -1.7055485906233963e-17,       1.3454939685758777e-33, 7.3117589137300036e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1443
    {9.8962201746320089e-01, -5.2398217968132530e-17,       1.3463189211456219e-33, 5.8021640554894872e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1444
    {9.8917650996478101e-01, -4.0987309937047111e-17,       -4.4857560552048437e-34, -3.9414504502871125e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1445
    {9.8872169196032378e-01, -1.0976227206656125e-17,       3.2311342577653764e-34, 9.6367946583575041e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1446
    {9.8825756773074946e-01, 2.7030607784372632e-17,       7.7514866488601377e-35, 2.1019644956864938e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1447
    {9.8778414164457218e-01, -2.3600693397159021e-17,       -1.2323283769707861e-33, 3.0130900716803339e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1448
    {9.8730141815785843e-01, -5.2332261255715652e-17,       -2.7937644333152473e-33, 1.2074160567958408e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1449
    {9.8680940181418553e-01, -5.0287214351061075e-17,       -2.2681526238144461e-33, 4.4003694320169133e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1450
    {9.8630809724459867e-01, -2.1520877103013341e-17,       1.1866528054187716e-33, -7.8532199199813836e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1451
    {9.8579750916756748e-01, -5.1439452979953012e-17,       2.6276439309996725e-33, 7.5423552783286347e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1452
    {9.8527764238894122e-01, 2.3155637027900207e-17,       -7.5275971545764833e-34, 1.0582231660456094e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1453
    {9.8474850180190421e-01, 1.0548144061829957e-17,       2.8786145266267306e-34, -3.6782210081466112e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1454
    {9.8421009238692903e-01, 4.7983922627050691e-17,       2.2597419645070588e-34, 1.7573875814863400e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1455
    {9.8366241921173025e-01, 1.9864948201635255e-17,       -1.0743046281211033e-35, 1.7975662796558100e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1456
    {9.8310548743121629e-01, 4.2170007522888628e-17,       8.2396265656440904e-34, -8.0803700139096561e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1457
    {9.8253930228744124e-01, 1.5149580813777224e-17,       -4.1802771422186237e-34, -2.2150174326226160e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1458
    {9.8196386910955524e-01, 2.1108443711513084e-17,       -1.5253013442896054e-33, -6.8388082079337969e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1459
    {9.8137919331375456e-01, 1.3428163260355633e-17,       -6.5294290469962986e-34, 2.7965412287456268e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1460
    {9.8078528040323043e-01, 1.8546939997825006e-17,       -1.0696564445530757e-33, 6.6668174475264961e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1461
    {9.8018213596811743e-01, -3.6801786963856159e-17,       6.3245171387992842e-34, 1.8600176137175971e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1462
    {9.7956976568544052e-01, 1.5573991584990420e-17,       -1.3401066029782990e-33, -1.7263702199862149e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1463
    {9.7894817531906220e-01, -2.3817727961148053e-18,       -1.0694750370381661e-34, -8.2293047196087462e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1464
    {9.7831737071962765e-01, -2.1623082233344895e-17,       1.0970403012028032e-33, 7.7091923099369339e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1465
    {9.7767735782450993e-01, 5.0514136167059628e-17,       -1.3254751701428788e-33, 7.0161254312124538e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1466
    {9.7702814265775439e-01, -4.3353875751555997e-17,       5.4948839831535478e-34, -9.2755263105377306e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1467
    {9.7636973133002114e-01, 9.3093931526213780e-18,       -4.1184949155685665e-34, -3.1913926031393690e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1468
    {9.7570213003852857e-01, -2.5572556081259686e-17,       -9.3174244508942223e-34, -8.3675863211646863e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1469
    {9.7502534506699412e-01, 2.6642660651899135e-17,       1.7819392739353853e-34, -3.3159625385648947e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1470
    {9.7433938278557586e-01, 2.3041221476151512e-18,       1.0758686005031430e-34, 5.1074116432809478e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1471
    {9.7364424965081198e-01, -5.1729808691005871e-17,       -1.5508473005989887e-33, -1.6505125917675401e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1472
    {9.7293995220556018e-01, -3.1311211122281800e-17,       -2.6874087789006141e-33, -2.1652434818822145e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1473
    {9.7222649707893627e-01, 3.6461169785938221e-17,       3.0309636883883133e-33, -1.2702716907967306e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1474
    {9.7150389098625178e-01, -7.9865421122289046e-18,       -4.3628417211263380e-34, 3.4307517798759352e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1475
    {9.7077214072895035e-01, -4.7992163325114922e-17,       3.0347528910975783e-33, 8.5989199506479701e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1476
    {9.7003125319454397e-01, 1.8365300348428844e-17,       -1.4311097571944918e-33, 8.5846781998740697e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1477
    {9.6928123535654853e-01, -4.5663660261927896e-17,       9.6147526917239387e-34, 8.1267605207871330e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1478
    {9.6852209427441727e-01, 4.9475074918244771e-17,       2.8558738351911241e-33, 6.2948422316507461e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1479
    {9.6775383709347551e-01, -4.5512132825515820e-17,       -1.4127617988719093e-33, -8.4620609089704578e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1480
    {9.6697647104485207e-01, 3.8496228837337864e-17,       -5.3881631542745647e-34, -3.5221863171458959e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1481
    {9.6619000344541250e-01, 5.1298840401665493e-17,       1.4564075904769808e-34, 1.0095973971377432e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1482
    {9.6539444169768940e-01, -2.3745389918392156e-17,       5.9221515590053862e-34, -3.8811192556231094e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1483
    {9.6458979328981276e-01, -3.4189470735959786e-17,       2.2982074155463522e-33, -4.5128791045607634e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1484
    {9.6377606579543984e-01, 2.6463950561220029e-17,       -2.9073234590199323e-36, -1.2938328629395601e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1485
    {9.6295326687368388e-01, 8.9341960404313634e-18,       -3.9071244661020126e-34, 1.6212091116847394e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1486
    {9.6212140426904158e-01, 1.5236770453846305e-17,       -1.3050173525597142e-33, 7.9016122394092666e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1487
    {9.6128048581132064e-01, 2.0933955216674039e-18,       1.0768607469015692e-34, -5.9453639304361774e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1488
    {9.6043051941556579e-01, 2.4653904815317185e-17,       -1.3792169410906322e-33, -4.7726598378506903e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1489
    {9.5957151308198452e-01, 1.1000640085000957e-17,       -4.2036030828223975e-34, 4.0023704842606573e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1490
    {9.5870347489587160e-01, -4.3685014392372053e-17,       2.2001800662729131e-33, -1.0553721324358075e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1491
    {9.5782641302753291e-01, -1.7696710075371263e-17,       1.9164034110382190e-34, 8.1489235071754813e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1492
    {9.5694033573220882e-01, 4.0553869861875701e-17,       -1.7147013364302149e-33, 2.5736745295329455e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1493
    {9.5604525134999641e-01, 3.7705045279589067e-17,       1.9678699997347571e-33, 8.5093177731230180e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1494
    {9.5514116830577067e-01, 5.0088652955014668e-17,       -2.6983181838059211e-33, 1.0102323575596493e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1495
    {9.5422809510910567e-01, -3.7545901690626874e-17,       1.4951619241257764e-33, -8.2717333151394973e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1496
    {9.5330604035419386e-01, -2.5190738779919934e-17,       -1.4272239821134379e-33, -4.6717286809283155e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1497
    {9.5237501271976588e-01, -2.0269300462299272e-17,       -1.0635956887246246e-33, -3.5514537666487619e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1498
    {9.5143502096900834e-01, 3.1350584123266695e-17,       -2.4824833452737813e-33, 9.5450335525380613e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1499
    {9.5048607394948170e-01, 1.9410097562630436e-17,       -8.1559393949816789e-34, -1.0501209720164562e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1500
    {9.4952818059303667e-01, -7.5544151928043298e-18,       -5.1260245024046686e-34, 1.8093643389040406e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1501
    {9.4856134991573027e-01, 2.0668262262333232e-17,       -5.9440730243667306e-34, 1.4268853111554300e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1502
    {9.4758559101774109e-01, 4.3417993852125991e-17,       -2.7728667889840373e-34, 5.5709160196519968e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1503
    {9.4660091308328353e-01, 3.5056800210680730e-17,       9.8578536940318117e-34, 6.6035911064585197e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1504
    {9.4560732538052128e-01, 4.6019102478523738e-17,       -6.2534384769452059e-34, 1.5758941215779961e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1505
    {9.4460483726148026e-01, 8.8100545476641165e-18,       5.2291695602757842e-34, -3.3487256018407123e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1506
    {9.4359345816196039e-01, -2.4093127844404214e-17,       1.0283279856803939e-34, -2.3398232614531355e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1507
    {9.4257319760144687e-01, 1.3235564806436886e-17,       -5.7048262885386911e-35, 3.9947050442753744e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1508
    {9.4154406518302081e-01, -2.7896379547698341e-17,       1.6273236356733898e-33, -5.3075944708471203e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1509
    {9.4050607059326830e-01, 2.8610421567116268e-17,       2.9261501147538827e-33, -2.6849867690896925e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1510
    {9.3945922360218992e-01, -7.0152867943098655e-18,       -5.6395693818011210e-34, 3.5568142678987651e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1511
    {9.3840353406310806e-01, 5.4242545044795490e-17,       -1.9039966607859759e-33, -1.5627792988341215e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1512
    {9.3733901191257496e-01, -3.6570926284362776e-17,       -1.1902940071273247e-33, -1.1215082331583223e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1513
    {9.3626566717027826e-01, -1.3013766145497654e-17,       5.2229870061990595e-34, -3.3972777075634108e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1514
    {9.3518350993894761e-01, -3.2609395302485065e-17,       -8.1813015218875245e-34, 5.5642140024928139e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1515
    {9.3409255040425887e-01, 4.4662824360767511e-17,       -2.5903243047396916e-33, 8.1505209004343043e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1516
    {9.3299279883473885e-01, 4.2041415555384355e-17,       9.0285896495521276e-34, 5.3019984977661259e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1517
    {9.3188426558166815e-01, -4.0785944377318095e-17,       1.7631450298754169e-33, 2.5776403305507453e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1518
    {9.3076696107898371e-01, 1.9703775102838329e-17,       6.5657908718278205e-34, -1.9480347966259524e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1519
    {9.2964089584318121e-01, 5.1282530016864107e-17,       2.3719739891916261e-34, -1.7230065426917127e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1520
    {9.2850608047321559e-01, -2.3306639848485943e-17,       -7.7799084333208503e-34, -5.8597558009300305e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1521
    {9.2736252565040111e-01, -2.7677111692155437e-17,       2.2110293450199576e-34, 2.0349190819680613e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1522
    {9.2621024213831138e-01, -3.7303754586099054e-17,       2.0464457809993405e-33, 1.3831799631231817e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1523
    {9.2504924078267758e-01, 6.0529447412576159e-18,       -8.8256517760278541e-35, 1.8285462122388328e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1524
    {9.2387953251128674e-01, 1.7645047084336677e-17,       -5.0442537321586818e-34, -4.0478677716823890e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1525
    {9.2270112833387852e-01, 5.2963798918539814e-17,       -5.7135699628876685e-34, 3.0163671797219087e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1526
    {9.2151403934204190e-01, 4.1639843390684644e-17,       1.1891485604702356e-33, 2.0862437594380324e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1527
    {9.2031827670911059e-01, -2.7806888779036837e-17,       2.7011013677071274e-33, 1.1998578792455499e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1528
    {9.1911385169005777e-01, -2.6496484622344718e-17,       6.5403604763461920e-34, -2.8997180201186078e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1529
    {9.1790077562139050e-01, -3.9074579680849515e-17,       2.3004636541490264e-33, 3.9851762744443107e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1530
    {9.1667905992104270e-01, -4.1733978698287568e-17,       1.2094444804381172e-33, 4.9356916826097816e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1531
    {9.1544871608826783e-01, -1.3591056692900894e-17,       5.9923027475594735e-34, 2.1403295925962879e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1532
    {9.1420975570353069e-01, -3.6316182527814423e-17,       -1.9438819777122554e-33, 2.8340679287728316e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1533
    {9.1296219042839821e-01, -4.7932505228039469e-17,       -1.7753551889428638e-33, 4.0607782903868160e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1534
    {9.1170603200542988e-01, -2.6913273175034130e-17,       -5.1928101916162528e-35, 1.1338175936090630e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1535
    {9.1044129225806725e-01, -5.0433041673313820e-17,       1.0938746257404305e-33, 9.5378272084170731e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1536
    {9.0916798309052238e-01, -3.6878564091359894e-18,       2.9951330310507693e-34, -1.2225666136919926e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1537
    {9.0788611648766626e-01, -4.9459964301225840e-17,       -1.6599682707075313e-33, -5.1925202712634716e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1538
    {9.0659570451491533e-01, 3.0506718955442023e-17,       -1.4478836557141204e-33, 1.8906373784448725e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1539
    {9.0529675931811882e-01, -4.1153099826889901e-17,       2.9859368705184223e-33, 5.1145293917439211e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1540
    {9.0398929312344334e-01, -6.6097544687484308e-18,       1.2728013034680357e-34, -4.3026097234014823e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1541
    {9.0267331823725883e-01, -1.9250787033961483e-17,       1.3242128993244527e-33, -5.2971030688703665e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1542
    {9.0134884704602203e-01, -1.3524789367698682e-17,       6.3605353115880091e-34, 3.6227400654573828e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1543
    {9.0001589201616028e-01, -5.0639618050802273e-17,       1.0783525384031576e-33, 2.8130016326515111e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1544
    {8.9867446569395382e-01, 2.6316906461033013e-17,       3.7003137047796840e-35, -2.3447719900465938e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1545
    {8.9732458070541832e-01, -3.6396283314867290e-17,       -2.3611649895474815e-33, 1.1837247047900082e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1546
    {8.9596624975618511e-01, 4.9025099114811813e-17,       -1.9440489814795326e-33, -1.7070486667767033e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1547
    {8.9459948563138270e-01, -1.7516226396814919e-17,       -1.3200670047246923e-33, -1.5953009884324695e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1548
    {8.9322430119551532e-01, -4.1161239151908913e-18,       2.5380253805715999e-34, 4.2849455510516192e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1549
    {8.9184070939234272e-01, 4.6690228137124547e-18,       1.6150254286841982e-34, -3.9617448820725012e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1550
    {8.9044872324475788e-01, 1.1781931459051803e-17,       -1.3346142209571930e-34, -9.4982373530733431e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1551
    {8.8904835585466457e-01, -1.1164514966766675e-17,       -3.4797636107798736e-34, -1.5605079997040631e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1552
    {8.8763962040285393e-01, 1.2805091918587960e-17,       3.9948742059584459e-35, 3.8940716325338136e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1553
    {8.8622253014888064e-01, -6.7307369600274315e-18,       1.2385593432917413e-34, 2.0364014759133320e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1554
    {8.8479709843093779e-01, -9.4331469628972690e-18,       -5.7106541478701439e-34, 1.8260134111907397e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1555
    {8.8336333866573158e-01, 1.5822643380255127e-17,       -7.8921320007588250e-34, -1.4782321016179836e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1556
    {8.8192126434835505e-01, -1.9843248405890562e-17,       -7.0412114007673834e-34, -1.0636770169389104e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1557
    {8.8047088905216075e-01, 1.6311096602996350e-17,       -5.7541360594724172e-34, -4.0128611862170021e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1558
    {8.7901222642863353e-01, -4.7356837291118011e-17,       1.4388771297975192e-33, -2.9085554304479134e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1559
    {8.7754529020726124e-01, 5.0113311846499550e-17,       2.8382769008739543e-34, 1.5550640393164140e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1560
    {8.7607009419540660e-01, 5.8729024235147677e-18,       2.7941144391738458e-34, -1.8536073846509828e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1561
    {8.7458665227817611e-01, -5.7216617730397065e-19,       -2.9705811503689596e-35, 8.7389593969796752e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1562
    {8.7309497841829009e-01, 7.8424672990129903e-18,       -4.8685015839797165e-34, -2.2815570587477527e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1563
    {8.7159508665595109e-01, -5.5272998038551050e-17,       -2.2104090204984907e-33, -9.7749763187643172e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1564
    {8.7008699110871146e-01, -4.1888510868549968e-17,       7.0900185861878415e-34, 3.7600251115157260e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1565
    {8.6857070597134090e-01, 2.7192781689782903e-19,       -1.6710140396932428e-35, -1.2625514734637969e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1566
    {8.6704624551569265e-01, 3.0267859550930567e-18,       -1.1559438782171572e-34, -5.3580556397808012e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1567
    {8.6551362409056909e-01, -6.3723113549628899e-18,       2.3725520321746832e-34, 1.5911880348395175e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1568
    {8.6397285612158670e-01, 4.1486355957361607e-17,       2.2709976932210266e-33, -8.1228385659479984e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1569
    {8.6242395611104050e-01, 3.7008992527383130e-17,       5.2128411542701573e-34, 2.6945600081026861e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1570
    {8.6086693863776731e-01, -3.0050048898573656e-17,       -8.8706183090892111e-34, 1.5005320558097301e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1571
    {8.5930181835700836e-01, 4.2435655816850687e-17,       7.6181814059912025e-34, -3.9592127850658708e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1572
    {8.5772861000027212e-01, -4.8183447936336620e-17,       -1.1044130517687532e-33, -8.7400233444645562e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1573
    {8.5614732837519447e-01, 9.1806925616606261e-18,       5.6328649785951470e-34, 2.3326646113217378e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1574
    {8.5455798836540053e-01, -1.2991124236396092e-17,       1.2893407722948080e-34, -3.6506925747583053e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1575
    {8.5296060493036363e-01, 2.7152984251981370e-17,       7.4336483283120719e-34, 4.2162417622350668e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1576
    {8.5135519310526520e-01, -5.3279874446016209e-17,       2.2281156380919942e-33, -4.0281886404138477e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1577
    {8.4974176800085244e-01, 5.1812347659974015e-17,       3.0810626087331275e-33, -2.5931308201994965e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1578
    {8.4812034480329723e-01, 1.8762563415239981e-17,       1.4048773307919617e-33, -2.4915221509958691e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1579
    {8.4649093877405213e-01, -4.7969419958569345e-17,       -2.7518267097886703e-33, -7.3518959727313350e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1580
    {8.4485356524970712e-01, -4.3631360296879637e-17,       -2.0307726853367547e-33, 4.3097229819851761e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1581
    {8.4320823964184544e-01, 9.6536707005959077e-19,       2.8995142431556364e-36, 9.6715076811480284e-53},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1582
    {8.4155497743689844e-01, -3.4095465391321557e-17,       -8.4130208607579595e-34, -4.9447283960568686e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1583
    {8.3989379419599952e-01, -1.6673694881511411e-17,       -1.4759184141750289e-33, -7.5795098161914058e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1584
    {8.3822470555483808e-01, -3.5560085052855026e-17,       1.1689791577022643e-33, -5.8627347359723411e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1585
    {8.3654772722351201e-01, -2.0899059027066533e-17,       -9.8104097821002585e-35, -3.1609177868229853e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1586
    {8.3486287498638001e-01, 4.6048430609159657e-17,       -5.1827423265239912e-34, -7.0505343435504109e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1587
    {8.3317016470191319e-01, 1.3275129507229764e-18,       4.8589164115370863e-35, 4.5422281300506859e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1588
    {8.3146961230254524e-01, 1.4073856984728024e-18,       4.6951315383980830e-35, 5.1431906049905658e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1589
    {8.2976123379452305e-01, -2.9349109376485597e-18,       1.1496917934149818e-34, 3.5186665544980233e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1590
    {8.2804504525775580e-01, -4.4196593225871532e-17,       2.7967864855211251e-33, 1.0030777287393502e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1591
    {8.2632106284566353e-01, -5.3957485453612902e-17,       6.8976896130138550e-34, 3.8106164274199196e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1592
    {8.2458930278502529e-01, -2.6512360488868275e-17,       1.6916964350914386e-34, 6.7693974813562649e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1593
    {8.2284978137582632e-01, 1.5193019034505495e-17,       9.6890547246521685e-34, 5.6994562923653264e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1594
    {8.2110251499110465e-01, 3.0715131609697682e-17,       -1.7037168325855879e-33, -1.1149862443283853e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1595
    {8.1934752007679701e-01, -4.8200736995191133e-17,       -1.5574489646672781e-35, -9.5647853614522216e-53},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1596
    {8.1758481315158371e-01, -1.4883149812426772e-17,       -7.8273262771298917e-34, 4.1332149161031594e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1597
    {8.1581441080673378e-01, 8.2652693782130871e-18,       -2.3028778135179471e-34, 1.5102071387249843e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1598
    {8.1403632970594841e-01, -5.2127351877042624e-17,       -1.9047670611316360e-33, -1.6937269585941507e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1599
    {8.1225058658520388e-01, 3.1054545609214803e-17,       2.2649541922707251e-34, -7.4221684154649405e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1600
    {8.1045719825259477e-01, 2.3520367349840499e-17,       -7.7530070904846341e-34, -7.2792616357197140e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1601
    {8.0865618158817498e-01, 9.3251597879721674e-18,       -7.1823301933068394e-34, 2.3925440846132106e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1602
    {8.0684755354379922e-01, 4.9220603766095546e-17,       2.9796016899903487e-33, 1.5220754223615788e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1603
    {8.0503133114296355e-01, 5.1368289568212149e-17,       6.3082807402256524e-34, 7.3277646085129827e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1604
    {8.0320753148064494e-01, -3.3060609804814910e-17,       -1.2242726252420433e-33, 2.8413673268630117e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1605
    {8.0137617172314024e-01, -2.0958013413495834e-17,       -4.3798162198006931e-34, 2.0235690497752515e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1606
    {7.9953726910790501e-01, 2.0356723822005431e-17,       -9.7448513696896360e-34, 5.3608109599696008e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1607
    {7.9769084094339116e-01, -4.6730759884788944e-17,       2.3075897077191757e-33, 3.1605567774640253e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1608
    {7.9583690460888357e-01, -3.0062724851910721e-17,       -2.2496210832042235e-33, -6.5881774117183040e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1609
    {7.9397547755433717e-01, -7.4194631759921416e-18,       2.4124341304631069e-34, -4.9956808616244972e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1610
    {7.9210657730021239e-01, -3.7087850202326467e-17,       -1.4874457267228264e-33, 2.9323097289153505e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1611
    {7.9023022143731003e-01, 2.3056905954954492e-17,       1.4481080533260193e-33, -7.6725237057203488e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1612
    {7.8834642762660623e-01, 3.4396993154059708e-17,       1.7710623746737170e-33, 1.7084159098417402e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1613
    {7.8645521359908577e-01, -9.7841429939305265e-18,       3.3906063272445472e-34, 5.7269505320382577e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1614
    {7.8455659715557524e-01, -8.5627965423173476e-18,       -2.1106834459001849e-34, -1.6890322182469603e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1615
    {7.8265059616657573e-01, 9.0745866975808825e-18,       6.7623847404278666e-34, -1.7173237731987271e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1616
    {7.8073722857209449e-01, -9.9198782066678806e-18,       -2.1265794012162715e-36, 3.0772165598957647e-54},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1617
    {7.7881651238147598e-01, -2.4891385579973807e-17,       6.7665497024807980e-35, -6.5218594281701332e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1618
    {7.7688846567323244e-01, 7.7418602570672864e-18,       -5.9986517872157897e-34, 3.0566548232958972e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1619
    {7.7495310659487393e-01, -5.2209083189826433e-17,       -9.6653593393686612e-34, 3.7027750076562569e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1620
    {7.7301045336273699e-01, -3.2565907033649772e-17,       1.3860807251523929e-33, -3.9971329917586022e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1621
    {7.7106052426181382e-01, -4.4558442347769265e-17,       -2.9863565614083783e-33, -6.8795262083596236e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1622
    {7.6910333764557959e-01, 5.1546455184564817e-17,       2.6142829553524292e-33, -1.6199023632773298e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1623
    {7.6713891193582040e-01, -1.8885903683750782e-17,       -1.3659359331495433e-33, -2.2538834962921934e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1624
    {7.6516726562245896e-01, -3.2707225612534598e-17,       1.1177117747079528e-33, -3.7005182280175715e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1625
    {7.6318841726338127e-01, 2.6314748416750748e-18,       1.4048039063095910e-34, 8.9601886626630321e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1626
    {7.6120238548426178e-01, 3.5315510881690551e-17,       1.2833566381864357e-33, 8.6221435180890613e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1627
    {7.5920918897838807e-01, -3.8558842175523123e-17,       2.9720241208332759e-34, -1.2521388928220163e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1628
    {7.5720884650648457e-01, -1.9909098777335502e-17,       3.9409283266158482e-34, 2.0744254207802976e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1629
    {7.5520137689653655e-01, -1.9402238001823017e-17,       -3.7756206444727573e-34, -2.1212242308178287e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1630
    {7.5318679904361252e-01, -3.7937789838736540e-17,       -6.7009539920231559e-34, -6.7128562115050214e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1631
    {7.5116513190968637e-01, 4.3499761158645868e-17,       2.5227718971102212e-33, -6.5969709212757102e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1632
    {7.4913639452345937e-01, -4.4729078447011889e-17,       -2.4206025249983768e-33, 1.1336681351116422e-49},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1633
    {7.4710060598018013e-01, 1.1874824875965430e-17,       2.1992523849833518e-34, 1.1025018564644483e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1634
    {7.4505778544146595e-01, 1.5078686911877863e-17,       8.0898987212942471e-34, 8.2677958765323532e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1635
    {7.4300795213512172e-01, -2.5144629669719265e-17,       7.1128989512526157e-34, 3.0181629077821220e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1636
    {7.4095112535495911e-01, -1.4708616952297345e-17,       -4.9550433827142032e-34, 3.1434132533735671e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1637
    {7.3888732446061511e-01, 3.4324874808225091e-17,       -1.3706639444717610e-33, -3.3520827530718938e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1638
    {7.3681656887736990e-01, -2.8932468101656295e-17,       -3.4649887126202378e-34, -1.8484474476291476e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1639
    {7.3473887809596350e-01, -3.4507595976263941e-17,       -2.3718000676666409e-33, -3.9696090387165402e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1640
    {7.3265427167241282e-01, 1.8918673481573520e-17,       -1.5123719544119886e-33, -9.7922152011625728e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1641
    {7.3056276922782759e-01, -2.9689959904476928e-17,       -1.1276871244239744e-33, -3.0531520961539007e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1642
    {7.2846439044822520e-01, 1.1924642323370718e-19,       5.9001892316611011e-36, 1.2178089069502704e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1643
    {7.2635915508434601e-01, -3.1917502443460542e-17,       7.7047912412039396e-34, 4.1455880160182123e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1644
    {7.2424708295146689e-01, 2.9198471334403004e-17,       2.3027324968739464e-33, -1.2928820533892183e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1645
    {7.2212819392921535e-01, -2.3871262053452047e-17,       1.0636125432862273e-33, -4.4598638837802517e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1646
    {7.2000250796138165e-01, -2.5689658854462333e-17,       -9.1492566948567925e-34, 4.4403780801267786e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1647
    {7.1787004505573171e-01, 2.7006476062511453e-17,       -2.2854956580215348e-34, 9.1726903890287867e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1648
    {7.1573082528381871e-01, -5.1581018476410262e-17,       -1.3736271349300259e-34, -1.2734611344111297e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1649
    {7.1358486878079364e-01, -4.2342504403133584e-17,       -4.2690366101617268e-34, -2.6352370883066522e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1650
    {7.1143219574521643e-01, 7.9643298613856813e-18,       2.9488239510721469e-34, 1.6985236437666356e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1651
    {7.0927282643886569e-01, -3.7597359110245730e-17,       1.0613125954645119e-34, 8.9465480185486032e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1652
    {7.0710678118654757e-01, -4.8336466567264567e-17,       2.0693376543497068e-33, 2.4677734957341755e-50}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1653
};
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1654
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1655
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1656
cos_table_qd(double *c0, double *c1, double *c2, double *c3, double j)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1657
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1658
    int int_j=(int)j;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1659
    c0[0]=c_table[int_j-1][0];
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1660
    c1[0]=c_table[int_j-1][1];
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1661
    c2[0]=c_table[int_j-1][2];
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1662
    c3[0]=c_table[int_j-1][3];
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1663
    return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1664
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1665
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1666
static void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1667
sin_taylor_qd(double *s0, double *s1, double *s2, double *s3, double x0, double x1, double x2, double x3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1668
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1669
	double eps = 1.21543267145725e-63; // = 2^-209
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1670
	double thresh = 0.5*fabs(x0)*eps;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1671
	double fact[15][4] = {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1672
	    {1.66666666666666657e-01,  9.25185853854297066e-18,  5.13581318503262866e-34,  2.85094902409834186e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1673
	    {4.16666666666666644e-02,  2.31296463463574266e-18,  1.28395329625815716e-34,  7.12737256024585466e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1674
	    {8.33333333333333322e-03,  1.15648231731787138e-19,  1.60494162032269652e-36,  2.22730392507682967e-53},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1675
	    {1.38888888888888894e-03, -5.30054395437357706e-20, -1.73868675534958776e-36, -1.63335621172300840e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1676
	    {1.98412698412698413e-04,  1.72095582934207053e-22,  1.49269123913941271e-40,  1.29470326746002471e-58},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1677
	    {2.48015873015873016e-05,  2.15119478667758816e-23,  1.86586404892426588e-41,  1.61837908432503088e-59},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1678
	    {2.75573192239858925e-06, -1.85839327404647208e-22,  8.49175460488199287e-39, -5.72661640789429621e-55},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1679
	    {2.75573192239858883e-07,  2.37677146222502973e-23, -3.26318890334088294e-40,  1.61435111860404415e-56},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1680
	    {2.50521083854417202e-08, -1.44881407093591197e-24,  2.04267351467144546e-41, -8.49632672007163175e-58},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1681
	    {2.08767569878681002e-09, -1.20734505911325997e-25,  1.70222792889287100e-42,  1.41609532150396700e-58},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1682
	    {1.60590438368216133e-10,  1.25852945887520981e-26, -5.31334602762985031e-43,  3.54021472597605528e-59},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1683
	    {1.14707455977297245e-11,  2.06555127528307454e-28,  6.88907923246664603e-45,  5.72920002655109095e-61},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1684
	    {7.64716373181981641e-13,  7.03872877733453001e-30, -7.82753927716258345e-48,  1.92138649443790242e-64},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1685
	    {4.77947733238738525e-14,  4.39920548583408126e-31, -4.89221204822661465e-49,  1.20086655902368901e-65},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1686
	    {2.81145725434552060e-15,  1.65088427308614326e-31, -2.87777179307447918e-50,  4.27110689256293549e-67}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1687
	};
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1688
	double y0,y1,y2,y3,r0,r1,r2,r3,t0,t1,t2,t3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1689
	int i;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1690
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1691
	if(x0==0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1692
		s0[0]=0.0; s1[0]=0.0; s2[0]=0.0; s3[0]=0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1693
		return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1694
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1695
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1696
	i=0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1697
	qd_mul_qd(&y0,&y1,&y2,&y3,x0,x1,x2,x3,x0,x1,x2,x3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1698
	y0 = -y0;   y1 = -y1;   y2 = -y2;   y3 = -y3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1699
	s0[0]=x0;   s1[0]=x1;   s2[0]=x2;   s3[0]=x3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1700
	r0=x0;      r1=x1;      r2=x2;      r3=x3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1701
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1702
	qd_mul_qd(&r0,&r1,&r2,&r3,r0,r1,r2,r3,y0,y1,y2,y3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1703
	qd_mul_qd(&t0,&t1,&t2,&t3,r0,r1,r2,r3,fact[i][0],fact[i][1],fact[i][2],fact[i][3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1704
	qd_add_qd(&s0[0],&s1[0],&s2[0],&s3[0],s0[0],s1[0],s2[0],s3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1705
	i=i+2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1706
	while ((i<=15)||(fabs(t0)>thresh)) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1707
		qd_mul_qd(&r0,&r1,&r2,&r3,r0,r1,r2,r3,y0,y1,y2,y3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1708
		qd_mul_qd(&t0,&t1,&t2,&t3,r0,r1,r2,r3,fact[i][0],fact[i][1],fact[i][2],fact[i][3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1709
		qd_add_qd(&s0[0],&s1[0],&s2[0],&s3[0],s0[0],s1[0],s2[0],s3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1710
		i=i+2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1711
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1712
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1713
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1714
static double inv_fact[15][4] = {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1715
    {1.66666666666666657e-01,  9.25185853854297066e-18,  5.13581318503262866e-34,  2.85094902409834186e-50},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1716
    {4.16666666666666644e-02,  2.31296463463574266e-18,  1.28395329625815716e-34,  7.12737256024585466e-51},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1717
    {8.33333333333333322e-03,  1.15648231731787138e-19,  1.60494162032269652e-36,  2.22730392507682967e-53},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1718
    {1.38888888888888894e-03, -5.30054395437357706e-20, -1.73868675534958776e-36, -1.63335621172300840e-52},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1719
    {1.98412698412698413e-04,  1.72095582934207053e-22,  1.49269123913941271e-40,  1.29470326746002471e-58},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1720
    {2.48015873015873016e-05,  2.15119478667758816e-23,  1.86586404892426588e-41,  1.61837908432503088e-59},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1721
    {2.75573192239858925e-06, -1.85839327404647208e-22,  8.49175460488199287e-39, -5.72661640789429621e-55},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1722
    {2.75573192239858883e-07,  2.37677146222502973e-23, -3.26318890334088294e-40,  1.61435111860404415e-56},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1723
    {2.50521083854417202e-08, -1.44881407093591197e-24,  2.04267351467144546e-41, -8.49632672007163175e-58},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1724
    {2.08767569878681002e-09, -1.20734505911325997e-25,  1.70222792889287100e-42,  1.41609532150396700e-58},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1725
    {1.60590438368216133e-10,  1.25852945887520981e-26, -5.31334602762985031e-43,  3.54021472597605528e-59},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1726
    {1.14707455977297245e-11,  2.06555127528307454e-28,  6.88907923246664603e-45,  5.72920002655109095e-61},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1727
    {7.64716373181981641e-13,  7.03872877733453001e-30, -7.82753927716258345e-48,  1.92138649443790242e-64},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1728
    {4.77947733238738525e-14,  4.39920548583408126e-31, -4.89221204822661465e-49,  1.20086655902368901e-65},
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1729
    {2.81145725434552060e-15,  1.65088427308614326e-31, -2.87777179307447918e-50,  4.27110689256293549e-67}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1730
};
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1731
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1732
static void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1733
cos_taylor_qd(double *c0, double *c1, double *c2, double *c3, double x0, double x1, double x2, double x3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1734
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1735
    double eps = 1.21543267145725e-63; // = 2^-209
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1736
    double thresh = 0.5*eps;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1737
    double y0,y1,y2,y3,r0,r1,r2,r3,t0,t1,t2,t3,p0,p1,p2,p3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1738
    int i;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1739
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1740
    if(x0==0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1741
	c0[0]=1.0; c1[0]=0.0; c2[0]=0.0; c3[0]=0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1742
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1743
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1744
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1745
    i=1;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1746
    qd_mul_qd(&y0,&y1,&y2,&y3,x0,x1,x2,x3,x0,x1,x2,x3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1747
    y0 = -y0;   y1 = -y1;   y2 = -y2;   y3 = -y3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1748
    r0=y0; r1=y1; r2=y2; r3=y3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1749
    s_mul_qd(&p0,&p1,&p2,&p3,0.5,r0,r1,r2,r3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1750
    qd_add_s(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,1.0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1751
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1752
    qd_mul_qd(&r0,&r1,&r2,&r3,r0,r1,r2,r3,y0,y1,y2,y3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1753
    qd_mul_qd(&t0,&t1,&t2,&t3,r0,r1,r2,r3,inv_fact[i][0],inv_fact[i][1],inv_fact[i][2],inv_fact[i][3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1754
    qd_add_qd(&c0[0],&c1[0],&c2[0],&c3[0],c0[0],c1[0],c2[0],c3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1755
    i=i+2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1756
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1757
    while((i<=15)||(fabs(t0)>thresh)) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1758
	qd_mul_qd(&r0,&r1,&r2,&r3,r0,r1,r2,r3,y0,y1,y2,y3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1759
	qd_mul_qd(&t0,&t1,&t2,&t3,r0,r1,r2,r2,inv_fact[i][0],inv_fact[i][1],inv_fact[i][2],inv_fact[i][3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1760
	qd_add_qd(&c0[0],&c1[0],&c2[0],&c3[0],c0[0],c1[0],c2[0],c3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1761
	i=i+2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1762
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1763
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1764
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1765
static void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1766
sincos_taylor_qd(double *s0, double *s1, double *s2, double *s3, double *c0, double *c1, double *c2, double *c3, double x0, double x1, double x2, double x3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1767
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1768
    double eps = 1.21543267145725e-63; // = 2^-209
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1769
    double thresh = 0.5 * fabs(x0)*eps;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1770
    double y0,y1,y2,y3,r0,r1,r2,r3,t0,t1,t2,t3,p0,p1,p2,p3,q0,q1,q2,q3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1771
    int i;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1772
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1773
    if(x0==0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1774
	s0[0]=0.0; s1[0]=0.0; s2[0]=0.0; s3[0]=0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1775
	c0[0]=1.0; c1[0]=0.0; c2[0]=0.0; c3[0]=0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1776
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1777
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1778
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1779
    i=0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1780
    qd_mul_qd(&y0,&y1,&y2,&y3,x0,x1,x2,x3,x0,x1,x2,x3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1781
    y0 = -y0;   y1 = -y1;   y2 = -y2;   y3 = -y3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1782
    s0[0]=x0; s1[0]=x1; s2[0]=x2; s3[0]=x3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1783
    r0=x0; r1=x1; r2=x2; r3=x3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1784
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1785
    qd_mul_qd(&r0,&r1,&r2,&r3,r0,r1,r2,r3,y0,y1,y2,y3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1786
    qd_mul_qd(&t0,&t1,&t2,&t3,r0,r1,r2,r3,inv_fact[i][0],inv_fact[i][1],inv_fact[i][2],inv_fact[i][3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1787
    qd_add_qd(&s0[0],&s1[0],&s2[0],&s3[0],s0[0],s1[0],s2[0],s3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1788
    i=i+2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1789
    while ((i<=15)||((int)fabs(t0)>thresh)) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1790
	qd_mul_qd(&r0,&r1,&r2,&r3,r0,r1,r2,r3,y0,y1,y2,y3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1791
	qd_mul_qd(&t0,&t1,&t2,&t3,r0,r1,r2,r3,inv_fact[i][0],inv_fact[i][1],inv_fact[i][2],inv_fact[i][3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1792
	qd_add_qd(&s0[0],&s1[0],&s2[0],&s3[0],s0[0],s1[0],s2[0],s3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1793
	i=i+2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1794
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1795
    qd_mul_qd(&p0,&p1,&p2,&p3,s0[0],s1[0],s2[0],s3[0],s0[0],s1[0],s2[0],s3[0]); // Modified,2012/01/16 Saito
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1796
    s_sub_qd(&q0,&q1,&q2,&q3,1.0,p0,p1,p2,p3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1797
    qdsqrt(&c0[0],&c1[0],&c2[0],&c3[0],q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1798
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1799
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1800
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1801
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1802
// quad-double sine
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1803
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1804
// args
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1805
// a0, a1, a2, a3 : double numbers
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1806
// a0 + a1 + a2 + a3 = qd number
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1807
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1808
// return (s0,s1,s2,s3) for qd number
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1809
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1810
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1811
static void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1812
qdsin(double *s0, double *s1, double *s2, double *s3, double *a0, double *a1, double *a2, double *a3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1813
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1814
    double p0,p1,p2,p3, q0,q1,q2,q3, z0,z1,z2,z3, r0,r1,r2,r3, j, t0,t1,t2,t3, k,abs_k;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1815
    double _2pi[4] = {6.283185307179586232e+00,2.449293598294706414e-16,-5.989539619436679332e-33,2.224908441726730563e-49};  // 2*pi
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1816
    double _pi2[4] = {1.570796326794896558e+00,6.123233995736766036e-17,-1.497384904859169833e-33,5.562271104316826408e-50};  // pi/2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1817
    double _pi1024[4] = {3.067961575771282340e-03,1.195944139792337116e-19,-2.924579892303066080e-36,1.086381075061880158e-52};
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1818
    double u0,u1,u2,u3,v0,v1,v2,v3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1819
    double sin0,sin1,sin2,sin3,cos0,cos1,cos2,cos3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1820
    int int_j;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1821
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1822
    if(a0[0]==0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1823
	s0[0]=0.0; s1[0]=0.0; s2[0]=0.0; s3[0]=0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1824
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1825
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1826
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1827
    //approximately reduce modulo 2*pi
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1828
    qd_div_qd(&p0,&p1,&p2,&p3,a0[0],a1[0],a2[0],a3[0],_2pi[0],_2pi[1],_2pi[2],_2pi[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1829
    nint_qd(&z0,&z1,&z2,&z3,p0,p1,p2,p3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1830
    qd_mul_qd(&q0,&q1,&q2,&q3,_2pi[0],_2pi[1],_2pi[2],_2pi[3],z0,z1,z2,z3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1831
    qd_sub_qd(&r0,&r1,&r2,&r3,a0[0],a1[0],a2[0],a3[0],q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1832
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1833
    //approximately reduce modulo pi/2 and then modulo pi/1024
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1834
    j=floor(r0/_pi2[0]+0.5);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1835
    s_mul_qd(&p0, &p1, &p2, &p3, j, _pi2[0], _pi2[1], _pi2[2], _pi2[3]); // Modified,2012/01/16 Saito
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1836
    qd_sub_qd(&t0,&t1,&t2,&t3,r0,r1,r2,r3,p0,p1,p2,p3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1837
    k=floor(t0/_pi1024[0]+0.5);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1838
    s_mul_qd(&q0, &q1, &q2, &q3, k, _pi1024[0], _pi1024[1], _pi1024[2], _pi1024[3]); // Modified,2012/01/16 Saito
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1839
    qd_sub_qd(&t0,&t1,&t2,&t3,t0,t1,t2,t3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1840
    abs_k=(int)fabs(k);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1841
    int_j=(int)j;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1842
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1843
    //checking errors
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1844
    if(j<-2 || j>2) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1845
	s0[0]=0.0; s1[0]=0.0; s2[0]=0.0; s3[0]=1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1846
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1847
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1848
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1849
    if(abs_k >256) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1850
	s0[0]=0.0; s1[0]=0.0; s2[0]=0.0; s3[0]=1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1851
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1852
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1853
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1854
    if(k==0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1855
	switch(int_j) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1856
	    case 0:
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1857
		sin_taylor_qd(&s0[0],&s1[0],&s2[0],&s3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1858
		return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1859
	    case 1:
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1860
		cos_taylor_qd(&s0[0],&s1[0],&s2[0],&s3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1861
		return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1862
	    case -1:
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1863
		cos_taylor_qd(&s0[0],&s1[0],&s2[0],&s3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1864
		s0[0]=-s0[0]; s1[0]=-s1[0]; s2[0]=-s2[0]; s3[0]=-s3[0];
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1865
		return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1866
	    case 2:
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1867
	    case -2:
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1868
		sin_taylor_qd(&s0[0],&s1[0],&s2[0],&s3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1869
		s0[0]=-s0[0]; s1[0]=-s1[0]; s2[0]=-s2[0]; s3[0]=-s3[0];
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1870
		return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1871
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1872
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1873
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1874
    cos_table_qd(&u0,&u1,&u2,&u3,abs_k);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1875
    sin_table_qd(&v0,&v1,&v2,&v3,abs_k);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1876
    sincos_taylor_qd(&sin0,&sin1,&sin2,&sin3,&cos0,&cos1,&cos2,&cos3,t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1877
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1878
    if(j==0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1879
	if(k>0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1880
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1881
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1882
	    qd_add_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1883
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1884
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1885
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1886
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1887
	    qd_sub_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1888
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1889
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1890
    else if(j==1) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1891
	if(k>0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1892
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1893
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1894
	    qd_sub_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1895
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1896
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1897
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1898
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1899
	    qd_add_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1900
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1901
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1902
    else if(j==-1) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1903
	if(k>0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1904
	    qd_mul_qd(&p0,&p1,&p2,&p3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1905
	    qd_mul_qd(&q0,&q1,&q2,&q3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1906
	    qd_sub_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1907
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1908
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1909
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1910
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1911
	    p0=-p0; p1=-p1; p2=-p2; p3=-p3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1912
	    qd_sub_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1913
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1914
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1915
    else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1916
	if(k>0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1917
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1918
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1919
	    p0=-p0; p1=-p1; p2=-p2; p3=-p3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1920
	    qd_sub_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1921
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1922
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1923
	    qd_mul_qd(&p0,&p1,&p2,&p3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1924
	    qd_mul_qd(&q0,&q1,&q2,&q3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1925
	    qd_sub_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1926
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1927
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1928
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1929
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1930
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1931
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1932
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1933
// quad-double cosine
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1934
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1935
// args
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1936
// a0, a1, a2, a3 : double numbers
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1937
// a0 + a1 + a2 + a3 = qd number
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1938
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1939
// return (c0,c1,c2,c3) for qd number
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1940
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1941
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1942
static void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1943
qdcos(double *c0, double *c1, double *c2, double *c3, double *a0, double *a1, double *a2, double *a3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1944
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1945
    double p0,p1,p2,p3, q0,q1,q2,q3, z0,z1,z2,z3, r0,r1,r2,r3, j, t0,t1,t2,t3, k,abs_k;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1946
    double _2pi[4] = {6.283185307179586232e+00,2.449293598294706414e-16,-5.989539619436679332e-33,2.224908441726730563e-49};  // 2*pi
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1947
    double _pi2[4] = {1.570796326794896558e+00,6.123233995736766036e-17,-1.497384904859169833e-33,5.562271104316826408e-50};    // pi/2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1948
    double _pi1024[4] = {3.067961575771282340e-03,1.195944139792337116e-19,-2.924579892303066080e-36,1.086381075061880158e-52};
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1949
    double u0,u1,u2,u3,v0,v1,v2,v3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1950
    double sin0,sin1,sin2,sin3,cos0,cos1,cos2,cos3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1951
    int int_j;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1952
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1953
    if(a0[0]==0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1954
	c1[0]=1.0; c1[0]=0.0; c2[0]=0.0; c3[0]=0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1955
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1956
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1957
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1958
    //approximately reduce modulo 2*pi
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1959
    qd_div_qd(&p0,&p1,&p2,&p3,a0[0],a1[0],a2[0],a3[0],_2pi[0],_2pi[1],_2pi[2],_2pi[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1960
    nint_qd(&z0,&z1,&z2,&z3,p0,p1,p2,p3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1961
    qd_mul_qd(&q0,&q1,&q2,&q3,_2pi[0],_2pi[1],_2pi[2],_2pi[3],z0,z1,z2,z3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1962
    qd_sub_qd(&r0,&r1,&r2,&r3,a0[0],a1[0],a2[0],a3[0],q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1963
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1964
    //approximately reduce modulo pi/2 and then modulo pi/1024
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1965
    j=floor(r0/_pi2[0]+0.5);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1966
    s_mul_qd(&p0, &p1, &p2, &p3, j, _pi2[0], _pi2[1], _pi2[2], _pi2[3]); // Modified,2012/01/16 Saito
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1967
    qd_sub_qd(&t0,&t1,&t2,&t3,r0,r1,r2,r3,p0,p1,p2,p3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1968
    k=floor(t0/_pi1024[0]+0.5);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1969
    s_mul_qd(&q0, &q1, &q2, &q3, k, _pi1024[0], _pi1024[1], _pi1024[2], _pi1024[3]); // Modified,2012/01/16 Saito
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1970
    qd_sub_qd(&t0,&t1,&t2,&t3,t0,t1,t2,t3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1971
    abs_k=(int)fabs(k);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1972
    int_j=(int)j;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1973
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1974
    //checking errors
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1975
    if(j<-2 || j>2) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1976
	c0[0]=0.0; c1[0]=0.0; c2[0]=0.0; c3[0]=1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1977
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1978
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1979
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1980
    if(abs_k >256) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1981
	c0[0]=0.0; c1[0]=0.0; c2[0]=0.0; c3[0]=1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1982
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1983
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1984
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1985
    if(k==0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1986
	switch(int_j) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1987
	    case 0:
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1988
		cos_taylor_qd(&c0[0],&c1[0],&c2[0],&c3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1989
		return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1990
	    case 1:
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1991
		sin_taylor_qd(&c0[0],&c1[0],&c2[0],&c3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1992
		c0[0]=-c0[0]; c1[0]=-c1[0]; c2[0]=-c2[0]; c3[0]=-c3[0];
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1993
		return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1994
	    case -1:
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1995
		sin_taylor_qd(&c0[0],&c1[0],&c2[0],&c3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1996
		return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1997
	    case 2:
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1998
	    case -2:
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  1999
		cos_taylor_qd(&c0[0],&c1[0],&c2[2],&c3[0],t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2000
		c0[0]=-c0[0]; c1[0]=-c1[0]; c2[0]=-c2[0]; c3[0]=-c3[0];
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2001
		return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2002
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2003
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2004
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2005
    cos_table_qd(&u0,&u1,&u2,&u3,abs_k);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2006
    sin_table_qd(&v0,&v1,&v2,&v3,abs_k);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2007
    sincos_taylor_qd(&sin0,&sin1,&sin2,&sin3,&cos0,&cos1,&cos2,&cos3,t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2008
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2009
    if(j==0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2010
	if(k>0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2011
	    //u * cos_t - v * sin_t;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2012
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2013
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2014
	    qd_sub_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2015
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2016
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2017
	    //u * cos_t + v * sin_t;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2018
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2019
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2020
	    qd_add_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2021
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2022
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2023
    else if(j==1) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2024
	if(k>0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2025
	    //-u * sin_t - v * cos_t;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2026
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2027
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2028
	    p0=-p0; p1=-p1; p2=-p2; p3=-p3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2029
	    qd_sub_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2030
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2031
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2032
	    //v * cos_t - u * sin_t;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2033
	    qd_mul_qd(&p0,&p1,&p2,&p3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2034
	    qd_mul_qd(&q0,&q1,&q2,&q3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2035
	    qd_sub_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2036
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2037
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2038
    else if(j==-1) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2039
	if(k>0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2040
	    //u * sin_t + v * cos_t;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2041
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2042
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2043
	    qd_add_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2044
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2045
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2046
	    //u * sin_t - v * cos_t;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2047
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2048
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2049
	    qd_sub_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2050
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2051
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2052
    else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2053
	if(k>0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2054
	    //v * sin_t - u * cos_t;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2055
	    qd_mul_qd(&p0,&p1,&p2,&p3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2056
	    qd_mul_qd(&q0,&q1,&q2,&q3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2057
	    qd_sub_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2058
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2059
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2060
	    //-u * cos_t - v * sin_t;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2061
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2062
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2063
	    p0=-p0; p1=-p1; p2=-p2; p3=-p3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2064
	    qd_sub_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2065
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2066
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2067
    return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2068
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2069
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2070
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2071
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2072
// quad-double sine and cosine
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2073
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2074
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2075
static INLINE void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2076
sincos_qd(double *s0, double *s1, double *s2, double *s3, double *c0, double *c1, double *c2, double *c3, double a0, double a1, double a2, double a3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2077
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2078
    double p0,p1,p2,p3, q0,q1,q2,q3, z0,z1,z2,z3, r0,r1,r2,r3, j, t0,t1,t2,t3, k,abs_k;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2079
    double _2pi[4] = {6.283185307179586232e+00,2.449293598294706414e-16,-5.989539619436679332e-33,2.224908441726730563e-49};  // 2*pi
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2080
    double _pi2[4] = {1.570796326794896558e+00,6.123233995736766036e-17,-1.497384904859169833e-33,5.562271104316826408e-50};    // pi/2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2081
    double _pi1024[4] = {3.067961575771282340e-03,1.195944139792337116e-19,-2.924579892303066080e-36,1.086381075061880158e-52};
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2082
    double u0,u1,u2,u3,v0,v1,v2,v3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2083
    double sin0,sin1,sin2,sin3,cos0,cos1,cos2,cos3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2084
    int int_j;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2085
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2086
    if(a0==0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2087
	s0[0]=0.0; s1[0]=0.0; s2[0]=0.0; s3[0]=0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2088
	c0[0]=1.0; c1[0]=0.0; c2[0]=0.0; c3[0]=0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2089
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2090
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2091
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2092
    //approximately reduce modulo 2*pi
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2093
    qd_div_qd(&p0,&p1,&p2,&p3,a0,a1,a2,a3,_2pi[0],_2pi[1],_2pi[2],_2pi[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2094
    nint_qd(&z0,&z1,&z2,&z3,p0,p1,p2,p3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2095
    qd_mul_qd(&q0,&q1,&q2,&q3,_2pi[0],_2pi[1],_2pi[2],_2pi[3],z0,z1,z2,z3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2096
    qd_sub_qd(&r0,&r1,&r2,&r3,a0,a1,a2,a3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2097
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2098
    //approximately reduce modulo pi/2 and then modulo pi/1024
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2099
    j=floor(r0/_pi2[0]+0.5);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2100
    s_mul_qd(&p0, &p1, &p2, &p3, j, _pi2[0], _pi2[1], _pi2[2], _pi2[3]); // Modified,2012/01/16 Saito
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2101
    qd_sub_qd(&t0,&t1,&t2,&t3,r0,r1,r2,r3,p0,p1,p2,p3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2102
    k=floor(t0/_pi1024[0]+0.5);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2103
    s_mul_qd(&q0, &q1, &q2, &q3, k, _pi1024[0], _pi1024[1], _pi1024[2], _pi1024[3]); // Modified,2012/01/16 Saito
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2104
    qd_sub_qd(&t0,&t1,&t2,&t3,t0,t1,t2,t3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2105
    abs_k=(int)fabs(k);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2106
    int_j=(int)j;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2107
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2108
    //checking errors
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2109
    if(j<-2 || j>2) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2110
	s0[0]=0.0; s1[0]=0.0; s2[0]=0.0; s3[0]=1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2111
	c0[0]=0.0; c1[0]=0.0; c2[0]=0.0; c3[0]=1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2112
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2113
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2114
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2115
    if(abs_k >256) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2116
	s0[0]=0.0; s1[0]=0.0; s2[0]=0.0; s3[0]=1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2117
	c0[0]=0.0; c1[0]=0.0; c2[0]=0.0; c3[0]=1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2118
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2119
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2120
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2121
    sincos_taylor_qd(&sin0,&sin1,&sin2,&sin3,&cos0,&cos1,&cos2,&cos3,t0,t1,t2,t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2122
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2123
    if(k==0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2124
	if(j==0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2125
	    s0[0]=sin0; s1[0]=sin1; s2[0]=sin2; s3[0]=sin3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2126
	    c0[0]=cos0; c1[0]=cos1; c2[0]=cos2; c3[0]=cos3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2127
	    return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2128
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2129
	else if(j==1) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2130
	    s0[0]=cos0; s1[0]=cos1; s2[0]=cos2; s3[0]=cos3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2131
	    c0[0]=-sin0; c1[0]=-sin1; c2[0]=-sin2; c3[0]=-sin3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2132
	    return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2133
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2134
	else if(j==-1) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2135
	    s0[0]=-cos0; s1[0]=-cos1; s2[0]=-cos2; s3[0]=-cos3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2136
	    c0[0]=sin0; c1[0]=sin1; c2[0]=sin2; c3[0]=sin3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2137
	    return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2138
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2139
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2140
	    s0[0]=-sin0; s1[0]=-sin1; s2[0]=-sin2; s3[0]=-sin3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2141
	    c0[0]=-cos0; c1[0]=-cos1; c2[0]=-cos2; c3[0]=-cos3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2142
	    return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2143
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2144
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2145
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2146
    cos_table_qd(&u0,&u1,&u2,&u3,abs_k);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2147
    sin_table_qd(&v0,&v1,&v2,&v3,abs_k);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2148
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2149
    if(j==0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2150
	if(k>0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2151
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2152
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2153
	    qd_add_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2154
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2155
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2156
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2157
	    qd_sub_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2158
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2159
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2160
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2161
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2162
	    qd_sub_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2163
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2164
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2165
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2166
	    qd_add_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2167
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2168
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2169
    else if(j==1) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2170
	if(k>0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2171
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2172
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2173
	    qd_sub_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2174
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2175
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2176
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2177
	    p0=-p0; p1=-p1; p2=-p2; p3=-p3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2178
	    qd_sub_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2179
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2180
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2181
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2182
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2183
	    qd_add_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2184
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2185
	    qd_mul_qd(&p0,&p1,&p2,&p3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2186
	    qd_mul_qd(&q0,&q1,&q2,&q3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2187
	    qd_sub_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2188
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2189
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2190
    else if(j==-1) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2191
	if(k>0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2192
	    qd_mul_qd(&p0,&p1,&p2,&p3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2193
	    qd_mul_qd(&q0,&q1,&q2,&q3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2194
	    qd_sub_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2195
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2196
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2197
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2198
	    qd_add_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2199
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2200
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2201
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2202
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2203
	    p0=-p0; p1=-p1; p2=-p2; p3=-p3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2204
	    qd_sub_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2205
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2206
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2207
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2208
	    qd_sub_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2209
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2210
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2211
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2212
    else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2213
	if(k>0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2214
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2215
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2216
	    p0=-p0; p1=-p1; p2=-p2; p3=-p3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2217
	    qd_sub_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2218
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2219
	    qd_mul_qd(&p0,&p1,&p2,&p3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2220
	    qd_mul_qd(&q0,&q1,&q2,&q3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2221
	    qd_sub_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2222
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2223
	else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2224
	    qd_mul_qd(&p0,&p1,&p2,&p3,v0,v1,v2,v3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2225
	    qd_mul_qd(&q0,&q1,&q2,&q3,u0,u1,u2,u3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2226
	    qd_sub_qd(&s0[0],&s1[0],&s2[0],&s3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2227
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2228
	    qd_mul_qd(&p0,&p1,&p2,&p3,u0,u1,u2,u3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2229
	    qd_mul_qd(&q0,&q1,&q2,&q3,v0,v1,v2,v3,sin0,sin1,sin2,sin3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2230
	    p0=-p0; p1=-p1; p2=-p2; p3=-p3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2231
	    qd_sub_qd(&c0[0],&c1[0],&c2[0],&c3[0],p0,p1,p2,p3,q0,q1,q2,q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2232
	}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2233
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2234
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2235
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2236
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2237
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2238
// quad-double tangent
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2239
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2240
// args
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2241
// a0, a1, a2, a3 : double numbers
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2242
// a0 + a1 + a2 + a3 = qd number
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2243
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2244
// return (t0,t1,t2,t3) for qd number
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2245
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2246
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2247
static void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2248
qdtan(double *t0, double *t1, double *t2, double *t3, double *a0, double *a1, double *a2, double *a3)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2249
{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2250
    double sin0,sin1,sin2,sin3,cos0,cos1,cos2,cos3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2251
    sincos_qd(&sin0,&sin1,&sin2,&sin3,&cos0,&cos1,&cos2,&cos3,a0[0],a1[0],a2[0],a3[0]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2252
    qd_div_qd(&t0[0],&t1[0],&t2[0],&t3[0],sin0,sin1,sin2,sin3,cos0,cos1,cos2,cos3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2253
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2254
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2255
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2256
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2257
// quad-double exponent
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2258
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2259
// args
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2260
// x0, x1, x2, x3 : double numbers
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2261
// x0 + x1 + x2 + x3 = qd number
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2262
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2263
// return (e0, e1, e2, e3) for qd number
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2264
//
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2265
//--------------------------------------------------------------------------------------------
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2266
static void
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2267
qdexp(double *e0, double *e1, double *e2, double *e3, double *x0, double *x1, double *x2, double *x3) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2268
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2269
    double k = ldexp(1.0,16);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2270
    double inv_k = 1.0 / k;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2271
    double log_2[4] = {6.931471805599452862e-01,2.319046813846299558e-17,5.707708438416212066e-34,-3.582432210601811423e-50};
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2272
    double m, p0,p1,p2,p3, q0,q1,q2,q3, r0,r1,r2,r3, s0,s1,s2,s3, t0,t1,t2,t3, v0,v1,v2,v3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2273
    int i;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2274
    double t=1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2275
    double eps = 1.21543267145725e-63; // = 2^-209
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2276
    double thresh = inv_k * eps;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2277
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2278
    if((x0[0]==0.0) && (x1[0]==0.0) && (x2[0]==0.0) && (x3[0]==0.0)) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2279
	e0[0] = 1.0;    e1[0] = 0.0;    e2[0] = 0.0;    e3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2280
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2281
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2282
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2283
    if((x0[0]==1.0) && (x1[0]==0.0) && (x2[0]==0.0) && (x3[0]==0.0)) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2284
	e0[0] = 2.7182818284590451;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2285
	e1[0] = 1.4456468917292502e-16;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2286
	e2[0] = -2.127717108038176765e-33;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2287
	e3[0] = 1.515630159841218954e-49;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2288
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2289
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2290
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2291
    if(x0[0]<=-709) {               //underflow
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2292
	e0[0] = 0.0;    e1[0] = 0.0;    e2[0] = 0.0;    e3[0] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2293
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2294
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2295
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2296
    if(x0[0]>=709) {                //overflow
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2297
	e0[0] = 0.0;    e1[0] = 1.0;    e2[0] = 2.0;    e3[0] = 3.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2298
	return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2299
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2300
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2301
    m = floor(x0[0] / log_2[0] + 0.5);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2302
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2303
    s_mul_qd(&p0, &p1, &p2, &p3, m, log_2[0], log_2[1], log_2[2], log_2[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2304
    qd_sub_qd(&q0, &q1, &q2, &q3, x0[0], x1[0], x2[0], x3[0], p0, p1, p2, p3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2305
    r0 = q0 * inv_k;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2306
    r1 = q1 * inv_k;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2307
    r2 = q2 * inv_k;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2308
    r3 = q3 * inv_k;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2309
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2310
    qd_sqr(&p0, &p1, &p2, &p3, r0, r1, r2, r3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2311
    qd_add_qd(&s0, &s1, &s2, &s3, r0, r1, r2, r3, 0.5*p0, 0.5*p1, 0.5*p2, 0.5*p3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2312
    i = 0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2313
    do {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2314
	qd_mul_qd(&p0, &p1, &p2, &p3, p0, p1, p2, p3, r0, r1, r2, r3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2315
	qd_mul_qd(&t0, &t1, &t2, &t3, p0, p1, p2, p3, inv_fact[i][0], inv_fact[i][1], inv_fact[i][2], inv_fact[i][3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2316
	i = i+1;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2317
	qd_add_qd(&s0, &s1, &s2, &s3, s0, s1, s2, s3, t0, t1, t2, t3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2318
    } while ((i<=17) && (fabs(t0)>thresh));
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2319
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2320
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2321
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2322
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //1
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2323
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2324
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2325
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2326
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //3
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2327
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2328
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //4
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2329
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2330
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //5
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2331
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2332
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //6
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2333
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2334
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //7
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2335
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2336
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //8
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2337
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2338
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //9
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2339
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2340
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //10
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2341
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2342
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //11
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2343
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2344
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //12
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2345
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2346
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //13
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2347
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2348
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //14
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2349
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2350
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //15
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2351
    qd_sqr(&v0, &v1, &v2, &v3, s0, s1, s2, s3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2352
    qd_add_qd(&s0, &s1, &s2, &s3, 2.0*s0, 2.0*s1, 2.0*s2, 2.0*s3, v0, v1, v2, v3);    //16
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2353
    qd_add_s(&s0, &s1, &s2, &s3, s0, s1, s2, s3, 1.0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2354
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2355
    for(i=0; i<m; i++) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2356
	    t=t*2;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2357
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2358
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2359
    e0[0] = s0*t;    e1[0] = s1*t;    e2[0] = s2*t;    e3[0] = s3*t;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2360
    return;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2361
}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2362
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2363
#if 0
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2364
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2365
/*********** Basic Functions ************/
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2366
/* Computes fl(a+b) and err(a+b).  Assumes |a| >= |b|. */
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2367
INLINE double
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2368
quick_two_sum(double a, double b, double *errPtr) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2369
  double s = a + b;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2370
  *errPtr = b - (s - a);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2371
  return s;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2372
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2373
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2374
/* Computes fl(a-b) and err(a-b).  Assumes |a| >= |b| */
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2375
INLINE double
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2376
quick_two_diff(double a, double b, double *errPtr) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2377
  double s = a - b;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2378
  *errPtr = (a - s) - b;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2379
  return s;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2380
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2381
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2382
/* Computes fl(a+b) and err(a+b).  */
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2383
INLINE double
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2384
two_sum(double a, double b, double *errPtr) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2385
  double s = a + b;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2386
  double bb = s - a;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2387
  *errPtr = (a - (s - bb)) + (b - bb);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2388
  return s;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2389
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2390
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2391
/* Computes fl(a-b) and err(a-b).  */
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2392
INLINE double
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2393
two_diff(double a, double b, double *errPtr) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2394
  double s = a - b;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2395
  double bb = s - a;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2396
  *errPtr = (a - (s - bb)) - (b + bb);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2397
  return s;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2398
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2399
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2400
#ifndef QD_FMS
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2401
/* Computes high word and lo word of a */
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2402
INLINE void
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2403
split(double a, double *hiPtr, double *loPtr) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2404
  double temp;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2405
  if (a > _QD_SPLIT_THRESH || a < -_QD_SPLIT_THRESH) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2406
    a *= 3.7252902984619140625e-09;  // 2^-28
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2407
    temp = _QD_SPLITTER * a;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2408
    *hiPtr = temp - (temp - a);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2409
    *loPtr = a - *hiPtr;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2410
    *hiPtr *= 268435456.0;          // 2^28
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2411
    *loPtr *= 268435456.0;          // 2^28
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2412
  } else {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2413
    temp = _QD_SPLITTER * a;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2414
    *hiPtr = temp - (temp - a);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2415
    *loPtr = a - *hiPtr;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2416
  }
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2417
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2418
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2419
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2420
/* Computes fl(a*b) and err(a*b). */
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2421
INLINE double
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2422
two_prod(double a, double b, double *errPtr) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2423
#ifdef QD_FMS
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2424
  double p = a * b;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2425
  *errPtr = QD_FMS(a, b, p);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2426
  return p;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2427
#else
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2428
  double a_hi, a_lo, b_hi, b_lo;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2429
  double p = a * b;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2430
  split(a, &a_hi, &a_lo);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2431
  split(b, &b_hi, &b_lo);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2432
  *errPtr = ((a_hi * b_hi - p) + a_hi * b_lo + a_lo * b_hi) + a_lo * b_lo;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2433
  return p;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2434
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2435
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2436
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2437
/* Computes fl(a*a) and err(a*a).  Faster than the above method. */
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2438
INLINE double
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2439
two_sqr(double a, double *errPtr) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2440
#ifdef QD_FMS
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2441
  double p = a * a;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2442
  *errPtr = QD_FMS(a, a, p);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2443
  return p;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2444
#else
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2445
  double hi, lo;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2446
  double q = a * a;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2447
  split(a, &hi, &lo);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2448
  *errPtr = ((hi * hi - q) + 2.0 * hi * lo) + lo * lo;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2449
  return q;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2450
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2451
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2452
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2453
/* Computes the nearest integer to d. */
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2454
INLINE double
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2455
nint(double d) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2456
  if (d == floor(d))
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2457
    return d;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2458
  return floor(d + 0.5);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2459
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2460
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2461
/* Computes the truncated integer. */
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2462
INLINE double
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2463
aint(double d) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2464
  return (d >= 0.0) ? floor(d) : ceil(d);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2465
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2466
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2467
INLINE void
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2468
renorm4(double *c0Ptr, double *c1Ptr, double *c2Ptr, double *c3Ptr) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2469
  double s0, s1, s2 = 0.0, s3 = 0.0;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2470
  double c0 = *c0Ptr;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2471
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2472
  if (isinf(c0)) return;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2473
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2474
  s0 = quick_two_sum(*c2Ptr, *c3Ptr, c3Ptr);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2475
  s0 = quick_two_sum(*c1Ptr, s0, c2Ptr);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2476
  c0 = quick_two_sum(c0, s0, c1Ptr);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2477
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2478
  s0 = c0;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2479
  s1 = *c1Ptr;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2480
  if (s1 != 0.0) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2481
    s1 = quick_two_sum(s1, *c2Ptr, &s2);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2482
    if (s2 != 0.0)
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2483
      s2 = quick_two_sum(s2, *c3Ptr, &s3);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2484
    else
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2485
      s1 = quick_two_sum(s1, *c3Ptr, &s2);
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2486
  } else {
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2487
    s0 = quick_two_sum(s0, *c2Ptr, &s1);
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2488
    if (s1 != 0.0)
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2489
      s1 = quick_two_sum(s1, *c3Ptr, &s2);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2490
    else
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2491
      s0 = quick_two_sum(s0, *c3Ptr, &s1);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2492
  }
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2493
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2494
  *c0Ptr = s0;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2495
  *c1Ptr = s1;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2496
  *c2Ptr = s2;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2497
  *c3Ptr = s3;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2498
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2499
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2500
INLINE void
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2501
renorm5(double *c0Ptr, double *c1Ptr, double *c2Ptr, double *c3Ptr, double *c4Ptr) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2502
  double s0, s1, s2 = 0.0, s3 = 0.0;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2503
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2504
  if (isinf(*c0Ptr)) return;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2505
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2506
  s0 = quick_two_sum(*c3Ptr, *c4Ptr, c4Ptr);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2507
  s0 = quick_two_sum(*c2Ptr, s0, c3Ptr);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2508
  s0 = quick_two_sum(*c1Ptr, s0, c2Ptr);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2509
  *c0Ptr = quick_two_sum(*c0Ptr, s0, c1Ptr);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2510
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2511
  s0 = *c0Ptr;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2512
  s1 = *c1Ptr;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2513
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2514
  s0 = quick_two_sum(*c0Ptr, *c1Ptr, &s1);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2515
  if (s1 != 0.0) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2516
    s1 = quick_two_sum(s1, *c2Ptr, &s2);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2517
    if (s2 != 0.0) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2518
      s2 =quick_two_sum(s2, *c3Ptr, &s3);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2519
      if (s3 != 0.0)
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2520
	s3 += *c4Ptr;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2521
      else
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2522
	s2 += *c4Ptr;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2523
    } else {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2524
      s1 = quick_two_sum(s1, *c3Ptr, &s2);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2525
      if (s2 != 0.0)
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2526
	s2 = quick_two_sum(s2, *c4Ptr, &s3);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2527
      else
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2528
	s1 = quick_two_sum(s1, *c4Ptr, &s2);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2529
    }
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2530
  } else {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2531
    s0 = quick_two_sum(s0, *c2Ptr, &s1);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2532
    if (s1 != 0.0) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2533
      s1 = quick_two_sum(s1, *c3Ptr, &s2);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2534
      if (s2 != 0.0)
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2535
	s2 = quick_two_sum(s2, *c4Ptr, &s3);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2536
      else
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2537
	s1 = quick_two_sum(s1, *c4Ptr, &s2);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2538
    } else {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2539
      s0 = quick_two_sum(s0, *c3Ptr, &s1);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2540
      if (s1 != 0.0)
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2541
	s1 = quick_two_sum(s1, *c4Ptr, &s2);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2542
      else
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2543
	s0 = quick_two_sum(s0, *c4Ptr, &s1);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2544
    }
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2545
  }
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2546
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2547
  *c0Ptr = s0;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2548
  *c1Ptr = s1;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2549
  *c2Ptr = s2;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2550
  *c3Ptr = s3;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2551
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2552
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2553
INLINE void
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2554
three_sum(double *aPtr, double *bPtr, double *cPtr) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2555
  double t1, t2, t3;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2556
  t1 = two_sum(*aPtr, *bPtr, &t2);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2557
  *aPtr  = two_sum(*cPtr, t1, &t3);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2558
  *bPtr  = two_sum(t2, t3, cPtr);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2559
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2560
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2561
INLINE void three_sum2(double *aPtr, double *bPtr, double *cPtr) {
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2562
  double t1, t2, t3;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2563
  t1 = two_sum(*aPtr, *bPtr, &t2);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2564
  *aPtr  = two_sum(*cPtr, t1, &t3);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2565
  *bPtr = t2 + t3;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2566
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2567
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2568
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2569
#if 0
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2570
/* These are provided to give consistent
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2571
   interface for double with double-double and quad-double. */
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2572
INLINE void
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2573
sincosh(double t, double &sinh_t, double &cosh_t) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2574
  sinh_t = sinh(t);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2575
  cosh_t = cosh(t);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2576
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2577
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2578
INLINE double
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2579
sqr(double t) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2580
  return t * t;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2581
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2582
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2583
INLINE double
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2584
to_double(double a) {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2585
    return a;
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2586
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2587
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2588
INLINE int
4413
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2589
to_int(double a)    {
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2590
    return static_cast<int>(a);
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2591
}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2592
#endif
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2593
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2594
%}
e3ee8be3627f oops - cvs messed it
Claus Gittinger <cg@exept.de>
parents: 4412
diff changeset
  2595
! !
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2596
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2597
!QDouble class methodsFor:'documentation'!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2598
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2599
copyright
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2600
"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2601
 COPYRIGHT (c) 2017 by eXept Software AG
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2602
	      All Rights Reserved
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2603
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2604
 This software is furnished under a license and may be used
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2605
 only in accordance with the terms of that license and with the
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2606
 inclusion of the above copyright notice.   This software may not
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2607
 be provided or otherwise made available to, or used by, any
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2608
 other person.  No title to or ownership of the software is
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2609
 hereby transferred.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2610
"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2611
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2612
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2613
documentation
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2614
"
4391
f2ece85e1ae3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4390
diff changeset
  2615
    ATTENTION: ongoing, unfinished work.
4450
c832d7890dda #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4447
diff changeset
  2616
    No warranty that this works correctly...
4391
f2ece85e1ae3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4390
diff changeset
  2617
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2618
    QDoubles represent rational numbers with extended, but still limited precision.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2619
4451
1550f45dc062 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4450
diff changeset
  2620
    In contrast to Floats (which use the C-compiler's native 64bit 'double' format),
4430
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  2621
    QDoubles give you roughly 200 bit or approx. 60 decimal digits of precision.
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2622
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2623
    Representation:
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2624
	QDoubles use 4 IEEE doubles, each keeping 53 bits of precision.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2625
	A qDouble's value is the sum of those 4 doubles,
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2626
	and a qDouble keeps this unevaluated sum as its state.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2627
	(due to overlap and rounding, the final precision is less than 53*4)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2628
	The exponent range is still the double exponent range,
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2629
	but the number of mantissa bits is rougly multiplied by 4.
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2630
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2631
    Range and Precision of Storage Formats: see LimitedPrecisionReal >> documentation
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2632
    The number of decmal digits:
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2633
	QDouble decimalPrecision     -> 61
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2634
	LongFloat decimalPrecision   -> 19
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2635
	Float decimalPrecision       -> 16
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2636
	ShortFloat decimalPrecision  -> 7
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2637
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2638
    The number of bits:
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2639
	QDouble precision            -> 204
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2640
	LongFloat precision          -> 64
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2641
	Float precision              -> 53
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2642
	ShortFloat precision         -> 24
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2643
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2644
    Notice:
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2645
	when assigning a converted double precision number as in:
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2646
	    qd := 1.0 asQDouble.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2647
	you still get only a regular double precision approximation to 0.1
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2648
	because the error is already inherit in the double.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2649
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2650
	For a full precision constant, you (currently) need to convert from a string
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2651
	(because the compilers do not know about them, yet):
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2652
	    qd := QDouble readFrom:'0.1'.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2653
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2654
	To see the error of the double precision version, compute:
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2655
	    (0.1 asQDouble) - (QDouble readFrom:'0.1')
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2656
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2657
    [author:]
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2658
	Claus Gittinger
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2659
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2660
    [see also:]
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2661
	Number
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2662
	Float ShortFloat LongFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2663
	Fraction FixedPoint Integer Complex
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2664
	FloatArray DoubleArray
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2665
"
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2666
!
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2667
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2668
examples
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2669
"
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2670
  Floats, LongFloats suffer from loosing bits:
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2671
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2672
     (Float readFrom:'0.3333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2673
    -(Float readFrom:'0.333333333333333333333333333333333333333333333333333333333')
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2674
	-> 0.0
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2675
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2676
       (Float readFrom:'0.3333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2677
     = (Float readFrom:'0.333333333333333333333333333333333333333333333333333333333')
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2678
	-> true
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2679
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2680
       (Float readFrom:'0.33333333333333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2681
     = (Float readFrom:'0.3333333333333333333333333333333333333333333333333333333333333333333')
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2682
	-> true
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2683
1000 0110 1000 0101 1000 0101 1000 0101 1000 0101 1000 0101 1101 0101 0011 1111
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2684
       (Float readFrom:'0.3333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2685
     = (Float readFrom:'0.3333333333333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2686
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2687
     (LongFloat readFrom:'0.3333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2688
    -(LongFloat readFrom:'0.333333333333333333333333333333333333333333333333333333333')
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2689
	-> 0.0
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2690
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2691
      (LongFloat readFrom:'0.3333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2692
    = (LongFloat readFrom:'0.333333333333333333333333333333333333333333333333333333333')
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2693
	-> 0.0
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2694
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2695
 (QDouble readFrom:'0.3333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2696
-(QDouble readFrom:'0.333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2697
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2698
 (QDouble readFrom:'0.33333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2699
-(QDouble readFrom:'0.3333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2700
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2701
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2702
 (QDouble readFrom:'0.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2703
-(QDouble readFrom:'0.3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333')
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2704
"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2705
! !
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2706
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2707
!QDouble class methodsFor:'instance creation'!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2708
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2709
basicNew
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2710
    "return a new quad-precision double - here we return 0.0
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2711
     Notice that numbers are usually NOT created this way ...
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2712
     It's implemented here to allow things like binary store & load
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2713
     of floats. (but even this support will go away eventually, it's not
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2714
     a good idea to store the bits of a float - the reader might have a
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2715
     totally different representation - so floats should be
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2716
     binary stored in a device independent format."
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2717
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2718
%{  /* NOCONTEXT */
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2719
#ifdef __SCHTEAM__
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2720
    ERROR("trying to instantiate a qDouble");
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2721
#else
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2722
    OBJ newQD;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2723
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2724
    __qNew_qdReal(newQD, 0.0, 0.0, 0.0, 0.0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2725
    RETURN (newQD);
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2726
#endif /* not SCHTEAM */
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2727
%}
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2728
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2729
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2730
     self basicNew
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2731
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2732
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2733
    "Created: / 12-06-2017 / 16:00:38 / cg"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2734
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2735
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2736
d0:d0 d1:d1 d2:d2 d3:d3
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2737
    "return a new quad-precision double from individual double components"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2738
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2739
%{  /* NOCONTEXT */
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2740
#ifdef __SCHTEAM__
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2741
    ERROR("trying to instantiate a qDouble");
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2742
#else
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2743
    OBJ newQD;
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2744
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2745
    if (__isFloatLike(d0)
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2746
     && __isFloatLike(d1)
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2747
     && __isFloatLike(d2)
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2748
     && __isFloatLike(d3)) {
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2749
	__qNew_qdReal(newQD, __floatVal(d0), __floatVal(d1),
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2750
			     __floatVal(d2), __floatVal(d3));
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2751
	RETURN (newQD);
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2752
    }
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2753
#endif
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2754
%}.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2755
    self error:'invalid argument'
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2756
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2757
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2758
     self d0: 3.141592653589793116e+00
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2759
	  d1: 1.224646799147353207e-16
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2760
	  d2: -2.994769809718339666e-33
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2761
	  d3: 1.112454220863365282e-49
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2762
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2763
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2764
    "Created: / 12-06-2017 / 20:17:14 / cg"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2765
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2766
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2767
fromDoubleArray:aDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2768
    "return a new quad-precision double from coercing a double array"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2769
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2770
%{  /* NOCONTEXT */
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2771
#ifdef __SCHTEAM__
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2772
    ERROR("trying to instantiate a qDouble");
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2773
#else
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2774
    OBJ newQD;
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2775
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2776
    if (__isDoubleArray(aDoubleArray)) {
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2777
	double* __d__ =  __DoubleArrayInstPtr(aDoubleArray)->d_element;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2778
	__qNew_qdReal(newQD, __d__[0], __d__[1], __d__[2], __d__[3]);
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2779
	RETURN (newQD);
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2780
    }
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2781
#endif
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2782
%}.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2783
    self error:'invalid argument'
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2784
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2785
    "
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2786
     self fromDoubleArray(DoubleArray
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2787
				with: 3.141592653589793116e+00
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2788
				with: 1.224646799147353207e-16
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2789
				with: -2.994769809718339666e-33
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2790
				with: 1.112454220863365282e-49)
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2791
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2792
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2793
    "Created: / 12-06-2017 / 18:25:32 / cg"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2794
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2795
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2796
fromFloat:aFloat
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2797
    "return a new quad-precision double from coercing aFloat"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2798
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2799
%{  /* NOCONTEXT */
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2800
#ifdef __SCHTEAM__
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2801
    ERROR("trying to instantiate a qDouble");
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2802
#else
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2803
    double dVal;
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2804
    OBJ newQD;
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2805
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2806
    if (__isFloatLike(aFloat)) {
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2807
	dVal = __floatVal(aFloat);
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2808
    } else if (__isShortFloat(aFloat)) {
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2809
	dVal = __shortFloatVal(aFloat);
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2810
    } else {
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2811
	goto badArg;
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2812
    }
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2813
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2814
    __qNew_qdReal(newQD, dVal, 0.0, 0.0, 0.0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2815
    RETURN (newQD);
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2816
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2817
badArg: ;
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2818
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2819
#endif
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2820
%}.
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2821
    self argumentError:'invalid (non-float) argument'
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2822
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2823
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2824
     self fromFloat:1.0
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2825
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2826
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2827
    "Created: / 12-06-2017 / 16:06:54 / cg"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2828
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2829
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2830
fromInteger:anInteger
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2831
    "return a new quad-precision double from coercing anInteger"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2832
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2833
%{  /* NOCONTEXT */
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2834
#ifdef __SCHTEAM__
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2835
    ERROR("trying to instantiate a qDouble");
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2836
#else
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2837
    OBJ newQD;
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2838
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2839
    if (__isSmallInteger(anInteger)) {
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2840
	INT iVal = __smallIntegerVal(anInteger);
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2841
	double *__d__;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2842
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2843
	__qNew(newQD, sizeof(struct __qDoubleStruct));
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2844
	__stx_setClass(newQD, QDouble);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2845
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2846
	__d__ = __QDoubleInstPtr(newQD)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2847
	__d__[1] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2848
	__d__[2] = 0.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2849
	__d__[3] = 0.0;
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2850
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2851
	// need more than 52bits?
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2852
	if ((sizeof(INT) > 52)
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2853
	 && ((iVal > 0xFFFFFFFFFFFFF) || (iVal < -0xFFFFFFFFFFFFF))) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2854
	    __d__[0] = (double)(iVal & ~0xFFFFFFFF);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2855
	    __d__[1] = (double)(iVal & 0xFFFFFFFF);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2856
	    renorm(&(__d__[0]), &(__d__[1]), &(__d__[2]), &(__d__[3]), __d__[0], __d__[0], __d__[0], __d__[0], 0.0);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2857
	    // renorm4(&(a[0]), &(a[1]), &(a[2]), &(a[3]));
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2858
	} else {
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2859
	    __d__[0] = (double)iVal;
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2860
	}
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2861
	RETURN (newQD);
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2862
    }
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2863
#endif
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2864
%}.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2865
    ^ super fromInteger:anInteger
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2866
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2867
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2868
     self fromInteger:2
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2869
     self fromInteger:16rFFFFFFFF            -- 32bit 4294967295.0
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2870
     self fromInteger:16rFFFFFFFFFFFF        -- 48bit 281474976710655.0
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2871
     self fromInteger:16rFFFFFFFFFFFFF       -- 52bit 4503599627370495.0
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2872
     self fromInteger:16rFFFFFFFFFFFFFF      -- 56bit 72057594037927935.0
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2873
     self fromInteger:16rFFFFFFFFFFFFFFF     -- 60bit 1152921504606846975.0
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2874
     self fromInteger:16r1FFFFFFFFFFFFFFF    -- 61bit 2305843009213693951.0
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2875
     self fromInteger:16r3FFFFFFFFFFFFFFF    -- 62bit 4611686018427387903.0
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2876
     self fromInteger:16r7FFFFFFFFFFFFFFF    -- 63bit 9223372036854775807.0
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2877
     self fromInteger:16rFFFFFFFFFFFFFFFF    -- 64bit 18446744073709551615.0
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2878
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2879
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2880
    "Created: / 12-06-2017 / 16:10:10 / cg"
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  2881
    "Modified: / 04-07-2017 / 12:51:52 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2882
! !
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2883
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2884
!QDouble class methodsFor:'coercing & converting'!
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2885
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2886
coerce:aNumber
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2887
    "convert the argument aNumber into an instance of the receiver's class and return it."
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2888
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2889
    ^ aNumber asQDouble
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2890
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2891
    "Created: / 12-06-2017 / 17:13:47 / cg"
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2892
    "Modified: / 12-06-2017 / 21:09:06 / cg"
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2893
! !
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  2894
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2895
!QDouble class methodsFor:'constants'!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2896
4440
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  2897
NaN
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  2898
    "return a QDouble which represents not-a-Number (i.e. an invalid number)"
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  2899
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  2900
    NaN isNil ifTrue:[
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  2901
	NaN := self d0:(Float NaN) d1:(Float NaN) d2:(Float NaN) d3:(Float NaN)
4440
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  2902
    ].
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  2903
    ^ NaN
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  2904
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  2905
    "Created: / 21-06-2017 / 20:44:57 / cg"
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  2906
!
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  2907
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2908
e
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2909
    "return the constant e as quad precision double.
4433
37d85359188d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  2910
     (returns approx. 200 bits of precision)"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2911
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2912
    E isNil ifTrue:[
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2913
	E := self d0: 2.718281828459045091e+00
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2914
		  d1: 1.445646891729250158e-16
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2915
		  d2: -2.127717108038176765e-33
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2916
		  d3: 1.515630159841218954e-49
4388
742f099741bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4387
diff changeset
  2917
    ].
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2918
    ^ E
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2919
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2920
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2921
     self e printfPrintString:'%.61f'
5304
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  2922
       -> '2.7182818284590452353602874713526624977572470936999595749669676'
5288
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  2923
     Wolfram says:
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2924
	   2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2925
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2926
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2927
    "Created: / 12-06-2017 / 18:29:36 / cg"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2928
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2929
4392
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2930
fmax
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2931
    "return the constant e as quad precision double.
4433
37d85359188d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  2932
     (returns approx. 200 bits of precision)"
4392
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2933
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2934
    FMax isNil ifTrue:[
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2935
	FMax := self d0: 1.797693134862314E+308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2936
		     d1: 9.97920154767359795037e+291
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2937
		     d2: 5.53956966280111259858e+275
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2938
		     d3: 3.07507889307840487279e+259
4392
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2939
    ].
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2940
    ^ FMax
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2941
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2942
    "
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2943
     Float fmax
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2944
     self fmax
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2945
    "
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2946
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2947
    "Created: / 14-06-2017 / 19:14:18 / cg"
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2948
!
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2949
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2950
fmin
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2951
    "return the smallest representable instance of this class"
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2952
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2953
    FMin isNil ifTrue:[
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2954
	FMin := Float fmin asQDouble. "/ 1.6259745436952323e-260 asQDouble
4392
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2955
    ].
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2956
    ^ FMin
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2957
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2958
    "
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2959
     QDouble fmin
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2960
     Float fmin
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2961
    "
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2962
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2963
    "Created: / 14-06-2017 / 19:14:49 / cg"
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2964
!
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  2965
4411
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  2966
infinity
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  2967
    ^ Infinity positive
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  2968
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  2969
    "Created: / 18-06-2017 / 23:41:07 / cg"
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  2970
!
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  2971
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2972
ln10
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2973
    "return the constant e as quad precision double.
4433
37d85359188d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  2974
     (returns approx. 200 bits of precision)"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2975
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2976
    Ln10 isNil ifTrue:[
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  2977
	Ln10 := self d0: 2.302585092994045901e+00
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  2978
		     d1: -2.170756223382249351e-16
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  2979
		     d2: -9.984262454465776570e-33
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  2980
		     d3: -4.023357454450206379e-49
4388
742f099741bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4387
diff changeset
  2981
    ].
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2982
    ^ Ln10
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2983
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2984
    "
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  2985
     self ln10 printfPrintString:'%.61f'
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  2986
	-> '2.3025850929940456840179914546843642076011014886287729760333279'
5304
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  2987
     Wolfram says:
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  2988
	    2.30258509299404568401799145468436420760110148862877297603332790096757260967735248023599720508959829834196778404228...
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2989
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2990
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2991
    "Created: / 12-06-2017 / 18:32:29 / cg"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2992
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2993
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2994
ln2
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2995
    "return the constant e as quad precision double.
4433
37d85359188d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  2996
     (returns approx. 200 bits of precision)"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2997
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2998
    Ln2 isNil ifTrue:[
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  2999
	Ln2 := self d0: 6.931471805599452862e-01
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3000
		    d1: 2.319046813846299558e-17
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3001
		    d2: 5.707708438416212066e-34
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3002
		    d3: -3.582432210601811423e-50
4388
742f099741bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4387
diff changeset
  3003
    ].
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3004
    ^ Ln2
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3005
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3006
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3007
     self ln2 printfPrintString:'%.61f'
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3008
	-> '0.6931471805599452709398341558750792990469129794959648865081141'
5304
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3009
     Wolfram says:
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3010
	    0.69314718055994530941723212145817656807550013436025525412068000949339362196969471560586332699641868754200148102057...
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3011
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3012
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3013
    "Created: / 12-06-2017 / 18:31:34 / cg"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3014
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3015
4411
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  3016
negativeInfinity
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  3017
    ^ Infinity negative
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  3018
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  3019
    "Created: / 18-06-2017 / 23:40:47 / cg"
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  3020
!
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  3021
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3022
pi
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3023
    "return the constant pi as quad precision double.
4433
37d85359188d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3024
     (returns approx. 200 bits of precision)"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3025
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3026
    Pi isNil ifTrue:[
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3027
	Pi := self d0: 3.141592653589793116e+00
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3028
		   d1: 1.224646799147353207e-16
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3029
		   d2: -2.994769809718339666e-33
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3030
		   d3: 1.112454220863365282e-49
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3031
    ].
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3032
    ^ Pi
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3033
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3034
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3035
     self pi printfPrintString:'%.60f'
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3036
	  '3.141592653589793238462643383279502884197169399375105820974945'
5288
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3037
     Wolfram says:
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3038
	   3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068
5288
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3039
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3040
     (QDouble readFrom:'3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253')
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3041
     printfPrintString:'%.60f'
5288
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3042
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3043
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3044
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3045
    "Created: / 12-06-2017 / 18:27:13 / cg"
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3046
!
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3047
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3048
unity
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3049
    "return the neutral element for multiplication (1.0) as QDouble"
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3050
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3051
    QDoubleOne isNil ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3052
	QDoubleOne := 1.0 asQDouble.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3053
    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3054
    ^ QDoubleOne
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3055
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3056
    "
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3057
     self unity
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3058
    "
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3059
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3060
    "Created: / 15-06-2017 / 11:45:22 / cg"
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3061
!
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3062
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3063
zero
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3064
    "return the neutral element for addition (0.0) as QDouble"
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3065
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3066
    QDoubleZero isNil ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3067
	QDoubleZero := 0.0 asQDouble
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3068
    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3069
    ^ QDoubleZero
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3070
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3071
    "
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3072
     self zero
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3073
    "
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3074
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3075
    "Created: / 15-06-2017 / 11:44:13 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3076
! !
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3077
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3078
!QDouble class methodsFor:'queries'!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3079
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3080
defaultPrintPrecision
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3081
    "return the number of decimal digits printed by default"
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3082
5288
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3083
    ^ 30
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3084
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3085
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3086
     ShortFloat defaultPrintPrecision
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3087
     Float defaultPrintPrecision
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3088
     LongFloat defaultPrintPrecision
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3089
     QDouble defaultPrintPrecision
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3090
     QuadFloat defaultPrintPrecision
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3091
     OctaFloat defaultPrintPrecision
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3092
    "
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3093
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3094
    "Created: / 17-06-2017 / 02:58:51 / cg"
4440
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  3095
    "Modified: / 21-06-2017 / 13:39:08 / cg"
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3096
!
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3097
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3098
epsilon
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3099
    "return the maximum relative spacing of instances of mySelf
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  3100
     (i.e. the value-delta of the least significant bit)
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  3101
     see https://en.wikipedia.org/wiki/Machine_epsilon"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3102
5288
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3103
    "/ ^ 1.2154326714572500565324311366323150942261000827598106963711353e-63
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3104
    Epsilon isNil ifTrue:[
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3105
	Epsilon := self computeEpsilon.
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3106
    ].
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3107
    ^ Epsilon
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3108
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3109
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3110
     Float epsilon       -> 2.22044604925031E-16
4440
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  3111
     ShortFloat epsilon  -> 1.19209289550781E-07
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  3112
     LongFloat epsilon   -> 1.0842021724855E-19
5288
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3113
     QDouble epsilon     -> 7.77876909732643E-62 / (1.215432671457250056532e-63 read comment in precision)
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3114
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3115
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3116
    "Created: / 12-06-2017 / 18:52:44 / cg"
4443
1a8440a32671 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4442
diff changeset
  3117
    "Modified: / 22-06-2017 / 15:34:56 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3118
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3119
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3120
numBitsInExponent
5275
e9d0b744512a #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5273
diff changeset
  3121
    "answer the number of bits in the exponent.
e9d0b744512a #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5273
diff changeset
  3122
     I use regular IEEE doubles to store the value,
e9d0b744512a #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5273
diff changeset
  3123
     thus my exponent bits are the same as double's exponent bits"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3124
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3125
    ^ Float numBitsInExponent
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3126
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3127
    "
4963
51f6cd13f43b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4962
diff changeset
  3128
     1.0 asQDouble numBitsInExponent
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3129
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3130
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3131
    "Created: / 12-06-2017 / 11:11:04 / cg"
4963
51f6cd13f43b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4962
diff changeset
  3132
    "Modified (comment): / 28-05-2019 / 08:55:04 / Claus Gittinger"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3133
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3134
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3135
numBitsInMantissa
4430
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3136
    "answer the number of bits in the mantissa.
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3137
     Here, a fake number is returned"
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3138
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3139
    ^ (Float numBitsInMantissa - 1) * 4
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3140
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3141
    "
4963
51f6cd13f43b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4962
diff changeset
  3142
     1.0 asFloat numBitsInMantissa
51f6cd13f43b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4962
diff changeset
  3143
     1.0 asShortFloat numBitsInMantissa
51f6cd13f43b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4962
diff changeset
  3144
     1.0 asLongFloat numBitsInMantissa
51f6cd13f43b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4962
diff changeset
  3145
     1.0 asQDouble numBitsInMantissa
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3146
     1.0 asQDouble class numBitsInMantissa
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3147
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3148
     Float numBitsInMantissa
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3149
     ShortFloat numBitsInMantissa
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3150
     QDouble numBitsInMantissa
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3151
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3152
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3153
    "Created: / 12-06-2017 / 11:13:44 / cg"
4430
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3154
    "Modified (comment): / 20-06-2017 / 11:05:26 / cg"
4963
51f6cd13f43b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4962
diff changeset
  3155
    "Modified (comment): / 28-05-2019 / 09:07:07 / Claus Gittinger"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3156
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3157
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3158
precision
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3159
    "answer the number of bits in the mantissa"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3160
4431
a7e1399f418e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3161
    "/ subtract some due to overlap in the component numbers
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3162
    "/ actual precision seems to be more like:
5288
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3163
    "/ ^ (Float precision) * 4 - 3 + 1.
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3164
    "/ but I am a bit conservative here:
4431
a7e1399f418e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3165
    ^ (Float precision - 2) * 4
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3166
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3167
    "
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3168
     ShortFloat precision  -> 24
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3169
     Float precision       -> 53
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3170
     LongFloat precision   -> 64
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3171
     QDouble precision     -> 204
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3172
     QuadFloat precision   -> 113
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3173
     OctaFloat precision   -> 237
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3174
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3175
     1.0 class numBitsInMantissa
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3176
     1.0 asShortFloat class numBitsInMantissa
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3177
     1.0 asLongFloat class numBitsInMantissa
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3178
     1.0 asQDouble class numBitsInMantissa
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3179
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3180
     Float numBitsInMantissa
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3181
     ShortFloat numBitsInMantissa
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3182
     QDouble numBitsInMantissa
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3183
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3184
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3185
    "Created: / 12-06-2017 / 18:49:11 / cg"
4431
a7e1399f418e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3186
    "Modified (comment): / 20-06-2017 / 12:59:00 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3187
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3188
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3189
radix
5057
cc72e91af490 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4981
diff changeset
  3190
    "answer the radix of a QDouble's exponent
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3191
     This is an IEEE float, which is represented as binary"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3192
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3193
    ^ Float radix
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3194
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3195
    "Created: / 12-06-2017 / 18:50:04 / cg"
5057
cc72e91af490 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4981
diff changeset
  3196
    "Modified (comment): / 19-07-2019 / 17:28:25 / Claus Gittinger"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3197
! !
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3198
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3199
!QDouble methodsFor:'arithmetic'!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3200
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3201
* aNumber
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3202
    "return the product of the receiver and the argument, aNumber"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3203
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3204
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3205
    if (__isFloatLike(aNumber)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3206
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3207
	double b = __floatVal(aNumber);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3208
	double c0, c1, c2, c3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3209
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3210
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3211
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3212
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3213
	s_mul_qd(&c0, &c1, &c2, &c3, b, a[0], a[1], a[2], a[3]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3214
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3215
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3216
	RETURN( newQD );
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3217
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3218
    if (__isQDouble(aNumber)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3219
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3220
	double *b = __QDoubleInstPtr(aNumber)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3221
	double c0, c1, c2, c3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3222
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3223
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3224
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3225
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3226
	qd_mul_qd(&c0, &c1, &c2, &c3, a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3227
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3228
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3229
	RETURN( newQD );
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3230
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3231
%}.
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3232
    ^ aNumber productFromQDouble:self
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3233
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3234
    "
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3235
     (QDouble fromFloat:1e20) * 2.0
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3236
     (QDouble fromFloat:1e20) * 1e20
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3237
     (QDouble fromFloat:1e20) * (QDouble fromFloat:1e20)
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3238
     ((QDouble fromFloat:1e20) * (QDouble fromFloat:2.0)) asDoubleArray
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3239
     ((QDouble fromFloat:1e-20) * (QDouble fromFloat:2.0)) asDoubleArray
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3240
     ((QDouble fromFloat:2.0) * (QDouble fromFloat:2.0)) asDoubleArray
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3241
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3242
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3243
    "Created: / 12-06-2017 / 23:41:39 / cg"
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3244
    "Modified (comment): / 15-06-2017 / 00:34:41 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3245
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3246
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3247
+ aNumber
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3248
    "return the sum of the receiver and the argument, aNumber"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3249
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3250
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3251
    if (__isFloatLike(aNumber)) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3252
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3253
	double b = __floatVal(aNumber);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3254
	double c0, c1, c2, c3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3255
	OBJ newQD;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3256
	int savedCV;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3257
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3258
	fpu_fix_start(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3259
	qd_add_s(&c0, &c1, &c2, &c3, a[0], a[1], a[2], a[3], b);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3260
	fpu_fix_end(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3261
	__qNew_qdReal(newQD, c0, c1, c2, c3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3262
	RETURN( newQD );
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3263
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3264
    if (__isQDouble(aNumber)) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3265
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3266
	double *b = __QDoubleInstPtr(aNumber)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3267
	double c0, c1, c2, c3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3268
	OBJ newQD;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3269
	int savedCV;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3270
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3271
	fpu_fix_start(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3272
	qd_add_qd(&c0, &c1, &c2, &c3, a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3273
	fpu_fix_end(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3274
	__qNew_qdReal(newQD, c0, c1, c2, c3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3275
	RETURN( newQD );
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3276
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3277
%}.
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3278
    ^ aNumber sumFromQDouble:self
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3279
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3280
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3281
     ((QDouble fromFloat:1e20) + 1.0) asDoubleArray
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3282
     ((QDouble fromFloat:1e20) + (QDouble fromFloat:1.0)) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3283
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3284
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3285
    "Created: / 12-06-2017 / 16:17:46 / cg"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3286
    "Modified: / 12-06-2017 / 23:06:22 / cg"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3287
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3288
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3289
- aNumber
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3290
    "return the sum of the receiver and the argument, aNumber"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3291
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3292
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3293
    if (__isFloatLike(aNumber)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3294
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3295
	double b = __floatVal(aNumber);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3296
	double c0, c1, c2, c3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3297
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3298
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3299
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3300
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3301
	qd_add_s(&c0, &c1, &c2, &c3, a[0], a[1], a[2], a[3], -b);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3302
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3303
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3304
	RETURN( newQD );
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3305
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3306
    if (__isQDouble(aNumber)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3307
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3308
	double *b = __QDoubleInstPtr(aNumber)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3309
	double c0, c1, c2, c3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3310
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3311
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3312
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3313
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3314
	qd_sub_qd(&c0, &c1, &c2, &c3, a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3315
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3316
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3317
	RETURN( newQD );
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3318
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3319
%}.
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  3320
    ^ self + (aNumber negated)
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3321
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3322
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3323
     (QDouble fromFloat:1e20) - 1.0
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3324
     ((QDouble fromFloat:1e20) - (QDouble fromFloat:1.0)) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3325
     (QDouble fromFloat:1e-20) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3326
     ((QDouble fromFloat:1e-20) - (QDouble fromFloat:1.0)) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3327
     ((QDouble fromFloat:2.0) - (QDouble fromFloat:1.0)) asDoubleArray
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3328
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  3329
     ((QDouble fromFloat:2.0) - (QDouble fromFloat:1.0) + (QDouble fromFloat:1.0)) asDoubleArray
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  3330
     ((QDouble fromFloat:1e-20) - (QDouble fromFloat:1.0) + (QDouble fromFloat:1.0)) asDoubleArray
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3331
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3332
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3333
    "Created: / 12-06-2017 / 23:41:39 / cg"
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  3334
    "Modified (comment): / 15-06-2017 / 00:34:41 / cg"
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3335
!
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3336
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3337
/ aNumber
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3338
    "return the quotient of the receiver and the argument, aNumber"
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3339
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3340
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3341
    if (__isFloatLike(aNumber)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3342
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3343
	double b = __floatVal(aNumber);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3344
	double c0, c1, c2, c3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3345
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3346
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3347
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3348
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3349
	qd_div_s(&c0, &c1, &c2, &c3, a[0], a[1], a[2], a[3], b);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3350
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3351
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3352
	RETURN( newQD );
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3353
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3354
    if (__isQDouble(aNumber)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3355
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3356
	double *b = __QDoubleInstPtr(aNumber)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3357
	double c0, c1, c2, c3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3358
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3359
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3360
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3361
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3362
	qd_div_qd(&c0, &c1, &c2, &c3, a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3363
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3364
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3365
	RETURN( newQD );
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3366
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3367
%}.
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3368
    ^ aNumber quotientFromQDouble:self
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3369
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3370
    "
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3371
     ((QDouble fromFloat:1e20) / (QDouble fromFloat:2.0)) asDoubleArray
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3372
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  3373
     ((QDouble fromFloat:1.2345) / (QDouble fromFloat:10.0)) asDoubleArray
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  3374
     ((QDouble fromFloat:1.2345) / 10.0) asDoubleArray
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  3375
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3376
    "
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3377
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3378
    "Created: / 13-06-2017 / 17:59:09 / cg"
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  3379
    "Modified (comment): / 15-06-2017 / 00:14:26 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3380
! !
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3381
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3382
!QDouble methodsFor:'coercing & converting'!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3383
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3384
asDoubleArray
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3385
    ^ DoubleArray
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3386
	    with:self d0
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3387
	    with:self d1
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3388
	    with:self d2
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3389
	    with:self d3.
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3390
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3391
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3392
     (QDouble fromFloat:1.0) asDoubleArray
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3393
     (1.0 asQDouble + 1e-40) asDoubleArray
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3394
     (QDouble fromFloat:2.0) asDoubleArray
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3395
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3396
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3397
    "Created: / 12-06-2017 / 18:19:19 / cg"
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3398
    "Modified (comment): / 13-06-2017 / 17:58:09 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3399
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3400
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3401
asFloat
5306
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3402
    ^ self d0 + self d1
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3403
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3404
    "
5306
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3405
     (QDouble fromFloat:1.0) asFloat  -> 1.0
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3406
     (QDouble fromFloat:2.0) asFloat  -> 2.0
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3407
     (2.0 asQDouble + 1e-14) asFloat  -> 2.00000000000001
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3408
     (2.0 + 1e-14) - 2.0              -> 1.02140518265514E-14
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3409
     (2.0 + 1e-15) - 2.0              -> 8.88178419700125E-16
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3410
     (2.0 + 1e-16) - 2.0              -> 0.0
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3411
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3412
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3413
    "Created: / 12-06-2017 / 18:15:27 / cg"
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3414
    "Modified: / 13-06-2017 / 17:56:50 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3415
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3416
4421
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3417
asInteger
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3418
    ^ self d0 asInteger
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  3419
    + self d1 asInteger
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  3420
    + self d2 asInteger
4421
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3421
    + self d3 asInteger
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3422
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3423
    "Created: / 19-06-2017 / 18:07:17 / cg"
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3424
!
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3425
5306
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3426
asLargeFloat
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3427
    ^ (self d0 asLargeFloat precision:self precision) + self d1 + self d2 + self d3
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3428
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3429
    "
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3430
     (QDouble fromFloat:1.0) asLargeFloat    -> 1.000000000000000000000000000000
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3431
     (QDouble fromFloat:2.0) asLargeFloat    -> 2.000000000000000000000000000000
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3432
     (2.0 asQDouble + 1e-14) asLargeFloat    -> 2.000000000000010214051826551440
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3433
     (2.0 asLargeFloat + 1e-14) - 2.0        -> 0.000000000000010214051826551440
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3434
     (2.0  + 1e-14) - 2.0                   -> 1.02140518265514E-14
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3435
     (2.0 asLargeFloat + 1e-14) - 2.0       -> 0.000000000000010214051826551440
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3436
     (2.0 asLargeFloat + 1e-15) - 2.0       -> 0.000000000000000888178419700125
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3437
     (2.0 asLargeFloat + 1e-16) - 2.0       -> 0.0
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3438
     (2QL + 1QL-14) - 2QL                   -> 0.000000000000010000000000000000
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3439
    "
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3440
!
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3441
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3442
asLongFloat
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3443
    ^ self d0 asLongFloat + self d1
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3444
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3445
    "
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3446
     (QDouble fromFloat:1.0) asLongFloat    -> 1.0
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3447
     (QDouble fromFloat:2.0) asLongFloat    -> 2.0
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3448
     (2.0 asQDouble + 1e-14) asLongFloat    -> 2.00000000000001
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3449
     (2.0 asLongFloat + 1e-14) - 2.0        -> 1.00000303177028016E-14
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3450
     (2.0  + 1e-14) - 2.0                   -> 1.02140518265514E-14
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3451
     (2.0 asLargeFloat + 1e-14) - 2.0       -> 0.000000000000010214051826551440
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3452
     (2.0 asLargeFloat + 1e-15) - 2.0       -> 0.000000000000000888178419700125
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3453
     (2.0 asLargeFloat + 1e-16) - 2.0       -> 0.0
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3454
     (2QL + 1QL-14) - 2QL                   -> 0.000000000000010000000000000000
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3455
    "
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3456
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3457
    "Created: / 12-06-2017 / 18:15:27 / cg"
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3458
    "Modified: / 13-06-2017 / 17:56:50 / cg"
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3459
!
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  3460
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3461
asQDouble
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3462
    "return a QDouble with same value as myself."
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3463
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3464
    ^ self
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3465
!
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3466
4430
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3467
asTrueFraction
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3468
    ^ self d0 asTrueFraction
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3469
    + self d1 asTrueFraction
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3470
    + self d2 asTrueFraction
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3471
    + self d3 asTrueFraction
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3472
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3473
    "
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3474
     1e10 asTrueFraction        -> 10000000000
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3475
     1e20 asTrueFraction        -> 100000000000000000000
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3476
     (1e20 + 1) asTrueFraction  -> 100000000000000000000 ouch!!
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3477
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3478
     1e10 asQDouble asTrueFraction       -> 10000000000
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3479
     1e20 asQDouble asTrueFraction       -> 100000000000000000000
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3480
     (1e20 asQDouble + 1) asTrueFraction -> 100000000000000000001
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3481
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  3482
     (1e40 asQDouble + 1e20 + 1) asTrueFraction -> 10000000000000000303886028427003666890753
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  3483
     (1e40 asQDouble + 1e20) asTrueFraction
4430
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3484
    "
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3485
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3486
    "Created: / 20-06-2017 / 11:09:03 / cg"
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3487
!
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3488
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3489
coerce:aNumber
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3490
    "convert the argument aNumber into an instance of the receiver's class and return it."
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3491
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3492
    ^ aNumber asQDouble
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3493
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3494
    "Created: / 12-06-2017 / 17:13:47 / cg"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3495
    "Modified: / 12-06-2017 / 21:09:06 / cg"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3496
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3497
4430
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3498
exponent
5275
e9d0b744512a #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5273
diff changeset
  3499
    "extract a normalized float's (unbiased) exponent.
e9d0b744512a #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5273
diff changeset
  3500
     The returned value depends on the float-representation of
e9d0b744512a #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5273
diff changeset
  3501
     the underlying machine and is therefore highly unportable.
e9d0b744512a #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5273
diff changeset
  3502
     This is not for general use.
e9d0b744512a #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5273
diff changeset
  3503
     This assumes that the mantissa is normalized to
e9d0b744512a #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5273
diff changeset
  3504
     0.5 .. 1.0 and the float's value is: mantissa * 2^exp"
e9d0b744512a #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5273
diff changeset
  3505
4430
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3506
    ^ self d0 exponent
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3507
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3508
    "Created: / 20-06-2017 / 11:06:02 / cg"
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3509
!
2abefbc21260 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4427
diff changeset
  3510
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3511
generality
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3512
    "return the generality value - see ArithmeticValue>>retry:coercing:"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3513
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3514
    ^ 95
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3515
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3516
    "Created: / 12-06-2017 / 17:13:14 / cg"
5288
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3517
!
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3518
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3519
mantissa
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3520
    "extract a normalized float's mantissa.
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3521
     The returned value depends on the float-representation of
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3522
     the underlying machine and is therefore highly unportable.
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3523
     This is not for general use.
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3524
     This assumes that the mantissa is normalized to
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3525
     0.5 .. 1.0 and the float's value is mantissa * 2^exp"
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3526
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3527
    "/ fake it here
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3528
    ^ self / (2 raisedTo:self exponent)
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3529
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3530
    "
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3531
     1.0 exponent        -> 1
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3532
     1.0 mantissa        -> 0.5
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3533
     12345.0 exponent    -> 14
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3534
     12345.0 mantissa    -> 0.75347900390625
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3535
     -1.0 exponent       -> 1
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3536
     -1.0 mantissa       -> -0.5
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3537
     -12345.0 exponent   -> 14
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3538
     -12345.0 mantissa   -> -0.75347900390625
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3539
     (1e40 + 1e-40) exponent   -> 133
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3540
     (1e40 + 1e-40) mantissa   -> 0.918354961579912
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3541
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3542
     1.0 asQDouble exponent        -> 1
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3543
     1.0 asQDouble mantissa        -> 0.5
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3544
     12345.0 asQDouble exponent    -> 14
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3545
     12345.0 asQDouble mantissa    -> 0.75347900390625
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3546
     -1.0 asQDouble exponent       -> 1
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3547
     -1.0 asQDouble mantissa       -> -0.5
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3548
     -12345.0 asQDouble exponent   -> 14
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3549
     -12345.0 asQDouble mantissa   -> -0.75347900390625
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3550
     (1e40 + 1e-40) asQDouble exponent   -> 133
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3551
     (1e40 + 1e-40) asQDouble mantissa   -> 0.918354961579912
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3552
    "
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3553
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  3554
    "Created: / 20-06-2017 / 11:06:02 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3555
! !
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3556
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3557
!QDouble methodsFor:'comparing'!
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3558
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3559
< aNumber
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3560
    "return true, if the argument, aNumber is greater than the receiver"
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3561
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3562
    ^ aNumber lessFromQDouble:self
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3563
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3564
    "Created: / 13-06-2017 / 16:58:53 / cg"
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3565
!
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3566
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3567
= aNumber
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3568
    "return true, if the argument, aNumber has the same value as than the receiver"
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3569
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3570
%{
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3571
    if (__isSmallInteger(aNumber)) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3572
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3573
	double b = (double)(__intVal(aNumber));
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3574
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3575
	RETURN ((a[0] == b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3576
		&& a[1] == 0.0
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3577
		&& a[2] == 0.0
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3578
		&& a[3] == 0.0) ? true : false);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3579
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3580
    if (aNumber == nil) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3581
	RETURN(false);
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3582
    }
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3583
    if (__qClass(aNumber) == QDouble) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3584
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3585
	double *b = __QDoubleInstPtr(aNumber)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3586
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3587
	RETURN ((a[0] == b[0]
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3588
		&& a[1] == b[1]
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3589
		&& a[2] == b[2]
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3590
		&& a[3] == b[3]) ? true : false);
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3591
    }
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3592
    if (__qClass(aNumber) == Float) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3593
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3594
	double b = __floatVal(aNumber);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3595
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3596
	RETURN ((a[0] == b
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3597
		&& a[1] == 0.0
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3598
		&& a[2] == 0.0
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3599
		&& a[3] == 0.0) ? true : false);
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3600
    }
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3601
%}.
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3602
    ^ aNumber equalFromQDouble:self
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3603
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3604
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3605
     1.0 asQDouble = 1.0 asQDouble
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3606
     1.0 asQDouble = 1.0
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3607
     1.0 asQDouble = 1
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3608
     1.0 asQDouble = 2
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3609
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  3610
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3611
    "Created: / 13-06-2017 / 17:12:09 / cg"
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3612
! !
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3613
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3614
!QDouble methodsFor:'double dispatching'!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3615
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3616
differenceFromFloat:aFloat
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3617
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3618
    if (__isFloatLike(aFloat)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3619
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3620
	double b = __floatVal(aFloat);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3621
	double c0, c1, c2, c3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3622
	double e;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3623
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3624
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3625
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3626
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3627
	s_sub_qd(&c0, &c1, &c2, &c3, b, a[0], a[1], a[2], a[3]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3628
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3629
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3630
	RETURN( newQD );
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3631
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3632
%}.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3633
    ^ super differenceFromFloat:aFloat.
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3634
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3635
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3636
     1.0 - (QDouble fromFloat:1.0)
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3637
     1e20 - (QDouble fromFloat:1.0)
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3638
     (1.0 - (QDouble fromFloat:1.0)) asFloat
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3639
     (1e20 - (QDouble fromFloat:1.0)) asFloat
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3640
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3641
     (1.0 - (QDouble fromFloat:1.0)) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3642
     (1e20 - (QDouble fromFloat:1.0)) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3643
     (1e20 - (QDouble fromFloat:1.0) + 1e-20) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3644
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3645
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3646
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3647
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3648
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3649
differenceFromQDouble:aQDouble
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3650
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3651
    if (__isQDouble(aQDouble)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3652
	double *a = __QDoubleInstPtr(aQDouble)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3653
	double *b = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3654
	double c0, c1, c2, c3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3655
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3656
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3657
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3658
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3659
	qd_sub_qd(&c0, &c1, &c2, &c3, a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3660
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3661
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3662
	RETURN( newQD );
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3663
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3664
%}.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3665
    ^ super differenceFromQDouble:aQDouble
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3666
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3667
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3668
     (QDouble fromFloat:1.0) - (QDouble fromFloat:1.0)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3669
     (QDouble fromFloat:1.0) - 1.0
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3670
     1.0 - (QDouble fromFloat:1.0)
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3671
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3672
     ((QDouble fromFloat:1.0) - (QDouble fromFloat:1.0)) asDoubleArray
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3673
     ((QDouble fromFloat:1.0) - 1.0) asDoubleArray
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3674
     (1.0 - (QDouble fromFloat:1.0)) asDoubleArray
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3675
     (1e-20 - (QDouble fromFloat:1.0)) asDoubleArray
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3676
     (1e20 - (QDouble fromFloat:1.0)) asDoubleArray
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3677
   "
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3678
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3679
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3680
equalFromQDouble:aQDouble
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3681
%{
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3682
    if (__Class(aQDouble) == QDouble) {
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3683
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3684
	double *b = __QDoubleInstPtr(aQDouble)->d_qDoubleValue;
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3685
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3686
	RETURN ((a[0] == b[0]
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3687
		&& a[1] == b[1]
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3688
		&& a[2] == b[2]
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3689
		&& a[3] == b[3]) ? true : false);
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3690
    }
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3691
%}.
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3692
    ^ (aQDouble d0 = self d0)
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3693
    and:[ (aQDouble d1 = self d1)
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3694
    and:[ (aQDouble d2 = self d2)
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3695
    and:[ (aQDouble d3 = self d3) ]]]
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3696
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3697
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3698
     (QDouble fromFloat:1.0) = (QDouble fromFloat:1.0)
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3699
     (QDouble fromFloat:1.0) = 1.0
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3700
     1.0 = (QDouble fromFloat:1.0)
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3701
   "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3702
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3703
    "Created: / 13-06-2017 / 03:01:19 / cg"
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  3704
    "Modified: / 13-06-2017 / 18:01:52 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3705
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3706
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3707
lessFromQDouble:aQDouble
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3708
    "sent when aQDouble does not know how to compare to the receiver..
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3709
     Return true if aQDouble < self"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3710
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3711
%{
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3712
    if (__Class(aQDouble) == QDouble) {
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3713
	double *a = __QDoubleInstPtr(aQDouble)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3714
	double *b = __QDoubleInstPtr(self)->d_qDoubleValue;
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3715
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3716
	// now compare if a < b!
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3717
	RETURN
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3718
	    ((a[0] < b[0] ||
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3719
	      (a[0] == b[0] && (a[1] < b[1] ||
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3720
		(a[1] == b[1] && (a[2] < b[2] ||
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3721
		  (a[2] == b[2] && a[3] < b[3])))))) ? true : false);
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3722
    }
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3723
%}.
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3724
    ^ super lessFromQDouble:aQDouble
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3725
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3726
    "
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3727
     (1.0 + 1e-40) > 1.0
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3728
     ((QDouble fromFloat:1.0) + (QDouble fromFloat:1e-40)) > (QDouble fromFloat:1.0)
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3729
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3730
     (QDouble fromFloat:1.0) > (QDouble fromFloat:1.0)
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3731
     (QDouble fromFloat:1.1) > (QDouble fromFloat:1.0)
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3732
     (QDouble fromFloat:1.0) > 1.0
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3733
     (QDouble fromFloat:1.1) > 1.0
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3734
     1.0 > (QDouble fromFloat:1.0)
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3735
   "
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3736
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3737
    "Created: / 13-06-2017 / 17:07:47 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3738
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3739
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3740
productFromFloat:aFloat
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3741
%{
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3742
    if (__isFloatLike(aFloat)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3743
	double a  = __floatVal(aFloat);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3744
	double *b = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3745
	double c0, c1, c2, c3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3746
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3747
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3748
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3749
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3750
	s_mul_qd(&c0, &c1, &c2, &c3, a, b[0], b[1], b[2], b[3]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3751
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3752
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3753
	RETURN( newQD );
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3754
    }
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3755
%}.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3756
    ^ super productFromFloat:aFloat.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3757
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3758
    "
4421
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3759
     loosing bits here:
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  3760
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3761
     (1e20+1.0)*2.0    - 2E20  -> 0.0
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3762
     (1e20+1.0)*100.0  - 1E+22 -> 0.0
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3763
     (1e20+1.0)*1000.0 - 1E+23 -> 0.0
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3764
     (1e20+1.0)*1e20   - 1E+40 -> 0.0
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3765
     (1e40+1.0)*2.0    - 2E+40 -> 0.0
4421
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3766
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3767
     but not here:
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3768
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3769
     ((1e20 asQDouble) + (1.0)) * 2.0    - 2E20  -> 2.0
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3770
     ((1e20 asQDouble) + (1.0)) * 100.0  - 1E+22 -> 100.0
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3771
     ((1e20 asQDouble) + (1.0)) * 1000.0 - 1E+23 -> 8389608.0  WRONG
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3772
     ((1e20 asQDouble) + (1.0)) * 1e20   - 1E+40 ->
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3773
     ((1e40 asQDouble) + (1.0)) * 2.0    - 2E+40 ->
4387
879309cae427 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  3774
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3775
     2.0 * (QDouble fromFloat:1.0)
4387
879309cae427 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  3776
     2.0 * (QDouble fromFloat:3.0)
4421
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3777
     (QDouble fromFloat:2.0) * (QDouble fromFloat:3.0)
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  3778
4421
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3779
     QDouble ln2       DoubleArray(0.693147180559945 2.3190468138463E-17 5.70770843841621E-34 -3.58243221060181E-50)
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3780
     2.0 * QDouble ln2 DoubleArray(1.38629436111989 4.6380936276926E-17 1.14154168768324E-33 -7.16486442120362E-50)
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  3781
     QDouble ln2 * 2.0
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  3782
4421
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3783
     2.0 * ((QDouble fromFloat:1e20) + (QDouble fromFloat:1.0)) DoubleArray(2E+20 2.0 0.0 0.0)
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3784
     ((QDouble fromFloat:1e20) + (QDouble fromFloat:1.0)) * 2.0 DoubleArray(2E+20 4E+20 0.0 0.0)
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3785
     ((QDouble fromFloat:1e20) + (QDouble fromFloat:1.0)) * (QDouble fromFloat:2.0) DoubleArray(2E+20 4E+20 0.0 0.0)
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3786
     (QDouble fromFloat:2.0) * ((QDouble fromFloat:1e20) + (QDouble fromFloat:1.0)) DoubleArray(2E+20 4E+20 0.0 0.0)
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  3787
4387
879309cae427 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  3788
     (2.0 * ((QDouble fromFloat:1e20) + (QDouble fromFloat:1.0))) - (QDouble fromFloat:1e20) - (QDouble fromFloat:1e20)
879309cae427 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  3789
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3790
     (2.0 * (QDouble fromFloat:1.0)) asFloat
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3791
     (1e20 * (QDouble fromFloat:1.0)) asFloat
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3792
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3793
     (1e20 * (QDouble fromFloat:1.0) * 1e-20) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3794
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3795
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3796
    "Created: / 13-06-2017 / 00:58:56 / cg"
4421
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3797
    "Modified: / 19-06-2017 / 16:48:18 / cg"
2603ea13cb5c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3798
    "Modified (comment): / 19-06-2017 / 18:11:43 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3799
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3800
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3801
productFromQDouble:aQDouble
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3802
%{
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3803
    if (__isQDouble(aQDouble)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3804
	double *a = __QDoubleInstPtr(aQDouble)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3805
	double *b = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3806
	double c0, c1, c2, c3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3807
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3808
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3809
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3810
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3811
	qd_mul_qd(&c0, &c1, &c2, &c3, a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3812
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3813
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3814
	RETURN( newQD );
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3815
    }
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3816
%}.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3817
    ^ super productFromQDouble:aQDouble.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3818
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3819
    "
4387
879309cae427 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  3820
     (QDouble fromFloat:1.0) * 2.0
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3821
     2.0 * (QDouble fromFloat:1.0)
4387
879309cae427 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  3822
     (QDouble fromFloat:1.0) * (QDouble fromFloat:2.0)
879309cae427 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  3823
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3824
     1e20 * (QDouble fromFloat:2.0)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3825
     2.0 * (QDouble fromFloat:1e20)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3826
     (QDouble fromFloat:1e20) * (QDouble fromFloat:1e20)
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3827
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3828
     (1e20 * (QDouble fromFloat:1.0) * 1e-20) asDoubleArray
4392
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  3829
a64fe2606d82 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4391
diff changeset
  3830
     ( ((QDouble fromFloat:1.0) + (QDouble fromFloat:1e20)) * (QDouble fromFloat:2.0)) asDoubleArray
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3831
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3832
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3833
    "Created: / 13-06-2017 / 01:06:22 / cg"
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3834
    "Modified: / 05-07-2017 / 11:07:16 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3835
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3836
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3837
quotientFromFloat:aFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3838
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3839
    if (__isFloatLike(aFloat)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3840
	double a  = __floatVal(aFloat);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3841
	double *b = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3842
	double c0, c1, c2, c3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3843
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3844
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3845
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3846
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3847
	s_div_qd(&c0, &c1, &c2, &c3, a, b[0], b[1], b[2], b[3]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3848
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3849
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3850
	RETURN( newQD );
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3851
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3852
%}.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3853
    ^ super quotientFromFloat:aFloat.
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3854
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3855
    "
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3856
     2.0 / (QDouble fromFloat:2.0)
4387
879309cae427 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  3857
     2.0 / (QDouble fromFloat:1.0)
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  3858
     1e20 / (QDouble fromFloat:1.0)
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3859
     1e20 / (QDouble fromFloat:2.0)
5304
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3860
     (2.0 / (QDouble fromFloat:1.0)) asFloat
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3861
     (1e20 / (QDouble fromFloat:1.0)) asFloat
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3862
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3863
     (QDouble fromFloat:2.0) / 2.0
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3864
     (QDouble fromFloat:1e20) / 2.0
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3865
     ((QDouble fromFloat:1.0) / 2.0) asFloat
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3866
     ((QDouble fromFloat:1e20 / 2.0)) asFloat
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3867
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3868
     ((1e20 + (QDouble fromFloat:1.0) + 1e-20) / 2.0) asDoubleArray
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3869
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3870
     ((QDouble fromFloat:10.0) quotientFromQDouble: (QDouble fromFloat:1.234)) asDoubleArray
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3871
     ((QDouble fromFloat:1.234) / (QDouble fromFloat:10.0)) asDoubleArray
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3872
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3873
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3874
    "Created: / 13-06-2017 / 17:50:35 / cg"
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3875
    "Modified (comment): / 15-06-2017 / 01:02:05 / cg"
5304
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3876
!
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3877
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3878
quotientFromQDouble:aQDouble
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3879
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3880
    if (__isQDouble(aQDouble)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3881
	double *a = __QDoubleInstPtr(aQDouble)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3882
	double *b = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3883
	double c0, c1, c2, c3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3884
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3885
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3886
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3887
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3888
	qd_div_qd(&c0, &c1, &c2, &c3, a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3889
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3890
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3891
	RETURN( newQD );
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3892
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3893
%}.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3894
    ^ super quotientFromQDouble:aQDouble.
5304
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3895
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3896
    "
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3897
     2.0 / (QDouble fromFloat:2.0)
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3898
     2.0 / (QDouble fromFloat:1.0)
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3899
     1e20 / (QDouble fromFloat:1.0)
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3900
     1e20 / (QDouble fromFloat:2.0)
5304
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3901
     (2.0 / (QDouble fromFloat:1.0)) asFloat
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3902
     (1e20 / (QDouble fromFloat:1.0)) asFloat
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3903
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3904
     (QDouble fromFloat:2.0) / 2.0
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3905
     (QDouble fromFloat:1e20) / 2.0
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3906
     ((QDouble fromFloat:1.0) / 2.0) asFloat
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3907
     ((QDouble fromFloat:1e20 / 2.0)) asFloat
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3908
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3909
     ((1e20 + (QDouble fromFloat:1.0) + 1e-20) / 2.0) asDoubleArray
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3910
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3911
     ((QDouble fromFloat:10.0) quotientFromQDouble: (QDouble fromFloat:1.234)) asDoubleArray
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3912
     ((QDouble fromFloat:1.234) / (QDouble fromFloat:10.0)) asDoubleArray
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3913
    "
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3914
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3915
    "Created: / 13-06-2017 / 17:50:35 / cg"
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3916
    "Modified (comment): / 15-06-2017 / 01:02:05 / cg"
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3917
!
f61106094adc #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5288
diff changeset
  3918
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3919
sumFromFloat:aFloat
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3920
%{
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3921
    if (__isFloatLike(aFloat)) {
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3922
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3923
	double b = __floatVal(aFloat);
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3924
	double c0, c1, c2, c3;
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3925
	double e;
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3926
	OBJ newQD;
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3927
	int savedCV;
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3928
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3929
	fpu_fix_start(&savedCV);
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3930
	qd_add_s(&c0, &c1, &c2, &c3, a[0], a[1], a[2], a[3], b);
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3931
	fpu_fix_end(&savedCV);
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3932
	__qNew_qdReal(newQD, c0, c1, c2, c3);
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3933
	RETURN( newQD );
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3934
    }
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3935
%}.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3936
    ^ super sumFromFloat:aFloat.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3937
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3938
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3939
     1.0 + (QDouble fromFloat:1.0)
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3940
     1e20 + (QDouble fromFloat:1.0)
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3941
     (1.0 + (QDouble fromFloat:1.0)) asFloat
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3942
     (1e20 + (QDouble fromFloat:1.0)) asFloat
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3943
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3944
     (1.0 + (QDouble fromFloat:1.0)) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3945
     (1e20 + (QDouble fromFloat:1.0)) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3946
     (1e20 + (QDouble fromFloat:1.0) + 1e-20) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3947
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3948
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3949
    "Created: / 12-06-2017 / 17:16:41 / cg"
4387
879309cae427 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4386
diff changeset
  3950
    "Modified: / 14-06-2017 / 11:43:47 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3951
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3952
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3953
sumFromInteger:anInteger
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3954
    ^ self sumFromFloat:(anInteger asFloat)
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3955
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3956
    "
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3957
     1 + (QDouble fromFloat:1.0)
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3958
     1e20 asInteger + (QDouble fromFloat:1.0)
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3959
     (1 + (QDouble fromFloat:1.0)) asFloat
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3960
     (1e20 asInteger + (QDouble fromFloat:1.0)) asFloat
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3961
    "
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3962
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3963
    "Created: / 03-07-2017 / 10:35:46 / cg"
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3964
!
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3965
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3966
sumFromQDouble:aQDouble
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3967
%{
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3968
    if (__isQDouble(aQDouble)) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3969
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3970
	double *b = __QDoubleInstPtr(aQDouble)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3971
	double c0, c1, c2, c3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3972
	OBJ newQD;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3973
	int savedCV;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3974
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3975
	fpu_fix_start(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3976
	qd_add_qd(&c0, &c1, &c2, &c3, a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3977
	fpu_fix_end(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3978
	__qNew_qdReal(newQD, c0, c1, c2, c3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  3979
	RETURN( newQD );
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3980
    }
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3981
%}.
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3982
    ^ super sumFromQDouble:aQDouble
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  3983
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3984
    "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3985
     (QDouble fromFloat:1.0) + (QDouble fromFloat:1.0)
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3986
     (QDouble fromFloat:1.0) + 1.0
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3987
     1.0 + (QDouble fromFloat:1.0)
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3988
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3989
     ((QDouble fromFloat:1.0) + (QDouble fromFloat:1.0)) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3990
     ((QDouble fromFloat:1.0) + 1.0) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3991
     (1.0 + (QDouble fromFloat:1.0)) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3992
     (1e-20 + (QDouble fromFloat:1.0)) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3993
     (1e20 + (QDouble fromFloat:1.0)) asDoubleArray
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3994
   "
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3995
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3996
    "Created: / 12-06-2017 / 21:15:43 / cg"
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  3997
    "Modified: / 03-07-2017 / 23:09:11 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3998
! !
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3999
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4000
!QDouble methodsFor:'inspecting'!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4001
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4002
inspectorExtraAttributes
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4003
    "extra (pseudo instvar) entries to be shown in an inspector."
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4004
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4005
    ^ super inspectorExtraAttributes
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  4006
	add:'-{doubles}' -> [ self asDoubleArray printString ];
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  4007
	yourself
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4008
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4009
    "Created: / 12-06-2017 / 23:43:05 / cg"
4478
010c2cd47df3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  4010
    "Modified (format): / 18-07-2017 / 19:54:48 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4011
! !
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4012
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4013
!QDouble methodsFor:'mathematical functions'!
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4014
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4015
cos
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4016
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4017
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4018
    double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4019
    double q0, q1, q2, q3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4020
    OBJ newQD;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4021
    int savedCV;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4022
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4023
    fpu_fix_start(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4024
    qdcos(&q0, &q1, &q2, &q3, &a[0], &a[1], &a[2], &a[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4025
    fpu_fix_end(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4026
    __qNew_qdReal(newQD, q0, q1, q2, q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4027
    RETURN( newQD );
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4028
%}.
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  4029
4440
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  4030
    "
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4031
     1.0 cos
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4032
     (QDouble fromFloat:1.0) cos
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4033
    "
4440
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  4034
!
590547e4049d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4439
diff changeset
  4035
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4036
exp
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4037
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4038
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4039
    double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4040
    double q0, q1, q2, q3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4041
    OBJ newQD;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4042
    int savedCV;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4043
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4044
    fpu_fix_start(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4045
    qdexp(&q0, &q1, &q2, &q3, &a[0], &a[1], &a[2], &a[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4046
    fpu_fix_end(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4047
    __qNew_qdReal(newQD, q0, q1, q2, q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4048
    RETURN( newQD );
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4049
%}.
4412
ad38e01db51a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4411
diff changeset
  4050
ad38e01db51a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4411
diff changeset
  4051
    "
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4052
     1.0 exp
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4053
     (QDouble fromFloat:1.0) exp
4412
ad38e01db51a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4411
diff changeset
  4054
    "
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4055
!
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4056
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4057
ldexp:exp
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4058
    "multiply the receiver by an integral power of 2.
5288
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  4059
     I.e. return self * (2 ^ exp).
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  4060
     This is also the operation to reconstruct the original float from its
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  4061
     mantissa and exponent: (f mantissa ldexp:f exponent) = f"
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4062
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4063
    ^ self class
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4064
	d0:(self d0 ldexp:exp)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4065
	d1:(self d1 ldexp:exp)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4066
	d2:(self d2 ldexp:exp)
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4067
	d3:(self d3 ldexp:exp)
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4068
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4069
     |f| f := 1 asQDouble. (f mantissa ldexp:f exponent) -> 1.0
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4070
     |f| f := (1e40 asQDouble + 1e-40). (f mantissa ldexp:f exponent) -> (1e40 asQDouble + 1e-40)
5288
cd5e44b99011 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5275
diff changeset
  4071
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4072
     1.0 ldexp:16            -> 65536.0
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4073
     1.0 asQDouble ldexp:16  -> 65536.0
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4074
     1.0 ldexp:100           -> 1.26765060022823E+30
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4075
     1.0 asQDouble ldexp:100 -> 1.26765060022823E+30
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4076
    "
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4077
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4078
    "Created: / 19-06-2017 / 01:43:35 / cg"
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4079
!
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4080
4411
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4081
ln
4442
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4082
    "return the natural logarithm of myself.
4445
5267aa3922e4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  4083
     Raises an exception, if the receiver is less or equal to zero.
5267aa3922e4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  4084
5267aa3922e4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  4085
     Not sure if this is really faster than using a taylor right away:
5267aa3922e4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  4086
     the three exp-computations at the end are done in qDouble and are tailors themself..."
4442
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4087
4412
ad38e01db51a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4411
diff changeset
  4088
    |d0 x|
ad38e01db51a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4411
diff changeset
  4089
5306
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  4090
    "/ ^ super ln.
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  4091
4412
ad38e01db51a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4411
diff changeset
  4092
    d0 := self d0.
ad38e01db51a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4411
diff changeset
  4093
    d0 = 1.0 ifTrue:[
5311
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4094
        "/ note: d0 checking alone is not sufficient - there could still be more in d1...
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4095
        self isOne ifTrue:[ ^ self class zero ].
4412
ad38e01db51a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4411
diff changeset
  4096
    ].
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4097
    d0 > 0.0 ifTrue:[
5311
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4098
        "/ initial approx.
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4099
        x := d0 ln asQDouble.
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4100
        "/ three more iterations of newton...
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4101
        x := x + (self * (x negated exp)) - 1.0.
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4102
        x := x + (self * (x negated exp)) - 1.0.
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4103
        x := x + (self * (x negated exp)) - 1.0.
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4104
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4105
        ^ x
4412
ad38e01db51a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4411
diff changeset
  4106
    ].
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  4107
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4108
    "/ now done via trapInfinity; was:
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4109
    "/ d0 = 0.0 ifTrue:[
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4110
    "/     ^ Infinity negative
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4111
    "/ ].
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4112
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4113
    "/ if you need -INF for a zero receiver, try Number trapInfinity:[...]
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4114
    ^ self class
5311
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4115
        raise:(self = 0 ifTrue:[#infiniteResultSignal] ifFalse:[#domainErrorSignal])
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4116
        receiver:self
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4117
        selector:#ln
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4118
        arguments:#()
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4119
        errorString:'bad receiver in ln (not strictly positive)'
4411
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4120
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4121
    "
4412
ad38e01db51a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4411
diff changeset
  4122
     -1 ln
4442
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4123
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4124
     -1.0 asQDouble ln
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4125
     0.0 asQDouble ln
4411
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4126
     1.0 asQDouble ln
5311
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4127
     0.5 ln 
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4128
     0.5 asQDouble ln  
4442
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4129
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  4130
     3.0 ln printfPrintString:'%60.58lf'
5311
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4131
            -> 1.0986122886681097821082175869378261268138885498046875000000'
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4132
                                ^
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  4133
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  4134
     3.0 asQDouble ln printfPrintString:'%60.58f'
5311
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4135
            -> 1.0986122886681096913952452369225257046474905578227494517347
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  4136
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  4137
     3.0 asQDouble ln printfPrintString:'%70.68f'
5311
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4138
            -> 1.09861228866810969139524523692252570464749055782274945173469433364779
4443
1a8440a32671 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4442
diff changeset
  4139
1a8440a32671 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4442
diff changeset
  4140
     (3.0 asQDouble ln_withAccuracy:1e-64) printfPrintString:'%70.68f'
5311
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4141
               1.09861228866810969139524523692252570464749055782274945173469433364475
4443
1a8440a32671 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4442
diff changeset
  4142
     (3.0 asQDouble ln_withAccuracy:1e-100) printfPrintString:'%70.68f'
5311
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4143
              '1.098612288668109691395245236922525704647490557822749451734694333656909'
4442
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4144
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4145
     actual result:
5311
835f7dc80d6a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5310
diff changeset
  4146
            -> 1.0986122886681096913952452369225257046474905578227494517346943336374942932186089668736157548137320887879700290659...
4411
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4147
    "
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4148
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4149
    "Created: / 18-06-2017 / 23:32:54 / cg"
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4150
    "Modified: / 04-07-2017 / 11:46:27 / cg"
4411
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4151
!
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4152
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4153
negated
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4154
    ^ self class
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4155
	d0:(self d0) negated
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4156
	d1:(self d1) negated
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4157
	d2:(self d2) negated
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4158
	d3:(self d3) negated
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4159
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4160
    "
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4161
     (QDouble fromFloat:1.0) negated
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4162
     ((QDouble fromFloat:1e20) + (QDouble fromFloat:1.0)) negated asDoubleArray
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4163
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4164
     (((QDouble fromFloat:1e20) + (QDouble fromFloat:1.0))
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4165
     + ((QDouble fromFloat:1e20) + (QDouble fromFloat:1.0))) asDoubleArray
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4166
    "
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4167
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4168
    "Created: / 12-06-2017 / 20:14:55 / cg"
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4169
    "Modified (comment): / 12-06-2017 / 23:46:57 / cg"
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4170
!
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4171
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4172
raisedToInteger:n
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4173
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4174
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4175
    if (__isSmallInteger(n)) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4176
	double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4177
	double q0, q1, q2, q3;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4178
	OBJ newQD;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4179
	int savedCV;
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4180
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4181
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4182
	qdpow(&q0, &q1, &q2, &q3, a[0], a[1], a[2], a[3], __intVal(n));
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4183
	fpu_fix_end(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4184
	__qNew_qdReal(newQD, q0, q1, q2, q3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4185
	RETURN( newQD );
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4186
    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4187
%}.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4188
    ^ super raisedToInteger:n.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4189
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4190
    "
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4191
     (QDouble fromFloat:4.0) raisedToInteger:4
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4192
     (QDouble fromFloat:10.0) raisedToInteger:10
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4193
     (QDouble fromFloat:10.0000000000001) raisedToInteger:10
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4194
     10.0000000000001 raisedToInteger:10
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4195
    "
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4196
!
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4197
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4198
sin
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4199
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4200
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4201
    double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4202
    double q0, q1, q2, q3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4203
    OBJ newQD;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4204
    int savedCV;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4205
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4206
    fpu_fix_start(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4207
    qdsin(&q0, &q1, &q2, &q3, &a[0], &a[1], &a[2], &a[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4208
    fpu_fix_end(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4209
    __qNew_qdReal(newQD, q0, q1, q2, q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4210
    RETURN( newQD );
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4211
%}.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4212
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4213
    "
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4214
     1.0 sin
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4215
     (QDouble fromFloat:1.0) sin
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4216
    "
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4217
!
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4218
4442
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4219
sqrt
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4220
    "Return the square root of the receiver"
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4221
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4222
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4223
    double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4224
    double q0, q1, q2, q3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4225
    OBJ newQD;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4226
    int savedCV;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4227
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4228
    fpu_fix_start(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4229
    qdsqrt(&q0, &q1, &q2, &q3, a[0], a[1], a[2], a[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4230
    fpu_fix_end(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4231
    __qNew_qdReal(newQD, q0, q1, q2, q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4232
    RETURN( newQD );
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4233
%}.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4234
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4235
    "
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4236
     (QDouble fromFloat:4.0) sqrt
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4237
     (QDouble fromFloat:2.0) sqrt
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4238
     (QDouble fromFloat:1e20) sqrt
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4239
    "
4442
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4240
!
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4241
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4242
squared
4442
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4243
    "return receiver * receiver"
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4244
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4245
%{
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4246
    double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4247
    double q0, q1, q2, q3;
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4248
    OBJ newQD;
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4249
    int savedCV;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4250
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4251
    fpu_fix_start(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4252
    qd_sqr(&q0, &q1, &q2, &q3, a[0], a[1], a[2], a[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4253
    fpu_fix_end(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4254
    __qNew_qdReal(newQD, q0, q1, q2, q3);
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4255
    RETURN( newQD );
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4256
%}.
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4257
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4258
    "
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4259
     (QDouble fromFloat:4.0) squared
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4260
     (1e20 + (QDouble fromFloat:1.0)) squared
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4261
    "
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4262
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4263
    "Created: / 13-06-2017 / 01:27:58 / cg"
4442
ef3082dc3d1c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4440
diff changeset
  4264
    "Modified: / 22-06-2017 / 14:08:31 / cg"
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4265
!
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4266
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4267
tan
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4268
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4269
%{
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4270
    double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4271
    double q0, q1, q2, q3;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4272
    OBJ newQD;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4273
    int savedCV;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4274
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4275
    fpu_fix_start(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4276
    qdtan(&q0, &q1, &q2, &q3, &a[0], &a[1], &a[2], &a[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4277
    fpu_fix_end(&savedCV);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4278
    __qNew_qdReal(newQD, q0, q1, q2, q3);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4279
    RETURN( newQD );
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4280
%}.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4281
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4282
    "
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4283
     1.0 tan
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  4284
     (QDouble fromFloat:1.0) tan
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4285
    "
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4286
! !
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4287
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4288
!QDouble methodsFor:'printing & storing'!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4289
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4290
digitsWithPrecision:precision
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4291
    <resource: #obsolete>
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4292
    "generate digits and exponent.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4293
     if precision is >0, that many digits are generated.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4294
     If it is 0 the required number of digits is generated
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4295
     (but never more than the decimalPrecision, which is 65)"
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4296
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4297
    |numDigits r exp i d out str|
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4298
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4299
    numDigits := precision+1. "/ number of digits
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4300
    r := self abs.
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4301
    self d0 = 0.0 ifTrue:[
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4302
	^ { String new:(precision max:1) withAll:$0 . 0 }
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4303
    ].
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4304
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4305
    out := WriteStream on:(String new:precision+5).
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4306
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4307
    "/ determine approx. exponent
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4308
    exp := self d0 abs log10 floor.
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4309
    exp < -300 ifTrue:[
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4310
	"/ 1e-305 asQDouble
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4311
	r := r * (10.0 raisedToInteger:300).
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4312
	r := r / (10.0 raisedToInteger:(exp+300)).
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4313
    ] ifFalse:[
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4314
	exp > 300 ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4315
	    "/ 1e305 asQDouble
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4316
	    "/ lexpr(x,exp) = x * 2 ^ exp
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4317
self halt.
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4318
	    r := r * (2 raisedTo:-53).
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4319
	    r := r / (10.0 asQDouble raisedTo: exp).
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4320
	    r := r * (2 raisedTo:53).
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4321
	] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4322
	    r := r / (10.0 asQDouble raisedTo:exp).
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4323
	]
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4324
    ].
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4325
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4326
    "/ Fix exponent if we are off by one
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4327
    (r >= 10.0) ifTrue:[
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4328
	r := r / 10.0.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4329
	exp := exp + 1.
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4330
    ] ifFalse:[
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4331
	(r < 1.0) ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4332
	    r := r * 10.0.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4333
	    exp := exp - 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4334
	]
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4335
    ].
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4336
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4337
    ((r >= 10.0) or:[ r < 1.0 ]) ifTrue:[
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4338
	self error:'can''t compute exponent.'.
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4339
    ].
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4340
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4341
    "/
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4342
    "/ Extract the digits
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4343
    "/ notice, that the d1,d2 and d3 components might
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4344
    "/ be negative; therefore characters out of the 0..9 range
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4345
    "/ might be produced here
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4346
    "/
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4347
    i := 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4348
    [ (precision ~~ 0 and:[ i <= numDigits ])
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4349
    or:[ (precision == 0 and:[r d0 ~= 0.0])  ]] whileTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4350
	d := r d0 truncated.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4351
	r := r - d.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4352
	r := r * 10.0.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4353
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4354
	out nextPut:($0 + d).
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4355
	i := i + 1.
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4356
    ].
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4357
    numDigits := i-1.
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4358
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4359
    str := out contents.
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4360
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4361
    "/ Fix out-of-range digits.
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4362
    numDigits to:2 by:-1 do:[:i |
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4363
	(str at:i) < $0 ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4364
	    str at:i-1 put:(str at:i-1) - 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4365
	    str at:i put:(str at:i) + 10.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4366
	] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4367
	    (str at:i) > $9 ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4368
		str at:i-1 put:(str at:i-1) + 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4369
		str at:i put:(str at:i) - 10.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4370
	    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4371
	].
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4372
    ].
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4373
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4374
    str first <= $0 ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4375
	self error:'non-positive leading digit'
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4376
    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4377
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4378
    "/ Round, handle carry
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4379
    (str at:numDigits) >= $5 ifTrue:[
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4380
	str at:numDigits-1 put:(str at:numDigits-1) + 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4381
	i := numDigits-1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4382
	[i > 1 and:[(str at:i) > $9]] whileTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4383
	    str at:i put:(str at:i) - 10.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4384
	    i := i - 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4385
	    str at:i put:(str at:i) + 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4386
	]
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4387
    ].
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4388
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4389
    "/ If first digit is 10, shift everything.
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4390
    str first > $9 ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4391
	exp := exp + 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4392
	str at:1 put:$0.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4393
	str := '1',str
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4394
    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4395
    ^ { (str copyTo:numDigits-1) . exp }
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4396
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4397
    "
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4398
     0 asQDouble digitsWithPrecision:1      -> #('0' 0)
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4399
     0 asQDouble digitsWithPrecision:0      -> #('0' 0)
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4400
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4401
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4402
     1.2345 printfPrintString:'%.4f'
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4403
     1.2345 asQDouble digitsWithPrecision:5 -> #('12345' 0)
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4404
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4405
     --- but 1.2345 is not really what you think:
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4406
     1.2345 printfPrintString:'%.20f'
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4407
     1.2345 asQDouble digitsWithPrecision:20 -> #('12344999999999999307' 0)
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4408
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4409
     12.345 asQDouble digitsWithPrecision:5 -> #('12345' 1)
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4410
     12345 asQDouble digitsWithPrecision:5 -> #('12345' 4)
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4411
     12345.1 asQDouble digitsWithPrecision:5 -> #('12345' 4)
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4412
     12345.9 asQDouble digitsWithPrecision:5 -> #('12346' 4)
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4413
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4414
     1.2345 asQDouble / 10.0 asQDouble
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4415
     1.2345 asQDouble / 10.0
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4416
    "
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4417
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4418
    "Created: / 15-06-2017 / 09:10:01 / cg"
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4419
    "Modified: / 16-06-2017 / 10:01:03 / cg"
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4420
!
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4421
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4422
printOn:aStream
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4423
    "return a printed representation of the receiver.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4424
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4425
     Notice:
5310
0b6380408893 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5309
diff changeset
  4426
        this code was adapted from an ugly piece of c++ code,
0b6380408893 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5309
diff changeset
  4427
        which was obviously hacked.
0b6380408893 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5309
diff changeset
  4428
        It does need a rework.
0b6380408893 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5309
diff changeset
  4429
        As an alternative, use the printf functions, which should also deal wth QDoubles"
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4430
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4431
    self d1 = 0.0 ifTrue:[
5310
0b6380408893 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5309
diff changeset
  4432
        self d0 printOn:aStream.
0b6380408893 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5309
diff changeset
  4433
        ^ self
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4434
    ].
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  4435
    thisContext isRecursive ifTrue:[
5310
0b6380408893 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5309
diff changeset
  4436
        aStream nextPutAll:'aQDouble (error while printing)'.
0b6380408893 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5309
diff changeset
  4437
        ^ self.
4978
99f7c90223f2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  4438
    ].
4981
952fad400b5a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4978
diff changeset
  4439
4438
e5665b676a65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4437
diff changeset
  4440
    PrintfScanf printf:'%g' on:aStream argument:self.
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4441
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4442
"/    self
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4443
"/        printOn:aStream precision:40 width:0
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4444
"/        fixed:true showPositive:false uppercase:false fillChar:(Character space)
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4445
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4446
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4447
     (1.2345 asQDouble) printString
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4448
     (2 asQDouble squared) printString
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4449
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4450
     (1.2345 asQDouble) printString.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4451
     (1.2345 asFloat) printString.
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4452
     (1.2345 asLongFloat) printString.
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4453
     (1.2345 asShortFloat) printString.
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4454
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4455
     ((QDouble fromFloat:1.2345) / 10.0) printString
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4456
     ((QDouble fromFloat:1.2345) / 10000.0) printString
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4457
     ((QDouble fromFloat:1.2345) / 1000000000.0) printString -> '0.0000123449999999999987156270014193593714e-4'
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4458
     (1.2345 / 1000000000.0) printString                     -> '1.2345E-09'
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4459
    "
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4460
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4461
    "Created: / 15-06-2017 / 01:51:36 / cg"
4439
4c6520416d7d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  4462
    "Modified (comment): / 21-06-2017 / 09:55:10 / cg"
4978
99f7c90223f2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  4463
    "Modified: / 05-06-2019 / 20:38:58 / Claus Gittinger"
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4464
!
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4465
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4466
printOn:aStream precision:precisionIn width:width
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4467
    fixed:fixed showPositive:showPositive uppercase:uppercase fillChar:fillChar
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4468
    <resource: #obsolete>
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4469
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4470
    "return a printed representation of the receiver.
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4471
     This is a parametrized entry, which can be used by printf-like functions.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4472
     Notice:
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4473
	this code was adapted from an ugly piece of c++ code,
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4474
	which was obviously hacked.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4475
	It does need a rework.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4476
	As an alternative, use the printf functions, which should also deal wth QDoubles
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4477
    "
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4478
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4479
    "
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4480
     1.2345 asQDouble printString
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4481
     12.345 asQDouble printString
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4482
     12345 asQDouble printString
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4483
    "
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4484
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4485
    |sgn count delta exp precision|
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4486
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4487
"/    self d1 = 0.0 ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4488
"/        self d0 printOn:aStream.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4489
"/        ^ self.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4490
"/    ].
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4491
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4492
    count := 0.
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4493
    sgn := true.
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4494
    exp := 0.
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4495
    precision := precisionIn.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4496
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4497
    self isInfinite ifTrue:[
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4498
	self < 0 ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4499
	    aStream nextPut:$-.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4500
	    count := 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4501
	] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4502
	    showPositive ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4503
		aStream nextPut:$+.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4504
		count := 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4505
	    ] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4506
		sgn := false.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4507
	    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4508
	].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4509
	uppercase ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4510
	    aStream nextPutAll:'INF'
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4511
	] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4512
	    aStream nextPutAll:'inf'
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4513
	].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4514
	count := count + 3.
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4515
    ] ifFalse:[
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4516
	self isNaN ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4517
	    uppercase ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4518
		aStream nextPutAll:'NAN'
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4519
	    ] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4520
		aStream nextPutAll:'nan'
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4521
	    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4522
	    count := count + 3.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4523
	] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4524
	    self < 0 ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4525
		aStream nextPut:$-.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4526
		count := count + 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4527
	    ] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4528
		showPositive ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4529
		    aStream nextPut:$+.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4530
		    count := count + 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4531
		] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4532
		    sgn := false.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4533
		].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4534
	    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4535
	    self = 0.0 ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4536
		aStream nextPut:$0.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4537
		count := count + 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4538
		precision > 0 ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4539
		    aStream nextPut:$..
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4540
		    count := count + 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4541
		    precision timesRepeat:[ aStream nextPut:$0 ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4542
		    count := count + precision.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4543
		].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4544
		self halt.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4545
	    ] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4546
		|off d d_width_extra|
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4547
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4548
		"/ non-zero case
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4549
		off := fixed
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4550
			ifTrue:[ 1 + self asFloat abs log10 floor asInteger ]
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4551
			ifFalse:[1].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4552
		d := precision + off.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4553
		d_width_extra := d.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4554
		fixed ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4555
		    d_width_extra := 40 max:d.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4556
		].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4557
		"/ highly special case - fixed mode, precision is zero, abs(*this) < 1.0
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4558
		"/ without this trap a number like 0.9 printed fixed with 0 precision prints as 0
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4559
		"/ should be rounded to 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4560
		(fixed and:[ (precision == 0) and:[ (self abs < 1.0) ]]) ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4561
		    (self abs >= 0.5) ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4562
			aStream nextPut:$1
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4563
		    ] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4564
			aStream nextPut:$0
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4565
		    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4566
		    ^ self
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4567
		].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4568
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4569
		"/ handle near zero to working precision (but not exactly zero)
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4570
		(fixed and:[ d <= 0 ]) ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4571
		    aStream nextPut:$0.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4572
		    (precision > 0) ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4573
			aStream nextPut:$. .
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4574
			aStream next:precision put:$0.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4575
		    ]
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4576
		] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4577
		    "/ default
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4578
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4579
		    |t j|
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4580
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4581
		    t := self digitsWithPrecision:(fixed ifTrue:[d_width_extra] ifFalse:[d])+1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4582
		    exp := t second.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4583
		    t := t first.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4584
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4585
		    fixed ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4586
			"/ fix the string if it's been computed incorrectly
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4587
			"/ round here in the decimal string if required
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4588
			t := self round_string_qd:t at:(d + 1) offset:off.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4589
			precision := t at:3.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4590
			off := t at:2.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4591
			t := t at:1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4592
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4593
			(off > 0) ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4594
			    aStream next:off putAll:t startingAt:1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4595
			    (precision > 0) ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4596
				aStream nextPut:$. .
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4597
				aStream next:precision-1 putAll:t startingAt:off+1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4598
			    ]
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4599
			] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4600
			    aStream nextPutAll:'0.'.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4601
			    (off < 0) ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4602
				aStream next:off negated put:$0.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4603
			    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4604
			    aStream next:d putAll:t startingAt:0.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4605
			]
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4606
		    ] ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4607
			aStream nextPut:(t at:1).
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4608
			(precision > 0) ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4609
			    aStream nextPut:$. .
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4610
			].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4611
			aStream next:precision putAll:t startingAt:2.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4612
		    ]
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4613
		].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4614
	    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4615
	]
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4616
    ].
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4617
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4618
    "/ trap for improper offset with large values
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4619
    "/ without this trap, output of values of the for 10^j - 1 fail for j > 28
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4620
    "/ and are output with the point in the wrong place, leading to a dramatically off value
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4621
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4622
"/    (fixed and:[ (precision > 0) ]) ifTrue:[
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4623
"/        "/ make sure that the value isn't dramatically larger
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4624
"/        from_string = atof(s.c_str());
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4625
"/
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4626
"/        // if this ratio is large, then we've got problems
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4627
"/        if( fabs( from_string / this->x[0] ) > 3.0 ){
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4628
"/
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4629
"/                int point_position;
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4630
"/                char temp;
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4631
"/
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4632
"/                // loop on the string, find the point, move it up one
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4633
"/                // don't act on the first character
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4634
"/                for(i=1; i < s.length(); i++){
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4635
"/                        if(s[i] == '.'){
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4636
"/                                s[i] = s[i-1] ;
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4637
"/                                s[i-1] = '.' ;
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4638
"/                                break;
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4639
"/                        }
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4640
"/                }
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4641
"/
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4642
"/                from_string = atof(s.c_str());
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4643
"/                // if this ratio is large, then the string has not been fixed
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4644
"/                if( fabs( from_string / this->x[0] ) > 3.0 ){
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4645
"/                        dd_real::error("Re-rounding unsuccessful in large number fixed point trap.") ;
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4646
"/                }
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4647
"/        }
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4648
"/    }
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4649
"/
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4650
    fixed ifFalse:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4651
      "/ Fill in exponent part
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4652
      aStream nextPut:(uppercase ifTrue:[$E] ifFalse:[$e]).
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4653
      aStream print:exp.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4654
    ].
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4655
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4656
    "/ fill in the blanks
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4657
    (delta := width-count) > 0 ifTrue:[
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4658
	self halt.
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4659
"/    if (fmt & ios_base::internal) {
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4660
"/      if (sgn)
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4661
"/        s.insert(static_cast<string::size_type>(1), delta, fill);
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4662
"/      else
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4663
"/        s.insert(static_cast<string::size_type>(0), delta, fill);
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4664
"/    } else if (fmt & ios_base::left) {
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4665
"/      s.append(delta, fill);
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4666
"/    } else {
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4667
"/      s.insert(static_cast<string::size_type>(0), delta, fill);
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4668
"/    }
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4669
"/  }
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4670
    ].
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4671
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4672
    "Created: / 15-06-2017 / 02:37:31 / cg"
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4673
    "Modified (comment): / 16-06-2017 / 14:48:30 / cg"
4385
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4674
!
3bfafdde1cb5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
  4675
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4676
round_string_qd:str at:precisionIn offset:offsetIn
4454
f9079c08585a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
  4677
    <resource: #obsolete>
4395
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4678
    "returns a triple of: { new-str . new-offset . new-precision }"
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4679
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4680
    "/
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4681
    "/ Input string must be all digits or errors will occur.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4682
    "/
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4683
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4684
    |i numDigits offsetOut precisionOut|
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4685
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4686
    numDigits := precisionIn.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4687
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4688
    offsetOut := offsetIn.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4689
    precisionOut := precisionIn.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4690
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4691
    "/ Round, handle carry
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4692
    ((str at:numDigits) >= $5) ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4693
	str at:numDigits-1 put:(str at:numDigits-1)+1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4694
	i := numDigits-1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4695
	[ i > 1 and:[ (str at:i) > $9] ] whileTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4696
	    str at:i put:(str at:i)-10.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4697
	    i := i - 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4698
	    str at:i put:(str at:i)+1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4699
	]
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4700
    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4701
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4702
    "/ If first digit is 10, shift everything.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4703
    (str at:1) > $9 ifTrue:[
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4704
	"/ e++; // don't modify exponent here
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4705
	str replaceFrom:2 with:str startingAt:1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4706
	str at:1 put:$1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4707
	str at:2 put:$0.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4708
	offsetOut := offsetOut + 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4709
	precisionOut := precisionOut + 1.
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4710
    ].
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4711
    ^ { (str copyTo:precisionOut) . offsetOut . precisionOut }
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4712
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4713
    "Created: / 16-06-2017 / 10:12:39 / cg"
3a01a83b6303 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4393
diff changeset
  4714
    "Modified (comment): / 16-06-2017 / 11:22:03 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4715
! !
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4716
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4717
!QDouble methodsFor:'private'!
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4718
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4719
nintAsFloat
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4720
    "return the receiver truncated towards negative infinity"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4721
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4722
%{
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4723
    /* Computes the nearest integer to d. */
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4724
#define nint(d) (((d) == floor(d)) ? (d) : floor((d) + 0.5))
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4725
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4726
    double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4727
    OBJ newQD;
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4728
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4729
    double x0, x1, x2, x3;
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4730
    x0 = nint(a[0]);
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4731
    x1 = x2 = x3 = 0.0;
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4732
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4733
    if (x0 == a[0]) {
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4734
	/* First double is already an integer. */
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4735
	x1 = nint(a[1]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4736
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4737
	if (x1 == a[1]) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4738
	    /* Second double is already an integer. */
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4739
	    x2 = nint(a[2]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4740
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4741
	    if (x2 == a[2]) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4742
		/* Third double is already an integer. */
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4743
		x3 = nint(a[3]);
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4744
	    } else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4745
		if (abs(x2 - a[2]) == 0.5 && a[3] < 0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4746
		    x2 -= 1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4747
		}
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4748
	    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4749
	} else {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4750
	    if (abs(x1 - a[1]) == 0.5 && a[2] < 0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4751
		x1 -= 1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4752
	    }
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4753
	}
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4754
    } else {
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4755
	/* First double is not an integer. */
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4756
	if (abs(x0 - a[0]) == 0.5 && a[1] < 0.0) {
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4757
	    x0 -= 1.0;
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4758
	}
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4759
    }
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4760
    m_renorm4(x0, x1, x2, x3);
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4761
    __qNew_qdReal(newQD, x0, x1, x2, x3);
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4762
    RETURN( newQD );
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4763
%}.
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4764
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4765
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4766
     (QDouble fromFloat:4.0) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4767
     (QDouble fromFloat:4.6) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4768
     (QDouble fromFloat:4.50000001) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4769
     (QDouble fromFloat:4.5) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4770
     (QDouble fromFloat:4.49999999) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4771
     (QDouble fromFloat:4.4) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4772
     (QDouble fromFloat:4.1) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4773
     (QDouble fromFloat:0.1) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4774
     (QDouble fromFloat:0.5) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4775
     (QDouble fromFloat:0.49999) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4776
     (QDouble fromFloat:0.4) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4777
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4778
     (QDouble fromFloat:-4.0) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4779
     (QDouble fromFloat:-4.6) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4780
     (QDouble fromFloat:-4.4) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4781
     (QDouble fromFloat:-4.499999999) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4782
     (QDouble fromFloat:-4.5) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4783
     (QDouble fromFloat:-4.5000000001) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4784
     (QDouble fromFloat:-4.1) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4785
     (QDouble fromFloat:-0.1) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4786
     (QDouble fromFloat:-0.5) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4787
     (QDouble fromFloat:-0.4) roundedAsFloat
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4788
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4789
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4790
    "Created: / 13-06-2017 / 01:52:44 / cg"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4791
    "Modified (comment): / 13-06-2017 / 17:33:19 / cg"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4792
!
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4793
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4794
renorm
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4795
    "destructive renormalization"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4796
%{
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4797
    double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4798
    double c0, c1, c2, c3;
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4799
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4800
    c0 = a[0];
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4801
    c1 = a[1];
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4802
    c2 = a[2];
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4803
    c3 = a[3];
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4804
    m_renorm4(c0, c1, c2, c3);
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4805
    a[0] = c0;
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4806
    a[1] = c1;
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4807
    a[2] = c2;
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4808
    a[3] = c3;
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4809
    RETURN( self );
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4810
%}.
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4811
    ^ self error.
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4812
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4813
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4814
     (QDouble fromFloat:1.0) renorm
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4815
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4816
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4817
    "Created: / 13-06-2017 / 18:05:33 / cg"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4818
    "Modified: / 15-06-2017 / 00:12:59 / cg"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4819
! !
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4820
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4821
!QDouble methodsFor:'private accessing'!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4822
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4823
d0
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  4824
    "the most significant (and highest valued) 53 bits of precision"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4825
%{
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4826
    RETURN ( __MKFLOAT(__QDoubleInstPtr(self)->d_qDoubleValue[0]) );
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4827
%}
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4828
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4829
    "Created: / 12-06-2017 / 20:15:12 / cg"
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  4830
    "Modified (comment): / 13-06-2017 / 17:59:47 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4831
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4832
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4833
d1
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  4834
    "the next most significant (and next highest valued) 53 bits of precision"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4835
%{
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4836
    RETURN ( __MKFLOAT(__QDoubleInstPtr(self)->d_qDoubleValue[1]) );
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4837
%}
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4838
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4839
    "Created: / 12-06-2017 / 20:15:12 / cg"
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  4840
    "Modified (comment): / 13-06-2017 / 18:00:00 / cg"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4841
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4842
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4843
d2
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4844
%{
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4845
    RETURN ( __MKFLOAT(__QDoubleInstPtr(self)->d_qDoubleValue[2]) );
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4846
%}
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4847
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4848
    "Created: / 12-06-2017 / 20:15:29 / cg"
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4849
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4850
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4851
d3
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  4852
    "the least significant (and smallest valued) 53 bits of precision"
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4853
%{
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4854
    RETURN ( __MKFLOAT(__QDoubleInstPtr(self)->d_qDoubleValue[3]) );
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4855
%}
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4856
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4857
    "Created: / 12-06-2017 / 20:15:32 / cg"
4386
0a320155d78a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4385
diff changeset
  4858
    "Modified (comment): / 13-06-2017 / 18:00:18 / cg"
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4859
! !
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4860
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4861
!QDouble methodsFor:'testing'!
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4862
4404
2708f482fe13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  4863
isFinite
5195
cfe34e335f2c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5057
diff changeset
  4864
    "return true, if the receiver is a finite float (not NaN and not +/-INF)"
cfe34e335f2c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5057
diff changeset
  4865
4404
2708f482fe13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  4866
    ^ self d0 isFinite
2708f482fe13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  4867
2708f482fe13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  4868
    "Created: / 17-06-2017 / 03:40:30 / cg"
2708f482fe13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  4869
!
2708f482fe13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  4870
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4871
isInfinite
5195
cfe34e335f2c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5057
diff changeset
  4872
    "return true, if the receiver is an infinite float (+Inf or -Inf)."
cfe34e335f2c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5057
diff changeset
  4873
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4874
    ^ self d0 isInfinite
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4875
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4876
    "Created: / 15-06-2017 / 01:57:57 / cg"
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4877
!
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4878
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4879
isNaN
5195
cfe34e335f2c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5057
diff changeset
  4880
     "return true, if the receiver is an invalid float (NaN - not a number)"
cfe34e335f2c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5057
diff changeset
  4881
cfe34e335f2c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 5057
diff changeset
  4882
   ^ self d0 isNaN
4393
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4883
4084ca142033 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  4884
    "Created: / 15-06-2017 / 01:57:35 / cg"
4411
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4885
!
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4886
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4887
isOne
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4888
    ^ self d0 = 1.0
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4889
    and:[ self d1 = 0.0
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4890
    and:[ self d2 = 0.0
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4891
    and:[ self d3 = 0.0 ]]]
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4892
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4893
    "Created: / 18-06-2017 / 23:29:07 / cg"
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4894
!
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4895
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4896
isZero
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4897
    ^ self d0 = 0.0
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4898
8055a8f0b66f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4404
diff changeset
  4899
    "Created: / 18-06-2017 / 23:29:25 / cg"
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4900
!
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4901
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4902
negative
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4903
    ^ self d0 negative
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4904
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4905
    "
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4906
     (QDouble fromFloat:0.0) negative
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4907
     (QDouble fromFloat:1.0) negative
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4908
     (QDouble fromFloat:-1.0) negative
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4909
    "
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4910
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4911
    "Created: / 13-06-2017 / 01:57:39 / cg"
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4912
    "Modified: / 13-06-2017 / 17:58:26 / cg"
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4913
!
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4914
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4915
positive
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4916
    "return true, if the receiver is greater or equal to zero (not negative)"
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4917
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4918
    ^ self d0 positive
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4919
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4920
    "
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4921
     (QDouble fromFloat:1.0) positive
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4922
     (QDouble fromFloat:-1.0) positive
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4923
     (1.0 asQDouble + 1e-100) positive
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4924
     (0.0 asQDouble + 1e-100) positive
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4925
     (0.0 asQDouble - 1e-100) positive
5270
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4926
    "
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4927
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4928
    "Created: / 13-06-2017 / 01:56:53 / cg"
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4929
    "Modified: / 13-06-2017 / 17:58:41 / cg"
af3b659665cf #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  4930
    "Modified (comment): / 28-05-2019 / 05:55:55 / Claus Gittinger"
5306
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  4931
!
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  4932
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  4933
sign
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  4934
    "return the sign of the receiver"
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  4935
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  4936
    ^ self d0 sign
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  4937
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  4938
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4939
     Float nan isNaN
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4940
     Float nan sign
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4941
     Float infinity sign
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4942
     Float infinity negated sign
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4943
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4944
     ShortFloat nan isNaN
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4945
     ShortFloat nan sign
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4946
     ShortFloat infinity sign
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4947
     ShortFloat infinity negated sign
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4948
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4949
     QDouble nan isNaN
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4950
     QDouble nan sign
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4951
     QDouble infinity sign
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4952
     QDouble infinity negated sign
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4953
     0 asQDouble sign
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4954
     1 asQDouble sign
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4955
     -1 asQDouble sign
5306
819725b85a08 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
  4956
    "
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4957
! !
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4958
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4959
!QDouble methodsFor:'truncation & rounding'!
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4960
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4961
ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4962
    "return the smallest integer which is greater or equal to the receiver."
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4963
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4964
    |f|
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4965
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4966
    f := self ceilingAsFloat.
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4967
    ^ f d0 asInteger + f d1 asInteger + f d2 asInteger + f d3 asInteger
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4968
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4969
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4970
     (QDouble fromFloat:4.0) ceiling
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4971
     (QDouble fromFloat:4.1) ceiling
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4972
     (QDouble fromFloat:0.1) ceiling
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4973
     (0.1 + (QDouble fromFloat:1.0)) ceiling
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4974
     (1e20 + (QDouble fromFloat:1.0)) ceiling
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4975
     (1e20 + (QDouble fromFloat:1.1)) ceiling
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4976
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4977
     (QDouble fromFloat:1.5) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4978
     (QDouble fromFloat:0.5) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4979
     (QDouble fromFloat:-0.5) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4980
     (QDouble fromFloat:-1.5) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4981
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4982
!
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4983
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4984
ceilingAsFloat
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4985
    "return the smallest integer-valued float greater or equal to the receiver.
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4986
     This is much like #ceiling, but avoids a (possibly expensive) conversion
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4987
     of the result to an integer.
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4988
     It may be useful, if the result is to be further used in another float-operation."
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4989
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4990
%{
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4991
    double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4992
    OBJ newQD;
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  4993
    int savedCV;
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4994
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4995
    double x0, x1, x2, x3;
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4996
    x1 = x2 = x3 = 0.0;
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4997
    x0 = ceil(a[0]);
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4998
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  4999
    if (x0 == a[0]) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5000
	x1 = ceil(a[1]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5001
	if (x1 == a[1]) {
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5002
	    x2 = ceil(a[2]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5003
	    if (x2 == a[2]) {
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5004
		x3 = ceil(a[3]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5005
	    }
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5006
	}
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5007
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5008
	m_renorm4(x0, x1, x2, x3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5009
	fpu_fix_end(&savedCV);
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5010
    }
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5011
    __qNew_qdReal(newQD, x0, x1, x2, x3);
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5012
    RETURN( newQD );
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5013
%}.
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5014
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5015
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5016
     (QDouble fromFloat:4.0) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5017
     (QDouble fromFloat:4.1) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5018
     (QDouble fromFloat:0.1) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5019
     (0.1 + (QDouble fromFloat:1.0)) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5020
     (1e20 + (QDouble fromFloat:1.0)) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5021
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5022
     (QDouble fromFloat:1.5) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5023
     (QDouble fromFloat:0.5) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5024
     (QDouble fromFloat:-0.5) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5025
     (QDouble fromFloat:-1.5) ceiling
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5026
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5027
!
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5028
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5029
floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5030
    "return the receiver truncated towards negative infinity"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5031
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5032
    |f|
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5033
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5034
    f := self floorAsFloat.
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5035
    ^ f d0 asInteger + f d1 asInteger + f d2 asInteger + f d3 asInteger
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5036
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5037
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5038
     (QDouble fromFloat:4.0) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5039
     (QDouble fromFloat:4.1) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5040
     (QDouble fromFloat:0.1) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5041
     (0.1 + (QDouble fromFloat:1.0)) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5042
     (1e20 + (QDouble fromFloat:1.0)) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5043
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5044
     (QDouble fromFloat:1.5) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5045
     (QDouble fromFloat:0.5) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5046
     (QDouble fromFloat:-0.5) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5047
     (QDouble fromFloat:-1.5) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5048
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5049
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5050
    "Created: / 13-06-2017 / 01:52:44 / cg"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5051
    "Modified (comment): / 13-06-2017 / 17:33:19 / cg"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5052
!
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5053
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5054
floorAsFloat
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5055
    "return the receiver truncated towards negative infinity"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5056
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5057
%{
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5058
    double *a = __QDoubleInstPtr(self)->d_qDoubleValue;
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5059
    OBJ newQD;
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5060
    int savedCV;
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5061
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5062
    double x0, x1, x2, x3;
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5063
    x1 = x2 = x3 = 0.0;
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5064
    x0 =floor(a[0]);
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5065
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5066
    if (x0 == a[0]) {
5309
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5067
	x1 = floor(a[1]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5068
	if (x1 == a[1]) {
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5069
	    x2 = floor(a[2]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5070
	    if (x2 == a[2]) {
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5071
		x3 = floor(a[3]);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5072
	    }
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5073
	}
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5074
	fpu_fix_start(&savedCV);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5075
	m_renorm4(x0, x1, x2, x3);
3e482ee15d7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  5076
	fpu_fix_end(&savedCV);
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5077
    }
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5078
    __qNew_qdReal(newQD, x0, x1, x2, x3);
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5079
    RETURN( newQD );
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5080
%}.
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5081
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5082
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5083
     (QDouble fromFloat:4.0) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5084
     (QDouble fromFloat:4.1) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5085
     (QDouble fromFloat:0.1) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5086
     (0.1 + (QDouble fromFloat:1.0)) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5087
     (1e20 + (QDouble fromFloat:1.0)) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5088
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5089
     (QDouble fromFloat:1.5) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5090
     (QDouble fromFloat:0.5) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5091
     (QDouble fromFloat:-0.5) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5092
     (QDouble fromFloat:-1.5) floor
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5093
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5094
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5095
    "Created: / 13-06-2017 / 01:52:44 / cg"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5096
    "Modified (comment): / 13-06-2017 / 17:33:19 / cg"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5097
!
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5098
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5099
rounded
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5100
    "return the smallest integer which is greater or equal to the receiver."
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5101
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5102
    |f|
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5103
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5104
    f := self roundedAsFloat.
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5105
    "/ ^ (f d0 + f d1 + f d2 + f d3) asInteger
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5106
    ^ f d0 asInteger + f d1 asInteger + f d2 asInteger + f d3 asInteger
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5107
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5108
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5109
     (QDouble fromFloat:4.0) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5110
     (QDouble fromFloat:4.6) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5111
     (QDouble fromFloat:4.50000001) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5112
     (QDouble fromFloat:4.5) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5113
     (QDouble fromFloat:4.49999999) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5114
     (QDouble fromFloat:4.4) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5115
     (QDouble fromFloat:4.1) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5116
     (QDouble fromFloat:0.1) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5117
     (QDouble fromFloat:0.5) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5118
     (QDouble fromFloat:0.49999) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5119
     (QDouble fromFloat:0.4) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5120
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5121
     (QDouble fromFloat:-4.0) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5122
     (QDouble fromFloat:-4.6) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5123
     (QDouble fromFloat:-4.4) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5124
     (QDouble fromFloat:-4.499999999) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5125
     (QDouble fromFloat:-4.5) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5126
     (QDouble fromFloat:-4.5000000001) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5127
     (QDouble fromFloat:-4.1) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5128
     (QDouble fromFloat:-0.1) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5129
     (QDouble fromFloat:-0.5) rounded
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5130
     (QDouble fromFloat:-0.4) rounded
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5131
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5132
!
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5133
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5134
roundedAsFloat
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5135
    "return the receiver truncated towards negative infinity"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5136
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5137
    self positive ifTrue:[
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5138
	^ self nintAsFloat
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5139
    ].
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5140
    ^ self negated nintAsFloat negated
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5141
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5142
    "
5308
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5143
     (QDouble fromFloat:4.0) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5144
     (QDouble fromFloat:4.6) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5145
     (QDouble fromFloat:4.50000001) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5146
     (QDouble fromFloat:4.5) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5147
     (QDouble fromFloat:4.49999999) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5148
     (QDouble fromFloat:4.4) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5149
     (QDouble fromFloat:4.1) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5150
     (QDouble fromFloat:0.1) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5151
     (QDouble fromFloat:0.5) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5152
     (QDouble fromFloat:0.49999) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5153
     (QDouble fromFloat:0.4) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5154
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5155
     (QDouble fromFloat:-4.0) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5156
     (QDouble fromFloat:-4.6) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5157
     (QDouble fromFloat:-4.4) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5158
     (QDouble fromFloat:-4.499999999) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5159
     (QDouble fromFloat:-4.5) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5160
     (QDouble fromFloat:-4.5000000001) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5161
     (QDouble fromFloat:-4.1) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5162
     (QDouble fromFloat:-0.1) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5163
     (QDouble fromFloat:-0.5) roundedAsFloat
d992975959ab #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5306
diff changeset
  5164
     (QDouble fromFloat:-0.4) roundedAsFloat
5273
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5165
    "
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5166
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5167
    "Created: / 13-06-2017 / 01:52:44 / cg"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5168
    "Modified (comment): / 13-06-2017 / 17:33:19 / cg"
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5169
! !
9533c37f6d69 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 5270
diff changeset
  5170
4380
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5171
!QDouble class methodsFor:'documentation'!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5172
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5173
version
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5174
    ^ '$Header$'
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5175
!
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5176
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5177
version_CVS
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5178
    ^ '$Header$'
1f4fe7f1c1d3 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5179
! !
5310
0b6380408893 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5309
diff changeset
  5180