Commit Graph

118 Commits

Author SHA1 Message Date
Rika Ichinose
0d5dddfcb5 Inline polyevl&ldexp in sin&cos. 2025-03-23 09:27:48 +01:00
florian
f72183eb37 * ensure always an exception is raised in genmath.inc if appropriate 2024-12-05 22:17:18 +01:00
florian
4cf202180e * really fix bootstrapping with 3.2.2 on arm-linux 2024-11-02 22:32:40 +01:00
florian
d544313698 * bootstrapping fix with 3.2 for arm-linux 2024-10-28 22:25:10 +01:00
florian
201d38d6fe * fix fpc_frac_real to properly thrown an exception on +/-Inf/NaN 2024-10-25 23:10:23 +02:00
florian
04145589a9 * improved fpc_frac_real 2022-02-18 22:47:55 +01:00
florian
67fedc6b5b * handle frac(+/-Inf or Nan) correctly in the software implementation, resolves #39584 2022-02-17 22:00:27 +01:00
florian
1e1848da92 * fix exception generation in ln(...), resolves #38832
git-svn-id: trunk@49328 -
2021-05-02 19:45:09 +00:00
florian
1d92cc43bb * fpc_ln_real raises an exception for invalid operands if they exception is not masked
git-svn-id: trunk@47813 -
2020-12-18 22:36:17 +00:00
florian
53a4e6c513 * patch by Zoran Vučenović: fixes TDoubleRec.SetFrac, resolves #38202
+ test

git-svn-id: trunk@47765 -
2020-12-12 21:39:17 +00:00
pierre
e4e1ea586c Revert wrong change, llvm supports extended constants
git-svn-id: trunk@47554 -
2020-11-24 13:55:27 +00:00
pierre
6d900039c4 Fix LLVM compilation by casting untyped real constants to double type, as LLVM does not support extended type constant apparently
git-svn-id: trunk@47551 -
2020-11-24 08:02:29 +00:00
florian
7281ea7a2c * floating point division by zero should throw run time error 208, fixed
git-svn-id: trunk@46210 -
2020-08-03 19:42:16 +00:00
pierre
adf064cbb4 New: rtl/inc/genmathh.inc source file, to provide a unique position
for the interface definition of float64 and float32 records,
  available to all systems if FPUNONE is not defined.

  rtl/inc/genmath.inc: Remove float64/float32, as they are now in rtl/inc/genmathh.inc
  rtl/inc/softfpu.pp: Use provided definitions of float32 and float64
  if available (by checking presence of FPC_SYSTEM_HAS_floatXX macro)

  rtl/inc/systemh.inc: include genmathh.inc if FPUNONE is not defined.
  rtl/java/jsystemh_types.inc: Likewise.

git-svn-id: trunk@45821 -
2020-07-21 14:24:14 +00:00
pierre
834dbf5f80 Also use union with double field to ensure correct alignment for float64 type from genmath.inc source
git-svn-id: trunk@45779 -
2020-07-13 13:18:32 +00:00
florian
af1a4c06c5 * fixed generic round(...) for large values based on a comment by Alexander Hofmann on fpc-devel
* extended test

