Mercurial > hg > CbC > CbC_gcc
comparison gcc/ada/libgnat/s-valrea.adb @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
4 -- -- | 4 -- -- |
5 -- S Y S T E M . V A L _ R E A L -- | 5 -- S Y S T E M . V A L _ R E A L -- |
6 -- -- | 6 -- -- |
7 -- B o d y -- | 7 -- B o d y -- |
8 -- -- | 8 -- -- |
9 -- Copyright (C) 1992-2017, Free Software Foundation, Inc. -- | 9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. -- |
10 -- -- | 10 -- -- |
11 -- GNAT is free software; you can redistribute it and/or modify it under -- | 11 -- GNAT is free software; you can redistribute it and/or modify it under -- |
12 -- terms of the GNU General Public License as published by the Free Soft- -- | 12 -- terms of the GNU General Public License as published by the Free Soft- -- |
13 -- ware Foundation; either version 3, or (at your option) any later ver- -- | 13 -- ware Foundation; either version 3, or (at your option) any later ver- -- |
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- | 14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
340 Uval := Uval * Base ** Scale; | 340 Uval := Uval * Base ** Scale; |
341 | 341 |
342 -- For base 10, use power of ten table, repeatedly if necessary | 342 -- For base 10, use power of ten table, repeatedly if necessary |
343 | 343 |
344 elsif Scale > 0 then | 344 elsif Scale > 0 then |
345 while Scale > Maxpow loop | 345 while Scale > Maxpow and then Uval'Valid loop |
346 Uval := Uval * Powten (Maxpow); | 346 Uval := Uval * Powten (Maxpow); |
347 Scale := Scale - Maxpow; | 347 Scale := Scale - Maxpow; |
348 end loop; | 348 end loop; |
349 | 349 |
350 -- Note that we still know that Scale > 0, since the loop | 350 -- Note that we still know that Scale > 0, since the loop |
351 -- above leaves Scale in the range 1 .. Maxpow. | 351 -- above leaves Scale in the range 1 .. Maxpow. |
352 | 352 |
353 Uval := Uval * Powten (Scale); | 353 if Uval'Valid then |
354 Uval := Uval * Powten (Scale); | |
355 end if; | |
354 | 356 |
355 elsif Scale < 0 then | 357 elsif Scale < 0 then |
356 while (-Scale) > Maxpow loop | 358 while (-Scale) > Maxpow and then Uval'Valid loop |
357 Uval := Uval / Powten (Maxpow); | 359 Uval := Uval / Powten (Maxpow); |
358 Scale := Scale + Maxpow; | 360 Scale := Scale + Maxpow; |
359 end loop; | 361 end loop; |
360 | 362 |
361 -- Note that we still know that Scale < 0, since the loop | 363 -- Note that we still know that Scale < 0, since the loop |
362 -- above leaves Scale in the range -Maxpow .. -1. | 364 -- above leaves Scale in the range -Maxpow .. -1. |
363 | 365 if Uval'Valid then |
364 Uval := Uval / Powten (-Scale); | 366 Uval := Uval / Powten (-Scale); |
367 end if; | |
365 end if; | 368 end if; |
366 | 369 |
367 -- Here is where we check for a bad based number | 370 -- Here is where we check for a bad based number |
368 | 371 |
369 if Bad_Base then | 372 if Bad_Base then |