Commit Graph

133 Commits

Author SHA1 Message Date
florian
69f41a776e * jump-free Ceil*/Floor* implementations
git-svn-id: trunk@36283 -
2017-05-21 12:34:31 +00:00
michael
c3e50a36cc * Move fpdoc block after uses clause
git-svn-id: trunk@35398 -
2017-02-05 09:51:43 +00:00
Károly Balogh
6dff85df58 math: replace trunc() with int() in some functions working with floats to avoid some unnecessary int64->double conversions, as trunc returns an integer, which then has to be converted back to float
git-svn-id: trunk@34995 -
2016-11-27 18:08:32 +00:00
Károly Balogh
5c87e870fd tabs to spaces fix, no functional changes
git-svn-id: trunk@34994 -
2016-11-27 17:59:41 +00:00
michael
18f2592433 * float version of modulo (Patch from Thaddy De koning, bug ID #30744)
git-svn-id: trunk@34968 -
2016-11-26 16:57:34 +00:00
michael
364abc3c07 * Author retracted erf/erfc functions due to copyright issues
git-svn-id: trunk@33130 -
2016-02-28 08:27:01 +00:00
michael
3da0f82995 * Add error functions erf/erfc, bug ID #29740
git-svn-id: trunk@33128 -
2016-02-27 14:59:51 +00:00
sergei
161f812113 * Explicitly typecast (-longint) to longint, otherwise it becomes an int64 on 64-bit targets, causing wrong result of sign(longint). Mantis #29649.
git-svn-id: trunk@33096 -
2016-02-14 10:29:11 +00:00
sergei
9b84581f4c + function copysign(x,y), calculates abs(x)*sign(y), private for unit math (not in interface).
* fixed sinh and arsinh return values at -0.0 and -Inf.

git-svn-id: trunk@33069 -
2016-02-07 15:34:02 +00:00
sergei
a4ed9f3b54 * Improved sign(x) functions to be branchless in most cases. Resolves #14206.
git-svn-id: trunk@33067 -
2016-02-07 11:18:31 +00:00
michael
88957c62e3 * Add Ceil64 and Floor64, patch from Bart Broersma (bug ID 28370)
git-svn-id: trunk@32766 -
2015-12-27 17:25:06 +00:00
michael
b9fa0d0934 * Mimic minfloat for fpdoc
git-svn-id: trunk@31036 -
2015-06-13 16:37:33 +00:00
michael
bb7e0f645f * Fake some types when running under FPDOC
git-svn-id: trunk@31034 -
2015-06-13 16:23:56 +00:00
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