/src/lib/numeric/real_80.e
Specman e | 83 lines | 45 code | 14 blank | 24 comment | 1 complexity | d19f7637a6150638852ed1694f525ff4 MD5 | raw file
1-- This file is part of a Liberty Eiffel library. 2-- See the full copyright at the end. 3-- 4expanded class REAL_80 5 6insert 7 REAL_GENERAL 8 9feature {ANY} -- Conversions: 10 force_to_real_32: REAL_32 11 external "built_in" 12 end 13 14 force_to_real_64: REAL_64 15 external "built_in" 16 end 17 18 force_to_integer_64: INTEGER_64 19 external "built_in" 20 end 21 22 force_to_integer_32: INTEGER_32 23 external "built_in" 24 end 25 26 force_to_integer_16: INTEGER_16 27 external "built_in" 28 end 29 30feature {ANY} 31 zero: REAL_80 0.0 32 33 one: REAL_80 1.0 34 35 infix "~=" (other: like Current): BOOLEAN 36 do 37 Result := (Current - other).abs * ({REAL_80 2.0} ^ (mantissa_bits - precision)) <= Current.abs 38 end 39 40 hash_code: INTEGER 41 do 42 Result := force_to_integer_32 43 if Result < 0 then 44 Result := -(Result + 1) 45 end 46 end 47 48 mantissa_bits: INTEGER_8 63 49 --|*** To be verified (Vincent Croizier, 10/02/05) *** 50 51 exponent_bits: INTEGER_8 15 52 53feature {} 54 sprintf (buffer: NATIVE_ARRAY[CHARACTER]; mode: CHARACTER; f: INTEGER; value: REAL_80) 55 external "plug_in" 56 alias "{ 57 location: "${sys}/runtime" 58 module_name: "basic_sprintf" 59 feature_name: "sprintf_real_extended" 60 }" 61 end 62 63end -- class REAL_80 64-- 65-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file. 66-- 67-- Permission is hereby granted, free of charge, to any person obtaining a copy 68-- of this software and associated documentation files (the "Software"), to deal 69-- in the Software without restriction, including without limitation the rights 70-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 71-- copies of the Software, and to permit persons to whom the Software is 72-- furnished to do so, subject to the following conditions: 73-- 74-- The above copyright notice and this permission notice shall be included in 75-- all copies or substantial portions of the Software. 76-- 77-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 78-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 79-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 80-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 81-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 82-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 83-- THE SOFTWARE.