Commit Graph

170 Commits

Author SHA1 Message Date
marco
3a7cde492e * finance functions by wp, mantis #26459
git-svn-id: trunk@28182 -
2014-07-08 12:45:11 +00:00
sergei
f767d9017c * Fixed sin(-0.0) to return -0.0 (was returning 0.0)
* Fixed lnxp1(-1.0) to return -Inf (was returning NaN)

git-svn-id: trunk@27639 -
2014-04-23 10:03:18 +00:00
sergei
57c762c8d2 + Inserted license header for AMath routines.
git-svn-id: trunk@27552 -
2014-04-12 20:45:44 +00:00
sergei
bd58adfcc9 + Added credits for functions reused from AMath/DAMath libraries.
git-svn-id: trunk@27518 -
2014-04-10 20:29:49 +00:00
michael
d45ced0221 * Added DegNormalize
git-svn-id: trunk@27492 -
2014-04-06 16:37:43 +00:00
sergei
94a045aa3d * Moved declarations of TFPURoundingMode,TFPUExceptionMask and TFPUPrecisionMode to System unit. Declarations in Math unit changed to aliases.
* Changed type of softfloat_exception_mask and softfloat_exception_flags to TFPUExceptionMask, softfloat_rounding_mode to TFPURoundingMode.
- Cleaned out numerous conversions happening when getting/setting exception mask and rounding mode.

git-svn-id: trunk@27215 -
2014-03-20 22:44:46 +00:00
sergei
0255eb880e - Removed mathuh.inc files which are identical for all targets (except m68k, see below), their contents moved into math.pp.
+ m68k/mathu.inc: added stub implementations for missing functions.

git-svn-id: trunk@27180 -
2014-03-18 20:01:15 +00:00
nickysn
19a39cde4a * 16-bit objpas.integer type fixes in Math.DivMod
git-svn-id: trunk@27052 -
2014-03-09 16:46:49 +00:00
nickysn
4eb9043ac7 * x87 optimized version of math.log2() for i8086, i386 and x86_64
git-svn-id: trunk@26266 -
2013-12-22 23:21:41 +00:00
nickysn
90b69184f1 * use a {$if defined()} sequence, instead of nested ifdefs for selecting the
float type in unit math

git-svn-id: trunk@26265 -
2013-12-22 19:18:15 +00:00
sergei
141b2f7066 * arcsin and arccos: improve accuracy at small arguments by replacing sqr(1-x*x) with sqr((1-x)*(1+x)).
* arcosh: likewise, error near 1.0 decreases approx. from 80*eps to 4*eps.
* artahn: improve accuracy by replacing ln(x+1) with lnxp1(x).

