diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2015-05-26 12:29:25 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2015-05-26 12:29:25 +0200 |
commit | 596b25f9a110b88d8c7e5fb1fa6cae5819b21691 (patch) | |
tree | 5089f66e930abb4b53e1d7f2bee15a14da92a0ff /gcc/ada/s-exnllf.adb | |
parent | 1b961de9db0b7ffb8d7f4614ddf61faf31a544a5 (diff) | |
download | gcc-596b25f9a110b88d8c7e5fb1fa6cae5819b21691.zip gcc-596b25f9a110b88d8c7e5fb1fa6cae5819b21691.tar.gz gcc-596b25f9a110b88d8c7e5fb1fa6cae5819b21691.tar.bz2 |
[multiple changes]
2015-05-26 Robert Dewar <dewar@adacore.com>
* sem_aggr.adb (Resolve_Array_Aggregate): Defend against
bad bounds.
* debug.adb: Document -gnatd.k.
* erroutc.adb (Set_Msg_Insertion_Line_Number): Implement -gnatd.k.
2015-05-26 Robert Dewar <dewar@adacore.com>
* gnat1drv.adb (Gnat1drv): Provide new arguments for
Get_Target_Parameters.
* restrict.adb (Set_Restriction_No_Specification_Of_Aspect):
new procedure.
(Set_Restriction_No_Use_Of_Attribute): new procedure.
* restrict.ads (Set_Restriction_No_Specification_Of_Aspect):
new procedure.
(Set_Restriction_No_Use_Of_Attribute): new procedure.
* s-rident.ads (Integer_Parameter_Restrictions): New subtype.
* targparm.adb (Get_Target_Parameters): Allow new restriction
pragmas No_Specification_Of_Aspect No_Use_Of_Attribute
No_Use_Of_Pragma.
* targparm.ads: New parameters for Get_Target_Parameters.
* tbuild.adb (Set_NOD): New name for Set_RND.
(Set_NSA): New procedure.
(Set_NUA): New procedure.
(Set_NUP): New procedure.
* tbuild.ads (Make_SC): Minor reformatting.
(Set_NOD): New name for Set_RND.
(Set_NSA, Set_NUA, Set_NUP): New procedure.
2015-05-26 Ed Schonberg <schonberg@adacore.com>
* a-stwise.adb (Find_Token): If source'first is not positive,
an exception must be raised, as specified by RM 2005 A.4.3
(68/1). This must be checked explicitly, given that run-time
files are normally compiled without constraint checks.
* a-stzsea.adb (Find_Token): Ditto.
2015-05-26 Ed Schonberg <schonberg@adacore.com>
* sem_util.ads sem_util.adb (Is_Current_Instance): New predicate
to fully implement RM 8.6 (17/3). which earlier only applied
to synchronized types. Used to preanalyze aspects that include
current instances of types, such as Predicate and Invariant.
* sem_res.adb (Resolve_Entity_Name): Use Is_Current_Instance.
* sem_ch13.adb (Add_Predicates): In ASIS mode, preserve original
expression of aspect and analyze it to provide proper type
information.
2015-05-26 Robert Dewar <dewar@adacore.com>
* rtsfind.ads: Add entries for RE_Exn[_Long]_Float.
* s-exnllf.adb (Exn_Float): New function.
(Exn_Long_Float): New function.
(Exn_Long_Long_Float): Rewritten interface.
(Exp): New name for what used to be Exn_Long_Long_Float.
* s-exnllf.ads (Exn_Float): New function.
(Exn_Long_Float): New function.
2015-05-26 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Find_Selected_Component): Do not emit an error
on a selected component when the prefix is a type name that is
a Current_Instance.
* einfo.ads: Minor grammar fix.
2015-05-26 Doug Rupp <rupp@adacore.com>
* init.c [vxworks] (sysLib.h): Only for x86.
From-SVN: r223678
Diffstat (limited to 'gcc/ada/s-exnllf.adb')
-rw-r--r-- | gcc/ada/s-exnllf.adb | 99 |
1 files changed, 97 insertions, 2 deletions
diff --git a/gcc/ada/s-exnllf.adb b/gcc/ada/s-exnllf.adb index c6765e8..a4386e8 100644 --- a/gcc/ada/s-exnllf.adb +++ b/gcc/ada/s-exnllf.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -29,8 +29,76 @@ -- -- ------------------------------------------------------------------------------ +-- Note: the reason for treating exponents in the range 0 .. 4 specially is +-- to ensure identical results to the static inline expansion in the case of +-- a compile time known exponent in this range. The use of Float'Machine and +-- Long_Float'Machine is to avoid unwanted extra precision in the results. + package body System.Exn_LLF is + function Exp + (Left : Long_Long_Float; + Right : Integer) return Long_Long_Float; + -- Common routine used if Right not in 0 .. 4 + + --------------- + -- Exn_Float -- + --------------- + + function Exn_Float + (Left : Float; + Right : Integer) return Float + is + Temp : Float; + begin + case Right is + when 0 => + return 1.0; + when 1 => + return Left; + when 2 => + return Float'Machine (Left * Left); + when 3 => + return Float'Machine (Left * Left * Left); + when 4 => + Temp := Float'Machine (Left * Left); + return Float'Machine (Temp * Temp); + when others => + return + Float'Machine + (Float (Exp (Long_Long_Float (Left), Right))); + end case; + end Exn_Float; + + -------------------- + -- Exn_Long_Float -- + -------------------- + + function Exn_Long_Float + (Left : Long_Float; + Right : Integer) return Long_Float + is + Temp : Long_Float; + begin + case Right is + when 0 => + return 1.0; + when 1 => + return Left; + when 2 => + return Long_Float'Machine (Left * Left); + when 3 => + return Long_Float'Machine (Left * Left * Left); + when 4 => + Temp := Long_Float'Machine (Left * Left); + return Long_Float'Machine (Temp * Temp); + when others => + return + Long_Float'Machine + (Long_Float (Exp (Long_Long_Float (Left), Right))); + end case; + end Exn_Long_Float; + ------------------------- -- Exn_Long_Long_Float -- ------------------------- @@ -39,6 +107,33 @@ package body System.Exn_LLF is (Left : Long_Long_Float; Right : Integer) return Long_Long_Float is + Temp : Long_Long_Float; + begin + case Right is + when 0 => + return 1.0; + when 1 => + return Left; + when 2 => + return Left * Left; + when 3 => + return Left * Left * Left; + when 4 => + Temp := Left * Left; + return Temp * Temp; + when others => + return Exp (Left, Right); + end case; + end Exn_Long_Long_Float; + + --------- + -- Exp -- + --------- + + function Exp + (Left : Long_Long_Float; + Right : Integer) return Long_Long_Float + is Result : Long_Long_Float := 1.0; Factor : Long_Long_Float := Left; Exp : Integer := Right; @@ -91,6 +186,6 @@ package body System.Exn_LLF is return 1.0 / Result; end; end if; - end Exn_Long_Long_Float; + end Exp; end System.Exn_LLF; |