git-svn-id: trunk@44235 -
2020-02-23 10:41:18 +00:00
florian
c189af0e3d * improved software floating point exception handling in the rtl
git-svn-id: trunk@43163 -
2019-10-10 20:31:31 +00:00
florian
781ecf4a59 * modified patch by Bart Broersma to resolves #33932: fixes compilation error with FPC_SOFT_FPUX80 in TExtended80Rec.BuildUp
git-svn-id: trunk@39354 -
2018-07-01 12:54:30 +00:00
florian
2406bd052e * by default, TExtended80Rec.Mantissa should not return the hidden bit (the binary representation of the data type contains it always
git-svn-id: trunk@39348 -
2018-06-30 11:25:43 +00:00
michael
a9205c9fba * Fix bug ID #32837, correct Mantissa and Fraction in float helpers, patch from Bart Broersma
git-svn-id: trunk@39346 -
2018-06-29 20:51:32 +00:00
pierre
82dce8d7e1 Add FPC_SOFT_FPUX80 conditional code for 80-bit float type using soft float unit
git-svn-id: trunk@37294 -
2017-09-21 14:10:03 +00:00
sergei
feeb50be4f * Changed signature of frexp() to match one in Math unit, so eventually a duplicate implementation in Math can be removed. Currently this frexp() remains private to unit System.
git-svn-id: trunk@33173 -
2016-03-06 00:43:54 +00:00
sergei
92447a9a20 * Moved local typed constants having the same value in several routines to global scope.
git-svn-id: trunk@29207 -
2014-12-06 13:07:32 +00:00
nickysn
4fe1ec9c51 * fixed TSingleRec.SetSign on 16 and 8-bit CPUs
git-svn-id: trunk@29120 -
2014-11-23 14:14:03 +00:00
florian
7180d184c5 + implements TExtended80Rec, TDoubleRec, TSingleRec
+ test

git-svn-id: trunk@29084 -
2014-11-16 20:47:33 +00:00
sergei
6807812997 * Avoid promotion to 64 bits due to mixing signed and unsigned expressions.
git-svn-id: trunk@28510 -
2014-08-22 17:21:26 +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
65f75791ea * rem_pio2: Return NaN for infinite or NaN arguments, so it is propagated into return values of sin(),cos() and other (not yet existing) callers.
git-svn-id: trunk@27625 -
2014-04-21 18:32:17 +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
sergei
217bac7a0b - Removed fpc_pi_real compilerproc, it is no longer used. At least two releases (2.6.2 and 2.6.4) emit Pi directly as a constant.
git-svn-id: trunk@27500 -
2014-04-07 09:16:24 +00:00
sergei
14ee9d52aa * Made constants DP1,DP2,DP3 local to function rem_pio2, because their values are correct only for double-precision calculations.
git-svn-id: trunk@27282 -
2014-03-25 14:32:14 +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
dcb46051c4 * Get rid of last softfloat dependencies in genmath.inc. Replaced remaining calls to float_raise with expressions which generate appropriate floating-point exceptions at runtime. This is probably somewhat slower on actual softfloat targets, but the change only affects exceptional control flow, so not a significant issue.
git-svn-id: trunk@27198 -
2014-03-20 11:04:00 +00:00
sergei
fffc317759 * Replaced fpc_round_real with new implementation, having the following important properties:
- it does not directly depend on softfloat stuff.
  - it triggers 'inexact' condition in a way compatible to hardware instructions (second assertion in webtbs/tw3157.pp now works correctly).

git-svn-id: trunk@27197 -
2014-03-20 05:33:33 +00:00
sergei
5f985602fb * Replaced fpc_ln_real with modern port from fdlibm/uclibc, it has even better accuracy than damath library.
git-svn-id: trunk@27172 -
2014-03-17 14:54:27 +00:00
sergei
aadb407e31 * Convert int64 to double in more straightforward way.
git-svn-id: trunk@26557 -
2014-01-21 14:33:56 +00:00
sergei
6dd845a183 * Removed TTabCoef type and unused zero members in coefficient arrays (the actual number of coefficients is passed to polevl/p1evl anyways).
* Use sizeint type instead of integer (the latter is 16-bit, resulting in unneeded adjustments on non-x86 targets).

git-svn-id: trunk@26556 -
2014-01-21 14:32:38 +00:00
Jonas Maebe
bf59a848b4 * fixed compilation of genmath.inc for the JVM target. In the future, please
use the new float64low/high() for getting the low/high longint and
    float64setlow/high() to set it

git-svn-id: trunk@26327 -
2013-12-30 14:30:59 +00:00
nickysn
779b92459e * fixed ldexp() on 16/8-bit CPUs. Among other things, this fixes sin() and cos()
on the i8086.

git-svn-id: trunk@26237 -
2013-12-15 23:08:23 +00:00
sergei
472b82c09a * Removed 'absolute'-style aliasing records to floating-point variables, because it causes internal compiler error on some targets.
git-svn-id: trunk@26122 -
2013-11-24 00:49:22 +00:00
sergei
b48ac658fb + Payne/Hanek argument reduction routine, improves accuracy of generic sin/cos functions over larger argument range. Tested on x86_64-win64 and mipsel-linux.
git-svn-id: trunk@26115 -
2013-11-20 22:20:47 +00:00
sergei
949b994a68 - Got rid of "goto".
git-svn-id: trunk@26104 -
2013-11-17 19:32:54 +00:00
sergei
4f0b3f61ec * fpc_trunc_real: explicitly cast float64.high and float32 to longint, fixes test suite regressions on softfloat targets. These targets have different definitions of float64/float32 (with unsigned fields), causing comparisons like "float64.high<0" to be optimized out.
git-svn-id: trunk@26095 -
2013-11-15 13:26:09 +00:00
sergei
897c8b8f7b * Cleanup fpc_trunc_real implementation.
* For single-precision variant, truncate to 64 bits instead of 32, since this how trunc()/round() are defined.
* Do not access float64 as int64, doing so would break on ARM hardfloat after r26010.
  

git-svn-id: trunk@26065 -
2013-11-12 09:31:23 +00:00
sergei
203efdcd0e * Let order of fields in float64 record depend on FPC_DOUBLE_HILO_SWAPPED, so messing with this order on every usage of float64 is no longer necessary.
git-svn-id: trunk@26010 -
2013-11-10 14:52:57 +00:00
sergei
d83fbd7602 * Replaced fpc_arctan_real() implementation with one providing a better precision.
git-svn-id: trunk@25994 -
2013-11-08 11:33:57 +00:00
sergei
441e37b8b4 - Eliminated separate extractFloat32* routines, they are used only once and manually inlining them does not harm to readability.
git-svn-id: trunk@25983 -
2013-11-07 10:12:13 +00:00
sergei
797653dd14 * Reverted overflow/underflow handling in fpc_exp_real to original state of C port. In particular, changed constant values to typed constants. Resolves #24839.
* Values like "huge" or "twom1000" must be declared as typed constants, so expressions using them are evaluated at runtime. E.g. "huge*huge" will either raise an overflow exception or will be evaluated as infinity, if overflows are masked. Calling float_raise() is not necessary anymore.
* Also replaced round() by trunc() when converting double to integer, this is how C defines such conversions.

git-svn-id: trunk@25945 -
2013-11-06 05:02:02 +00:00
sergei
690995fa12 * RTL: fixed some warnings when compiling for x86_64:
* x86_64/x86_64.inc: IsMultithread is a LongBool, not Boolean -> fixed assembler instruction suffixes
  * inc/generic.inc: cast Sizeof() to unsigned, so that combining it with unsigned operands does not cause promotion to larger signed type.
  + win64/seh64.inc: explicit typecast and missing function result assignment.
  + inc/genmath.inc: explicit typecasts.

git-svn-id: trunk@25384 -
2013-08-29 07:52:38 +00:00