1 /** 2 * Compiler implementation of the 3 * $(LINK2 http://www.dlang.org, D programming language). 4 * 5 * Copyright: Copyright (C) 1985-1998 by Symantec 6 * Copyright (C) 2000-2020 by The D Language Foundation, All Rights Reserved 7 * Authors: $(LINK2 http://www.digitalmars.com, Walter Bright) 8 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) 9 * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/backend/fp.d backend/fp.d) 10 * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/backend/fp.d 11 */ 12 13 module dmd.backend.fp; 14 15 version (SPP) {} else 16 { 17 import core.stdc.math; 18 import core.stdc.fenv; 19 import dmd.root.longdouble; 20 import dmd.backend.cdef; 21 22 extern (C++): 23 24 nothrow: 25 26 int statusFE() 27 { 28 return 0; 29 } 30 31 int testFE() 32 { 33 return fetestexcept(FE_ALL_EXCEPT); 34 } 35 36 void clearFE() 37 { 38 feclearexcept(FE_ALL_EXCEPT); 39 } 40 41 bool have_float_except() { return true; } 42 43 longdouble _modulo(longdouble x, longdouble y) 44 { 45 static if (TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD) 46 { 47 return fmod(x, y); 48 } 49 else 50 { 51 return fmodl(x, y); 52 } 53 } 54 }