git-svn-id: trunk@26091 -
2013-11-14 18:26:34 +00:00
sergei
636736dda6 * log2() and log10(): replaced division by ln(base) with multiplication by reciprocal constant, this executes faster and somehow provides slightly better accuracy.
git-svn-id: trunk@26086 -
2013-11-14 08:22:28 +00:00
sergei
c7213b7ff1 - Math unit: don't raise EInvalidArgument exception in general math functions, this is Delphi-compatible. Delphi raises EInvalidArgument only in statistical/financial functions; general math functions execute code which causes EInvalidOp raised by hardware (or low-level system routines).
git-svn-id: trunk@26085 -
2013-11-14 07:49:38 +00:00
sergei
5206584805 * lnxp1 function fixed to be accurate near zero argument values, using code from AMath library by Wolfgang Ehrhardt.
git-svn-id: trunk@26084 -
2013-11-14 07:03:11 +00:00
sergei
437b3755d1 * math.hypot(): factor larger argument out of expression in order to avoid loss of precision.
git-svn-id: trunk@26026 -
2013-11-11 09:56:20 +00:00
sergei
d981861433 * IsNan(single): can be written much simpler, because representation of single casted to longint is the same on big-endian and little-endian targets.
git-svn-id: trunk@25554 -
2013-09-24 18:55:44 +00:00
florian
1da4c0c3ce * SinCos overloads added, resolves #22663
git-svn-id: trunk@22139 -
2012-08-19 22:09:03 +00:00
florian
2677187b2f * inline several math methods (though a lot won't be inlined yet because they take open array parameters), resolves #21040
* more compact formatting (removed empty lines)
* remove call to invalid argument in arctanh, arccosh doesn't have it either

git-svn-id: trunk@20936 -
2012-04-19 21:14:09 +00:00
marco
ae1ece93e5 * fix for #21199, changing epsilon to 0.0 instead of 0 helps overload selection of the
right precision. Leave mantis item over for compiler testing.

git-svn-id: trunk@20461 -
2012-03-01 22:31:20 +00:00
florian
d7f7a9bb76 * patch by Alexander Shishkin to clean up $ifopt usage by $push/$pop, resolves #20346
git-svn-id: trunk@19256 -
2011-09-27 20:22:40 +00:00
Jonas Maebe
0a88009059 * comment and formatting fixes by Christian Budde (mantis #19919)
git-svn-id: trunk@18134 -
2011-08-07 10:10:51 +00:00
florian
37b8b791d5 * overloaded versions of IsNan, resolves #14351
* prefer <ord> -> single over <ord> -> double/extended, this is delphi compatible

git-svn-id: trunk@17758 -
2011-06-14 20:38:51 +00:00
Jonas Maebe
60f8b7fcb1 + int64 version of randomrange() (mantis #16108)
git-svn-id: trunk@15097 -
2010-03-30 20:04:19 +00:00
florian
0c153a46df * math.power/intpower(0,0) return 1, this is as recommended in IEEE 754
as well as compatible with other programming languages and delphi

git-svn-id: trunk@14873 -
2010-02-06 23:10:03 +00:00
florian
31e2f16484 resolves #15453:
* fixes i386 DivMod with negative numbers with a patch from Jonas
* fixes generic DivMod with negative numbers
* test updated

git-svn-id: trunk@14532 -
2010-01-03 14:59:01 +00:00
florian
a14db25c64 + procedure DivMod(Dividend: Integer; Divisor: integer; var Result, Remainder: integer); and procedure DivMod(Dividend: cardinal; Divisor: cardinal; var Result, Remainder: cardinal);, resolves #14286
+ assembler implementations of DivMod for i386

git-svn-id: trunk@13508 -
2009-08-09 20:47:06 +00:00
marco
2c82c6a747 * several functions are now marked with overload;
* implementation of RandomFrom for some float type
  (Mantis #12662)

git-svn-id: trunk@13490 -
2009-08-04 08:20:13 +00:00
florian
855a65a061 + RandomRange
git-svn-id: trunk@13262 -
2009-06-11 20:43:24 +00:00
Jonas Maebe
1c2d2ae481 * fixed SimpleRoundTo() function (mantis #10159)
git-svn-id: trunk@12957 -
2009-03-22 16:29:54 +00:00
marco
f0c236b992 * Made overloading situation ifthen more Delphi compatible. Mantis #12662
All string variants now in one unit.

git-svn-id: trunk@12442 -
2008-12-27 18:43:22 +00:00
Almindor
3588a9d02c * inline the ** operators since they just call functions directly
git-svn-id: trunk@11461 -
2008-07-26 10:31:23 +00:00
michael
c98d7325f6 * GOTO ON in source.
git-svn-id: trunk@10889 -
2008-05-05 19:33:17 +00:00
micha
83b7f81f81 + add no-fpu support to compiler/rtl for powerpc-linux (-Cfnone)
git-svn-id: trunk@10422 -
2008-03-02 12:59:02 +00:00
Jonas Maebe
edffeac316 * declare math.pinteger as an alias of objpas.pinteger to avoid type
masking errors (mantis #10540)

git-svn-id: trunk@9617 -
2008-01-02 19:53:14 +00:00
marco
c6e2d72e3c * D7 compat, neginfinity (bug 10490)
git-svn-id: trunk@9564 -
2007-12-29 13:12:10 +00:00
michael
cb9608c149 * Replaced suspected copyright infringement of MomentSkewKurtosis with clean-room implementation by Vincent Snijders
git-svn-id: trunk@9265 -
2007-11-16 15:24:17 +00:00
yury
1807613f88 * Made NaN = 0.0/0.0 for arm-linux. It is calculated as Nan on Florian's arm-linux box. ln(-1.0) is calculated as -Inf on arm-linux and x86. It fixes bug #9132.
git-svn-id: trunk@8045 -
2007-07-14 08:55:54 +00:00
daniel
b293a9bdd4 - Revert patch by Alex Raine.
git-svn-id: trunk@7669 -
2007-06-15 14:13:26 +00:00
daniel
14f2edc56e + Assembler implementation of min/max by Alex Rayne.
git-svn-id: trunk@7668 -
2007-06-15 13:59:20 +00:00
michael
25a29c1159 * Undid revision 6462
git-svn-id: trunk@6955 -
2007-03-22 18:43:14 +00:00
marco
b7b057d570 * patch for 8452 committed
git-svn-id: trunk@6781 -
2007-03-10 21:05:48 +00:00
michael
3275f36b8f * IsNan, IsInfinite for Extended and Double
git-svn-id: trunk@6462 -
2007-02-12 20:57:24 +00:00
Jonas Maebe
0e1c9c901d + cot, sec, csc, secant, cosecant (mantis #8142)
git-svn-id: trunk@6170 -
2007-01-24 19:22:53 +00:00
Vincent Snijders
07579ca74f * fixed typo, causing compilation error on win64
git-svn-id: trunk@5814 -
2007-01-05 08:16:18 +00:00
florian
4b88079c41 + i386 assembler implementations of tan, cotan, sincos
* default tan, cotan use now sincos

git-svn-id: trunk@5809 -
2007-01-04 12:58:40 +00:00
florian
f6fe70ae0c * sincos result parameters changed from var to out
git-svn-id: trunk@5807 -
2007-01-04 10:55:21 +00:00
yury
dddeb7c763 * fixed for wince.
git-svn-id: trunk@5660 -
2006-12-21 15:21:22 +00:00
michael
4e1fcbed2c * Added RoundTo and SimpleRoundTo
git-svn-id: trunk@5587 -
2006-12-13 20:25:20 +00:00
marco
86a834d2df * sign() extended and single
git-svn-id: trunk@5223 -
2006-11-04 16:57:24 +00:00
marco
66d37158e1 * ifthen doesn't need mathinline. It is not internal on some platforms.
git-svn-id: trunk@5221 -
2006-11-04 16:01:32 +00:00
florian
82d57d9ca8 + signed DivMod added, closes #6805
git-svn-id: trunk@5132 -
2006-10-31 22:19:04 +00:00
marco
0e7763b0e5 * Another missing func (bug 7678) ifthen(string)
git-svn-id: trunk@5031 -
2006-10-27 17:28:24 +00:00
marco
c177d64fd7 * fix for bug #7658; comparevalue
git-svn-id: trunk@5030 -
2006-10-27 17:25:03 +00:00
florian
d6fe62f0d1 * overloaded statistics functions from Burkhard Carstens, fixed #7236
git-svn-id: trunk@4385 -
2006-08-07 19:38:37 +00:00
florian
c8b0d1ae2d * made some headers more Delphi compatible, from Burkhard Carstens
git-svn-id: trunk@4234 -
2006-07-16 16:28:28 +00:00
yury
350bc3f626 * use NaN = 0.0/0.0 for wince.
git-svn-id: trunk@4105 -
2006-07-06 18:57:34 +00:00
michael
e9420ae581 * Fix from programo@vp.pl for frexp function, in case X=0 or X=1
git-svn-id: trunk@3310 -
2006-04-21 18:50:26 +00:00
peter
e58e92c4fa * added sumInt
git-svn-id: trunk@2380 -
2006-01-29 19:46:14 +00:00
florian
2d606f52f3 + added missing inline directives for 2.0.x
git-svn-id: trunk@818 -
2005-08-07 15:17:07 +00:00
florian
494664ae3f + some inline directives added
+ max/min(cardinal,cardinal) removed, causes trouble, see e.g. webtbs/tw3900.pp

git-svn-id: trunk@817 -
2005-08-07 15:10:55 +00:00
fpc
790a4fe2d3 * log and id tags removed
git-svn-id: trunk@42 -
2005-05-21 09:42:41 +00:00
michael
ffb55c4254 + Removed VER1_0 defines
git-svn-id: trunk@33 -
2005-05-19 21:14:45 +00:00
fpc
50778076c3 initial import
git-svn-id: trunk@1 -
2005-05-16 18:37:41 +00:00
peter
e417e34496 * truncate log 2005-02-14 17:13:06 +00:00
florian
e348a6ad83 * operator **(int64,int64) returns int64 now 2005-02-08 20:49:16 +00:00
florian
f093fa9242 - killed power from system unit
* move operator ** to math unit
2005-02-08 20:25:28 +00:00
marco
63acb3629e * fixed 2005-01-31 13:59:23 +00:00
florian
6f6ab71989 * generic arctan2 for 3rd and 4th quadrand fixed 2005-01-12 20:17:39 +00:00
florian
bde79cc3ff * compilation on ARM fixed 2005-01-04 16:47:05 +00:00
Jonas Maebe
a4189bd7fd * also invalid argument if trying to calculate 0^0 with intpower() 2004-12-05 16:52:34 +00:00
Jonas Maebe
08da4e9278 * fixed power() in genmath.inc (code duplication from math.pp for **
support!)
  * fixed power() in math.pp to give an error from 0^0
2004-12-05 16:43:57 +00:00
florian
d17f8af6fd * fixed power(float,float) for negative exponents 2004-12-04 23:38:59 +00:00
michael
5de50944d3 + Implemented DivMod 2004-07-25 16:46:08 +00:00
florian
ef303e5570 * fixed IsNan and IsInf for big endian systems 2004-05-29 12:28:59 +00:00
peter
f8590e2841 * disable range,overflow check when generating Nan/Inf 2004-04-08 16:37:08 +00:00
florian
b43854bb09 + added Inf/Nan stuff 2004-02-20 20:10:44 +00:00
florian
715c546567 * compilation on ppc fixed 2004-02-09 18:53:09 +00:00
marco
71ec4c10a9 * 1.0 compilation fixes 2004-02-09 17:21:04 +00:00
michael
acd272b7b3 + Implemented SameValue 2004-02-09 09:11:46 +00:00
michael
2a928b5180 + Missing functions IsZero,InRange,EnsureRange implemented 2004-02-09 08:55:45 +00:00
michael
d2cc0fa55a + Added missing sign functions 2003-11-09 21:52:54 +00:00
Jonas Maebe
561e3ef7b9 * fixed arctan2 2003-10-29 19:10:07 +00:00
florian
4dbc76b90d * fixed arctan2 to handle x=0 correctly as well 2003-10-26 15:58:05 +00:00
peter
4056cd843a * small fixes for sparc 2003-09-01 20:46:59 +00:00
florian
a15ad1e3a3 * min/max must check the compiler capabilities 2003-04-24 09:38:12 +00:00
florian
75fc66fdd4 + moved cpu dependend code to mathuh.inc and mathu.inc 2003-04-24 09:21:59 +00:00
peter
892e9c864a * i386 fpu controlword functions added 2003-01-03 20:34:02 +00:00
carl
9f78fa950a * cleanup of parameters
- remove assembler code
2002-09-07 21:06:12 +00:00
peter
9f31783a0a * old logs removed and tabs fixed 2002-09-07 16:01:16 +00:00
carl
562bc8f15b * Corrected prototype of frexp() and added routine (taken fron genmath.inc)
tested against Delphi 3
2001-12-20 03:51:44 +00:00
peter
35653389e5 * added constant 2001-06-04 18:45:58 +00:00
sg
eeba1770aa * Made some modifications suggested by Markus Kaemmerer:
- MaxTanh is now the exact value Ln(MaxExtended)/2
  - The 'for' loops in MinValue and MaxValue can start with the second
    element instead of the first one
  - Added more overloaded versions of Min and Max functions
2000-07-30 10:01:04 +00:00
sg
7a54a6a895 * Applied patches by Markus Kaemmerer:
- Added ranges of the IEEE floating point types, including denormals
  - in sincos function: The arguments are of type Extended, so they
    need 't' as size suffix in FPU instructions, and not 'l'!
2000-07-29 18:07:45 +00:00
michael
650fbb86aa + removed logs 2000-07-13 11:32:24 +00:00
michael
e7aca136a1 + Initial import 2000-07-13 06:29:38 +00:00
michael
18740bcc52 + Final fixes 2000-07-08 17:12:56 +00:00
michael
5893a28fc2 + fixed meanandstddev 2000-07-08 07:03:20 +00:00
michael
d8624bb004 + Added some functions 2000-07-08 06:45:07 +00:00
michael
91ba06724a + Added many overloaded functions with as argument pointer to
array and count
+ Implemented meanandstddev
+ Improved power
2000-07-06 21:59:25 +00:00
michael
606dbe9435 + SOme changes in error reporting 2000-07-06 12:13:59 +00:00