New upstream version 0.7.0+dfsg
Graham Inggs
4 years ago
0 | custom: https://numfocus.salsalabs.org/donate-to-julia/index.html |
15 | 15 | ## Parts copyrighted by the Julia project (MIT License) |
16 | 16 | |
17 | 17 | > Copyright (c) 2011-14 The Julia Project. |
18 | > https://github.com/JuliaLang/openlibm/graphs/contributors | |
18 | > https://github.com/JuliaMath/openlibm/graphs/contributors | |
19 | 19 | > |
20 | 20 | > Permission is hereby granted, free of charge, to any person obtaining |
21 | 21 | > a copy of this software and associated documentation files (the |
5 | 5 | OS := $(shell uname) |
6 | 6 | # Do not forget to bump SOMINOR when changing VERSION, |
7 | 7 | # and SOMAJOR when breaking ABI in a backward-incompatible way |
8 | VERSION = 0.6.0 | |
9 | SOMAJOR = 2 | |
10 | SOMINOR = 5 | |
8 | VERSION = 0.7.0 | |
9 | SOMAJOR = 3 | |
10 | SOMINOR = 0 | |
11 | 11 | DESTDIR = |
12 | 12 | prefix = /usr/local |
13 | 13 | bindir = $(prefix)/bin |
29 | 29 | endif |
30 | 30 | |
31 | 31 | AR = $(TOOLPREFIX)ar |
32 | ||
33 | ifeq ($(ARCH),wasm32) | |
34 | CC = clang-8 | |
35 | USEGCC = 0 | |
36 | CFLAGS_add += -fno-builtin -fno-strict-aliasing | |
37 | endif | |
32 | 38 | |
33 | 39 | ifeq ($(USECLANG),1) |
34 | 40 | USEGCC = 0 |
58 | 64 | endif |
59 | 65 | ifeq ($(findstring ppc,$(ARCH)),ppc) |
60 | 66 | override ARCH := powerpc |
67 | endif | |
68 | ifeq ($(findstring s390,$(ARCH)),s390) | |
69 | override ARCH := s390 | |
61 | 70 | endif |
62 | 71 | ifneq ($(filter $(ARCH),i386 i486 i586 i686 i387 i487 i587 i687),) |
63 | 72 | override ARCH := i387 |
114 | 123 | LDFLAGS_arch += -m64 |
115 | 124 | endif |
116 | 125 | |
126 | ifeq ($(ARCH),wasm32) | |
127 | CFLAGS_arch += -ffreestanding -nostdlib -nostdinc --target=wasm32-unknown-unknown | |
128 | endif | |
129 | ||
117 | 130 | # Add our "arch"-related FLAGS in. We separate arch-related flags out so that |
118 | 131 | # we can conveniently get at them for targets that don't want the rest of |
119 | 132 | # *FLAGS_add, such as the testing Makefile targets |
48 | 48 | .PHONY: all check test clean distclean \ |
49 | 49 | install install-static install-shared install-pkgconfig install-headers |
50 | 50 | |
51 | all: libopenlibm.a libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT) | |
51 | ||
52 | OLM_LIBS := libopenlibm.a | |
53 | ifneq ($(ARCH), wasm32) | |
54 | OLM_LIBS += libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT) | |
55 | endif | |
56 | ||
57 | all : $(OLM_LIBS) | |
52 | 58 | |
53 | 59 | check test: test/test-double test/test-float |
54 | 60 | test/test-double |
71 | 77 | $(MAKE) -C test test-float |
72 | 78 | |
73 | 79 | clean: |
74 | rm -f aarch64/*.o amd64/*.o arm/*.o bsdsrc/*.o i387/*.o ld80/*.o ld128/*.o src/*.o powerpc/*.o mips/*.o | |
80 | rm -f aarch64/*.o amd64/*.o arm/*.o bsdsrc/*.o i387/*.o ld80/*.o ld128/*.o src/*.o powerpc/*.o mips/*.o s390/*.o | |
75 | 81 | rm -f libopenlibm.a libopenlibm.*$(SHLIB_EXT)* |
76 | 82 | $(MAKE) -C test clean |
77 | 83 |
0 | 0 | # OpenLibm |
1 | 1 | |
2 | [![Travis](https://travis-ci.org/JuliaLang/openlibm.svg?branch=master)](https://travis-ci.org/JuliaLang/openlibm) | |
3 | [![AppVeyor](https://ci.appveyor.com/api/projects/status/30kn644g79f0x6va/branch/master?svg=true)](https://ci.appveyor.com/project/ararslan/openlibm/branch/master) | |
2 | [![Travis](https://travis-ci.org/JuliaMath/openlibm.svg?branch=master)](https://travis-ci.org/JuliaMath/openlibm) | |
3 | [![AppVeyor](https://ci.appveyor.com/api/projects/status/sia04r4089rr19uc/branch/master?svg=true)](https://ci.appveyor.com/project/ararslan/openlibm-19152/branch/master) | |
4 | 4 | |
5 | [OpenLibm](http://www.openlibm.org) is an effort to have a high quality, portable, standalone | |
5 | [OpenLibm](https://openlibm.org/) is an effort to have a high quality, portable, standalone | |
6 | 6 | C mathematical library ([`libm`](http://en.wikipedia.org/wiki/libm)). |
7 | 7 | It can be used standalone in applications and programming language |
8 | 8 | implementations. |
14 | 14 | |
15 | 15 | ## Platform support |
16 | 16 | |
17 | OpenLibm builds on Linux, Mac OS X, Windows, FreeBSD, OpenBSD, and DragonFly BSD. | |
18 | It builds with both GCC and clang. Although largely tested and widely | |
19 | used on x86 architectures, OpenLibm also supports ARM and | |
20 | PowerPC. | |
17 | OpenLibm builds on Linux, macOS, Windows, FreeBSD, OpenBSD, NetBSD, and | |
18 | DragonFly BSD. It builds with both GCC and clang. Although largely | |
19 | tested and widely used on the x86 and x86-64 architectures, OpenLibm | |
20 | also supports arm, aarch64, ppc64le, mips, wasm32, and s390(x). | |
21 | 21 | |
22 | 22 | ## Build instructions |
23 | 23 | |
26 | 26 | Linux and Windows. |
27 | 27 | 3. Use `make USECLANG=1` to build with clang. This is the default on OS X, FreeBSD, |
28 | 28 | and OpenBSD. |
29 | 4. Architectures are auto-detected. Use `make ARCH=i386` to force a | |
29 | 4. Use `make ARCH=wasm32` to build the wasm32 library with clang. Requires clang-8. | |
30 | 5. Architectures are auto-detected. Use `make ARCH=i386` to force a | |
30 | 31 | build for i386. Other supported architectures are i486, i586, and |
31 | 32 | i686. GCC 4.8 is the minimum requirement for correct codegen on |
32 | 33 | older 32-bit architectures. |
0 | openlibm.org⏎ |
Binary diff not shown
Binary diff not shown
0 | <!doctype html> | |
1 | <html> | |
2 | <head> | |
3 | <meta charset="utf-8"> | |
4 | <meta http-equiv="X-UA-Compatible" content="chrome=1"> | |
5 | <title>OpenLibm</title> | |
6 | ||
7 | <link rel="stylesheet" href="stylesheets/styles.css"> | |
8 | <link rel="stylesheet" href="stylesheets/pygment_trac.css"> | |
9 | <script src="javascripts/scale.fix.js"></script> | |
10 | <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | |
11 | <!--[if lt IE 9]> | |
12 | <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
13 | <![endif]--> | |
14 | </head> | |
15 | <body> | |
16 | <div class="wrapper"> | |
17 | <header> | |
18 | <h1 class="header">OpenLibm</h1> | |
19 | <p class="header">A high quality system independent, portable, open source libm implementation</p> | |
20 | ||
21 | <ul> | |
22 | <li class="download"><a class="buttons" href="https://github.com/JuliaLang/openlibm/archive/v0.4.1.zip">Download ZIP</a></li> | |
23 | <li class="download"><a class="buttons" href="https://github.com/JuliaLang/openlibm/archive/v0.4.1.tar.gz">Download TAR</a></li> | |
24 | <li><a class="buttons github" href="https://github.com/JuliaLang/openlibm">View On GitHub</a></li> | |
25 | </ul> | |
26 | ||
27 | <p class="header">This project is maintained by <a class="header name" href="https://github.com/JuliaLang">JuliaLang</a></p> | |
28 | ||
29 | ||
30 | </header> | |
31 | <section> | |
32 | <h2> | |
33 | <a id="openlibm" class="anchor" href="#openlibm" aria-hidden="true"><span class="octicon octicon-link"></span></a>OpenLibm</h2> | |
34 | ||
35 | <p><a href="http://www.openlibm.org">OpenLibm</a> is an effort to have a high quality, portable, standalone | |
36 | C mathematical library (<a href="http://en.wikipedia.org/wiki/libm"><code>libm</code></a>). | |
37 | It can be used standalone in applications and programming language | |
38 | implementations.</p> | |
39 | ||
40 | <p>The project was born out of a need to have a good <code>libm</code> for the | |
41 | <a href="http://www.julialang.org">Julia programming langage</a> that worked | |
42 | consistently across compilers and operating systems, and in 32-bit and | |
43 | 64-bit environments.</p> | |
44 | ||
45 | <h3> | |
46 | <a id="history" class="anchor" href="#history" aria-hidden="true"><span class="octicon octicon-link"></span></a>History</h3> | |
47 | ||
48 | <p>The OpenLibm code derives from the <a href="http://svnweb.freebsd.org/base/head/lib/msun/">FreeBSD | |
49 | msun</a> and <a href="http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libm/src/">OpenBSD | |
50 | libm</a> | |
51 | implementations, which in turn derive from <a href="http://www.netlib.org/fdlibm/">FDLIBM | |
52 | 5.3</a>. Over and above that, OpenLibm itself has received a number of patches to make it platform independent and portable.</p> | |
53 | ||
54 | <h3> | |
55 | <a id="platform-support" class="anchor" href="#platform-support" aria-hidden="true"><span class="octicon octicon-link"></span></a>Platform support</h3> | |
56 | ||
57 | <p>OpenLibm builds on Linux, Mac OS X, Windows, FreeBSD, and | |
58 | OpenBSD. It builds with both GCC and clang. Although largely tested | |
59 | and widely used on the x86 and x86-64 architectures, OpenLibm also | |
60 | supports arm, aarch64, ppc64le, and mips. | |
61 | ||
62 | <h3> | |
63 | <a id="other-relevant-projects" class="anchor" href="#other-relevant-projects" aria-hidden="true"><span class="octicon octicon-link"></span></a>Other relevant projects</h3> | |
64 | ||
65 | <ol> | |
66 | <li> <a href="http://www.netlib.org/fdlibm/">FDLIBM</a>: Freely Distributable Math Library</li> | |
67 | <li> <a href="http://lipforge.ens-lyon.fr/www/crlibm/">CRlibm</a>: Correctly Rounded mathematical library</li> | |
68 | <li> <a href="http://www.yeppp.info/">Yeppp!</a>: A high-performance SIMD-optimized mathematical library</li> | |
69 | <li> <a href="https://software.intel.com/sites/products/documentation/doclib/mkl_sa/112/vml/vmldata.htm">Intel VML</a>: Intel's Vector Math Library</li> | |
70 | </ol> | |
71 | ||
72 | <h3> | |
73 | <a id="Acknowledgements" class="anchor" href="#Acknowledgements" aria-hidden="true"><span class="octicon octicon-link"></span></a>Acknowledgements</h3> | |
74 | ||
75 | <p>PowerPC support for OpenLibm was graciously sponsored by IBM. | |
76 | ||
77 | ||
78 | </section> | |
79 | <footer> | |
80 | <p><small>Hosted on <a href="http://pages.github.com">GitHub Pages</a> using the Dinky theme</small></p> | |
81 | </footer> | |
82 | </div> | |
83 | <!--[if !IE]><script>fixScale(document);</script><![endif]--> | |
84 | <script type="text/javascript"> | |
85 | var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | |
86 | document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | |
87 | </script> | |
88 | <script type="text/javascript"> | |
89 | try { | |
90 | var pageTracker = _gat._getTracker("UA-28835595-4"); | |
91 | pageTracker._trackPageview(); | |
92 | } catch(err) {} | |
93 | </script> | |
94 | ||
95 | </body> | |
96 | </html> |
0 | fixScale = function(doc) { | |
1 | ||
2 | var addEvent = 'addEventListener', | |
3 | type = 'gesturestart', | |
4 | qsa = 'querySelectorAll', | |
5 | scales = [1, 1], | |
6 | meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : []; | |
7 | ||
8 | function fix() { | |
9 | meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1]; | |
10 | doc.removeEventListener(type, fix, true); | |
11 | } | |
12 | ||
13 | if ((meta = meta[meta.length - 1]) && addEvent in doc) { | |
14 | fix(); | |
15 | scales = [.25, 1.6]; | |
16 | doc[addEvent](type, fix, true); | |
17 | } | |
18 | ||
19 | };⏎ |
0 | {"name":"OpenLibm","tagline":"A high quality system independent, portable, open source libm implementation","body":"## OpenLibm\r\n\r\n[OpenLibm](http://www.openlibm.org) is an effort to have a high quality, portable, standalone\r\nC mathematical library ([`libm`](http://en.wikipedia.org/wiki/libm)).\r\nIt can be used standalone in applications and programming language\r\nimplementations.\r\n\r\nThe project was born out of a need to have a good `libm` for the\r\n[Julia programming langage](http://www.julialang.org) that worked\r\nconsistently across compilers and operating systems, and in 32-bit and\r\n64-bit environments.\r\n\r\n### History\r\n\r\nThe OpenLibm code derives from the [FreeBSD\r\nmsun](http://svnweb.freebsd.org/base/head/lib/msun/) and [OpenBSD\r\nlibm](http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libm/src/)\r\nimplementations, which in turn derives from [FDLIBM\r\n5.3](http://www.netlib.org/fdlibm/). As a result, it includes a number\r\nof fixes and updates to FDLIBM that have accumulated over the years in\r\n`msun`, and optimized versions of many functions.\r\n\r\n### Platform support\r\n\r\nOpenLibm builds on Linux, Mac OS X, and Windows, and with little\r\neffort, should build on FreeBSD as well. It builds with both GCC and\r\nclang. Although largely tested on x86, it also includes experimental\r\nsupport for ARM. The original `msun` also includes support for mips,\r\nsparc64, powerpc, ia64, and alpha. These are present in the OpenLibm\r\nsource tree, but no attempt has been made to build any of these.\r\n\r\n### Build instructions\r\n\r\n1. `make` or `make USEGCC=1` to build with GCC. This is the default on\r\n Linux and Windows.\r\n2. `make USECLANG=1` to build with clang. This is the default on OS X.\r\n","google":"UA-28835595-4","note":"Don't delete this file! It's used internally to help with page regeneration."}⏎ |
0 | .highlight { background: #ffffff; } | |
1 | .highlight .c { color: #999988; font-style: italic } /* Comment */ | |
2 | .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |
3 | .highlight .k { font-weight: bold } /* Keyword */ | |
4 | .highlight .o { font-weight: bold } /* Operator */ | |
5 | .highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */ | |
6 | .highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */ | |
7 | .highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */ | |
8 | .highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ | |
9 | .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |
10 | .highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */ | |
11 | .highlight .ge { font-style: italic } /* Generic.Emph */ | |
12 | .highlight .gr { color: #aa0000 } /* Generic.Error */ | |
13 | .highlight .gh { color: #999999 } /* Generic.Heading */ | |
14 | .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |
15 | .highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */ | |
16 | .highlight .go { color: #888888 } /* Generic.Output */ | |
17 | .highlight .gp { color: #555555 } /* Generic.Prompt */ | |
18 | .highlight .gs { font-weight: bold } /* Generic.Strong */ | |
19 | .highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */ | |
20 | .highlight .gt { color: #aa0000 } /* Generic.Traceback */ | |
21 | .highlight .kc { font-weight: bold } /* Keyword.Constant */ | |
22 | .highlight .kd { font-weight: bold } /* Keyword.Declaration */ | |
23 | .highlight .kn { font-weight: bold } /* Keyword.Namespace */ | |
24 | .highlight .kp { font-weight: bold } /* Keyword.Pseudo */ | |
25 | .highlight .kr { font-weight: bold } /* Keyword.Reserved */ | |
26 | .highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */ | |
27 | .highlight .m { color: #009999 } /* Literal.Number */ | |
28 | .highlight .s { color: #d14 } /* Literal.String */ | |
29 | .highlight .na { color: #008080 } /* Name.Attribute */ | |
30 | .highlight .nb { color: #0086B3 } /* Name.Builtin */ | |
31 | .highlight .nc { color: #445588; font-weight: bold } /* Name.Class */ | |
32 | .highlight .no { color: #008080 } /* Name.Constant */ | |
33 | .highlight .ni { color: #800080 } /* Name.Entity */ | |
34 | .highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */ | |
35 | .highlight .nf { color: #990000; font-weight: bold } /* Name.Function */ | |
36 | .highlight .nn { color: #555555 } /* Name.Namespace */ | |
37 | .highlight .nt { color: #000080 } /* Name.Tag */ | |
38 | .highlight .nv { color: #008080 } /* Name.Variable */ | |
39 | .highlight .ow { font-weight: bold } /* Operator.Word */ | |
40 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ | |
41 | .highlight .mf { color: #009999 } /* Literal.Number.Float */ | |
42 | .highlight .mh { color: #009999 } /* Literal.Number.Hex */ | |
43 | .highlight .mi { color: #009999 } /* Literal.Number.Integer */ | |
44 | .highlight .mo { color: #009999 } /* Literal.Number.Oct */ | |
45 | .highlight .sb { color: #d14 } /* Literal.String.Backtick */ | |
46 | .highlight .sc { color: #d14 } /* Literal.String.Char */ | |
47 | .highlight .sd { color: #d14 } /* Literal.String.Doc */ | |
48 | .highlight .s2 { color: #d14 } /* Literal.String.Double */ | |
49 | .highlight .se { color: #d14 } /* Literal.String.Escape */ | |
50 | .highlight .sh { color: #d14 } /* Literal.String.Heredoc */ | |
51 | .highlight .si { color: #d14 } /* Literal.String.Interpol */ | |
52 | .highlight .sx { color: #d14 } /* Literal.String.Other */ | |
53 | .highlight .sr { color: #009926 } /* Literal.String.Regex */ | |
54 | .highlight .s1 { color: #d14 } /* Literal.String.Single */ | |
55 | .highlight .ss { color: #990073 } /* Literal.String.Symbol */ | |
56 | .highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */ | |
57 | .highlight .vc { color: #008080 } /* Name.Variable.Class */ | |
58 | .highlight .vg { color: #008080 } /* Name.Variable.Global */ | |
59 | .highlight .vi { color: #008080 } /* Name.Variable.Instance */ | |
60 | .highlight .il { color: #009999 } /* Literal.Number.Integer.Long */ | |
61 | ||
62 | .type-csharp .highlight .k { color: #0000FF } | |
63 | .type-csharp .highlight .kt { color: #0000FF } | |
64 | .type-csharp .highlight .nf { color: #000000; font-weight: normal } | |
65 | .type-csharp .highlight .nc { color: #2B91AF } | |
66 | .type-csharp .highlight .nn { color: #000000 } | |
67 | .type-csharp .highlight .s { color: #A31515 } | |
68 | .type-csharp .highlight .sc { color: #A31515 } |
0 | @import url(https://fonts.googleapis.com/css?family=Arvo:400,700,400italic); | |
1 | ||
2 | /* MeyerWeb Reset */ | |
3 | ||
4 | html, body, div, span, applet, object, iframe, | |
5 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
6 | a, abbr, acronym, address, big, cite, code, | |
7 | del, dfn, em, img, ins, kbd, q, s, samp, | |
8 | small, strike, strong, sub, sup, tt, var, | |
9 | b, u, i, center, | |
10 | dl, dt, dd, ol, ul, li, | |
11 | fieldset, form, label, legend, | |
12 | table, caption, tbody, tfoot, thead, tr, th, td, | |
13 | article, aside, canvas, details, embed, | |
14 | figure, figcaption, footer, header, hgroup, | |
15 | menu, nav, output, ruby, section, summary, | |
16 | time, mark, audio, video { | |
17 | margin: 0; | |
18 | padding: 0; | |
19 | border: 0; | |
20 | font: inherit; | |
21 | vertical-align: baseline; | |
22 | } | |
23 | ||
24 | ||
25 | /* Base text styles */ | |
26 | ||
27 | body { | |
28 | padding:10px 50px 0 0; | |
29 | font-family:"Helvetica Neue", Helvetica, Arial, sans-serif; | |
30 | font-size: 14px; | |
31 | color: #232323; | |
32 | background-color: #FBFAF7; | |
33 | margin: 0; | |
34 | line-height: 1.8em; | |
35 | -webkit-font-smoothing: antialiased; | |
36 | ||
37 | } | |
38 | ||
39 | h1, h2, h3, h4, h5, h6 { | |
40 | color:#232323; | |
41 | margin:36px 0 10px; | |
42 | } | |
43 | ||
44 | p, ul, ol, table, dl { | |
45 | margin:0 0 22px; | |
46 | } | |
47 | ||
48 | h1, h2, h3 { | |
49 | font-family: Arvo, Monaco, serif; | |
50 | line-height:1.3; | |
51 | font-weight: normal; | |
52 | } | |
53 | ||
54 | h1,h2, h3 { | |
55 | display: block; | |
56 | border-bottom: 1px solid #ccc; | |
57 | padding-bottom: 5px; | |
58 | } | |
59 | ||
60 | h1 { | |
61 | font-size: 30px; | |
62 | } | |
63 | ||
64 | h2 { | |
65 | font-size: 24px; | |
66 | } | |
67 | ||
68 | h3 { | |
69 | font-size: 18px; | |
70 | } | |
71 | ||
72 | h4, h5, h6 { | |
73 | font-family: Arvo, Monaco, serif; | |
74 | font-weight: 700; | |
75 | } | |
76 | ||
77 | a { | |
78 | color:#C30000; | |
79 | font-weight:200; | |
80 | text-decoration:none; | |
81 | } | |
82 | ||
83 | a:hover { | |
84 | text-decoration: underline; | |
85 | } | |
86 | ||
87 | a small { | |
88 | font-size: 12px; | |
89 | } | |
90 | ||
91 | em { | |
92 | font-style: italic; | |
93 | } | |
94 | ||
95 | strong { | |
96 | font-weight:700; | |
97 | } | |
98 | ||
99 | ul { | |
100 | list-style-position: inside; | |
101 | list-style: disc; | |
102 | padding-left: 25px; | |
103 | } | |
104 | ||
105 | ol { | |
106 | list-style-position: inside; | |
107 | list-style: decimal; | |
108 | padding-left: 25px; | |
109 | } | |
110 | ||
111 | blockquote { | |
112 | margin: 0; | |
113 | padding: 0 0 0 20px; | |
114 | font-style: italic; | |
115 | } | |
116 | ||
117 | dl, dt, dd, dl p { | |
118 | font-color: #444; | |
119 | } | |
120 | ||
121 | dl dt { | |
122 | font-weight: bold; | |
123 | } | |
124 | ||
125 | dl dd { | |
126 | padding-left: 20px; | |
127 | font-style: italic; | |
128 | } | |
129 | ||
130 | dl p { | |
131 | padding-left: 20px; | |
132 | font-style: italic; | |
133 | } | |
134 | ||
135 | hr { | |
136 | border:0; | |
137 | background:#ccc; | |
138 | height:1px; | |
139 | margin:0 0 24px; | |
140 | } | |
141 | ||
142 | /* Images */ | |
143 | ||
144 | img { | |
145 | position: relative; | |
146 | margin: 0 auto; | |
147 | max-width: 650px; | |
148 | padding: 5px; | |
149 | margin: 10px 0 32px 0; | |
150 | border: 1px solid #ccc; | |
151 | } | |
152 | ||
153 | p img { | |
154 | display: inline; | |
155 | margin: 0; | |
156 | padding: 0; | |
157 | vertical-align: middle; | |
158 | text-align: center; | |
159 | border: none; | |
160 | } | |
161 | ||
162 | /* Code blocks */ | |
163 | ||
164 | code, pre { | |
165 | font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; | |
166 | color:#000; | |
167 | font-size:14px; | |
168 | } | |
169 | ||
170 | pre { | |
171 | padding: 4px 12px; | |
172 | background: #FDFEFB; | |
173 | border-radius:4px; | |
174 | border:1px solid #D7D8C8; | |
175 | overflow: auto; | |
176 | overflow-y: hidden; | |
177 | margin-bottom: 32px; | |
178 | } | |
179 | ||
180 | ||
181 | /* Tables */ | |
182 | ||
183 | table { | |
184 | width:100%; | |
185 | } | |
186 | ||
187 | table { | |
188 | border: 1px solid #ccc; | |
189 | margin-bottom: 32px; | |
190 | text-align: left; | |
191 | } | |
192 | ||
193 | th { | |
194 | font-family: 'Arvo', Helvetica, Arial, sans-serif; | |
195 | font-size: 18px; | |
196 | font-weight: normal; | |
197 | padding: 10px; | |
198 | background: #232323; | |
199 | color: #FDFEFB; | |
200 | } | |
201 | ||
202 | td { | |
203 | padding: 10px; | |
204 | background: #ccc; | |
205 | } | |
206 | ||
207 | ||
208 | /* Wrapper */ | |
209 | .wrapper { | |
210 | width:960px; | |
211 | } | |
212 | ||
213 | ||
214 | /* Header */ | |
215 | ||
216 | header { | |
217 | background-color: #171717; | |
218 | color: #FDFDFB; | |
219 | width:170px; | |
220 | float:left; | |
221 | position:fixed; | |
222 | border: 1px solid #000; | |
223 | -webkit-border-top-right-radius: 4px; | |
224 | -webkit-border-bottom-right-radius: 4px; | |
225 | -moz-border-radius-topright: 4px; | |
226 | -moz-border-radius-bottomright: 4px; | |
227 | border-top-right-radius: 4px; | |
228 | border-bottom-right-radius: 4px; | |
229 | padding: 34px 25px 22px 50px; | |
230 | margin: 30px 25px 0 0; | |
231 | -webkit-font-smoothing: antialiased; | |
232 | } | |
233 | ||
234 | p.header { | |
235 | font-size: 16px; | |
236 | } | |
237 | ||
238 | h1.header { | |
239 | font-family: Arvo, sans-serif; | |
240 | font-size: 30px; | |
241 | font-weight: 300; | |
242 | line-height: 1.3em; | |
243 | border-bottom: none; | |
244 | margin-top: 0; | |
245 | } | |
246 | ||
247 | ||
248 | h1.header, a.header, a.name, header a{ | |
249 | color: #fff; | |
250 | } | |
251 | ||
252 | a.header { | |
253 | text-decoration: underline; | |
254 | } | |
255 | ||
256 | a.name { | |
257 | white-space: nowrap; | |
258 | } | |
259 | ||
260 | header ul { | |
261 | list-style:none; | |
262 | padding:0; | |
263 | } | |
264 | ||
265 | header li { | |
266 | list-style-type: none; | |
267 | width:132px; | |
268 | height:15px; | |
269 | margin-bottom: 12px; | |
270 | line-height: 1em; | |
271 | padding: 6px 6px 6px 7px; | |
272 | ||
273 | background: #AF0011; | |
274 | background: -moz-linear-gradient(top, #AF0011 0%, #820011 100%); | |
275 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd)); | |
276 | background: -webkit-linear-gradient(top, #AF0011 0%,#820011 100%); | |
277 | background: -o-linear-gradient(top, #AF0011 0%,#820011 100%); | |
278 | background: -ms-linear-gradient(top, #AF0011 0%,#820011 100%); | |
279 | background: linear-gradient(top, #AF0011 0%,#820011 100%); | |
280 | ||
281 | border-radius:4px; | |
282 | border:1px solid #0D0D0D; | |
283 | ||
284 | -webkit-box-shadow: inset 0px 1px 1px 0 rgba(233,2,38, 1); | |
285 | box-shadow: inset 0px 1px 1px 0 rgba(233,2,38, 1); | |
286 | ||
287 | } | |
288 | ||
289 | header li:hover { | |
290 | background: #C3001D; | |
291 | background: -moz-linear-gradient(top, #C3001D 0%, #950119 100%); | |
292 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd)); | |
293 | background: -webkit-linear-gradient(top, #C3001D 0%,#950119 100%); | |
294 | background: -o-linear-gradient(top, #C3001D 0%,#950119 100%); | |
295 | background: -ms-linear-gradient(top, #C3001D 0%,#950119 100%); | |
296 | background: linear-gradient(top, #C3001D 0%,#950119 100%); | |
297 | } | |
298 | ||
299 | a.buttons { | |
300 | -webkit-font-smoothing: antialiased; | |
301 | background: url(../images/arrow-down.png) no-repeat; | |
302 | font-weight: normal; | |
303 | text-shadow: rgba(0, 0, 0, 0.4) 0 -1px 0; | |
304 | padding: 2px 2px 2px 22px; | |
305 | height: 30px; | |
306 | } | |
307 | ||
308 | a.github { | |
309 | background: url(../images/octocat-small.png) no-repeat 1px; | |
310 | } | |
311 | ||
312 | a.buttons:hover { | |
313 | color: #fff; | |
314 | text-decoration: none; | |
315 | } | |
316 | ||
317 | ||
318 | /* Section - for main page content */ | |
319 | ||
320 | section { | |
321 | width:650px; | |
322 | float:right; | |
323 | padding-bottom:50px; | |
324 | } | |
325 | ||
326 | ||
327 | /* Footer */ | |
328 | ||
329 | footer { | |
330 | width:170px; | |
331 | float:left; | |
332 | position:fixed; | |
333 | bottom:10px; | |
334 | padding-left: 50px; | |
335 | } | |
336 | ||
337 | @media print, screen and (max-width: 960px) { | |
338 | ||
339 | div.wrapper { | |
340 | width:auto; | |
341 | margin:0; | |
342 | } | |
343 | ||
344 | header, section, footer { | |
345 | float:none; | |
346 | position:static; | |
347 | width:auto; | |
348 | } | |
349 | ||
350 | footer { | |
351 | border-top: 1px solid #ccc; | |
352 | margin:0 84px 0 50px; | |
353 | padding:0; | |
354 | } | |
355 | ||
356 | header { | |
357 | padding-right:320px; | |
358 | } | |
359 | ||
360 | section { | |
361 | padding:20px 84px 20px 50px; | |
362 | margin:0 0 20px; | |
363 | } | |
364 | ||
365 | header a small { | |
366 | display:inline; | |
367 | } | |
368 | ||
369 | header ul { | |
370 | position:absolute; | |
371 | right:130px; | |
372 | top:84px; | |
373 | } | |
374 | } | |
375 | ||
376 | @media print, screen and (max-width: 720px) { | |
377 | body { | |
378 | word-wrap:break-word; | |
379 | } | |
380 | ||
381 | header { | |
382 | padding:10px 20px 0; | |
383 | margin-right: 0; | |
384 | } | |
385 | ||
386 | section { | |
387 | padding:10px 0 10px 20px; | |
388 | margin:0 0 30px; | |
389 | } | |
390 | ||
391 | footer { | |
392 | margin: 0 0 0 30px; | |
393 | } | |
394 | ||
395 | header ul, header p.view { | |
396 | position:static; | |
397 | } | |
398 | } | |
399 | ||
400 | @media print, screen and (max-width: 480px) { | |
401 | ||
402 | header ul li.download { | |
403 | display:none; | |
404 | } | |
405 | ||
406 | footer { | |
407 | margin: 0 0 0 20px; | |
408 | } | |
409 | ||
410 | footer a{ | |
411 | display:block; | |
412 | } | |
413 | ||
414 | } | |
415 | ||
416 | @media print { | |
417 | body { | |
418 | padding:0.4in; | |
419 | font-size:12pt; | |
420 | color:#444; | |
421 | } | |
422 | }⏎ |
11 | 11 | #include <openlibm_fenv_powerpc.h> |
12 | 12 | #elif defined(__mips__) |
13 | 13 | #include <openlibm_fenv_mips.h> |
14 | #elif defined(__s390__) | |
15 | #include <openlibm_fenv_s390.h> | |
14 | 16 | #else |
15 | 17 | #error "Unsupported platform" |
16 | 18 | #endif |
0 | /*- | |
1 | * Copyright (c) 2016 Dan Horák <dan[at]danny.cz> | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions | |
6 | * are met: | |
7 | * 1. Redistributions of source code must retain the above copyright | |
8 | * notice, this list of conditions and the following disclaimer. | |
9 | * 2. Redistributions in binary form must reproduce the above copyright | |
10 | * notice, this list of conditions and the following disclaimer in the | |
11 | * documentation and/or other materials provided with the distribution. | |
12 | * | |
13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
16 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
17 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
19 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
20 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
21 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
23 | * SUCH DAMAGE. | |
24 | * | |
25 | * $FreeBSD$ | |
26 | */ | |
27 | ||
28 | #ifndef _FENV_H_ | |
29 | #define _FENV_H_ | |
30 | ||
31 | #include <sys/types.h> | |
32 | ||
33 | #ifndef __fenv_static | |
34 | #define __fenv_static static | |
35 | #endif | |
36 | ||
37 | typedef __uint32_t fenv_t; | |
38 | typedef __uint32_t fexcept_t; | |
39 | ||
40 | /* Exception flags */ | |
41 | #define FE_INEXACT 0x080000 | |
42 | #define FE_UNDERFLOW 0x100000 | |
43 | #define FE_OVERFLOW 0x200000 | |
44 | #define FE_DIVBYZERO 0x400000 | |
45 | #define FE_INVALID 0x800000 /* all types of invalid FP ops */ | |
46 | ||
47 | #define FE_ALL_EXCEPT (FE_INVALID | FE_DIVBYZERO | FE_INEXACT | FE_OVERFLOW | FE_UNDERFLOW) | |
48 | ||
49 | /* Rounding modes */ | |
50 | #define FE_TONEAREST 0x0000 | |
51 | #define FE_TOWARDZERO 0x0001 | |
52 | #define FE_UPWARD 0x0002 | |
53 | #define FE_DOWNWARD 0x0003 | |
54 | #define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \ | |
55 | FE_UPWARD | FE_TOWARDZERO) | |
56 | ||
57 | __BEGIN_DECLS | |
58 | ||
59 | /* Default floating-point environment */ | |
60 | extern const fenv_t __fe_dfl_env; | |
61 | #define FE_DFL_ENV (&__fe_dfl_env) | |
62 | ||
63 | /* We need to be able to map status flag positions to mask flag positions */ | |
64 | #define _FPC_EXC_MASK_SHIFT 8 | |
65 | #define _ENABLE_MASK ((FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \ | |
66 | FE_OVERFLOW | FE_UNDERFLOW) << _FPC_EXC_MASK_SHIFT) | |
67 | ||
68 | /* Macros for accessing the hardware control word. */ | |
69 | #define _FPU_GETCW(cw) __asm__ __volatile__ ("efpc %0,0" : "=d" (cw)) | |
70 | #define _FPU_SETCW(cw) __asm__ __volatile__ ("sfpc %0,0" : : "d" (cw)) | |
71 | ||
72 | __fenv_static inline int | |
73 | feclearexcept(int __excepts) | |
74 | { | |
75 | fexcept_t __r; | |
76 | ||
77 | if (__excepts & FE_INVALID) | |
78 | __excepts |= FE_ALL_EXCEPT; | |
79 | _FPU_GETCW(__r); | |
80 | __r &= ~__excepts; | |
81 | _FPU_SETCW(__r); | |
82 | return (0); | |
83 | } | |
84 | ||
85 | __fenv_static inline int | |
86 | fegetexceptflag(fexcept_t *__flagp, int __excepts) | |
87 | { | |
88 | fexcept_t __r; | |
89 | ||
90 | _FPU_GETCW(__r); | |
91 | *__flagp = __r & __excepts; | |
92 | return (0); | |
93 | } | |
94 | ||
95 | __fenv_static inline int | |
96 | fesetexceptflag(const fexcept_t *__flagp, int __excepts) | |
97 | { | |
98 | fexcept_t __r; | |
99 | ||
100 | if (__excepts & FE_INVALID) | |
101 | __excepts |= FE_ALL_EXCEPT; | |
102 | _FPU_GETCW(__r); | |
103 | __r &= ~__excepts; | |
104 | __r |= *__flagp & __excepts; | |
105 | _FPU_SETCW(__r); | |
106 | return (0); | |
107 | } | |
108 | ||
109 | __fenv_static inline int | |
110 | feraiseexcept(int __excepts) | |
111 | { | |
112 | fexcept_t __r; | |
113 | ||
114 | _FPU_GETCW(__r); | |
115 | __r |= __excepts; | |
116 | _FPU_SETCW(__r); | |
117 | return (0); | |
118 | } | |
119 | ||
120 | __fenv_static inline int | |
121 | fetestexcept(int __excepts) | |
122 | { | |
123 | fexcept_t __r; | |
124 | ||
125 | _FPU_GETCW(__r); | |
126 | return (__r & __excepts); | |
127 | } | |
128 | ||
129 | __fenv_static inline int | |
130 | fegetround(void) | |
131 | { | |
132 | fexcept_t __r; | |
133 | ||
134 | _FPU_GETCW(__r); | |
135 | return (__r & _ROUND_MASK); | |
136 | } | |
137 | ||
138 | __fenv_static inline int | |
139 | fesetround(int __round) | |
140 | { | |
141 | fexcept_t __r; | |
142 | ||
143 | if (__round & ~_ROUND_MASK) | |
144 | return (-1); | |
145 | ||
146 | _FPU_GETCW(__r); | |
147 | __r &= ~_ROUND_MASK; | |
148 | __r |= __round; | |
149 | _FPU_SETCW(__r); | |
150 | return (0); | |
151 | } | |
152 | ||
153 | __fenv_static inline int | |
154 | fegetenv(fenv_t *__envp) | |
155 | { | |
156 | _FPU_GETCW(*__envp); | |
157 | return (0); | |
158 | } | |
159 | ||
160 | __fenv_static inline int | |
161 | feholdexcept(fenv_t *__envp) | |
162 | { | |
163 | fexcept_t __r; | |
164 | ||
165 | _FPU_GETCW(__r); | |
166 | *__envp = __r; | |
167 | __r &= ~(FE_ALL_EXCEPT | _ENABLE_MASK); | |
168 | _FPU_SETCW(__r); | |
169 | return (0); | |
170 | } | |
171 | ||
172 | __fenv_static inline int | |
173 | fesetenv(const fenv_t *__envp) | |
174 | { | |
175 | _FPU_SETCW(*__envp); | |
176 | return (0); | |
177 | } | |
178 | ||
179 | __fenv_static inline int | |
180 | feupdateenv(const fenv_t *__envp) | |
181 | { | |
182 | fexcept_t __r; | |
183 | ||
184 | _FPU_GETCW(__r); | |
185 | __r &= FE_ALL_EXCEPT; | |
186 | __r |= *__envp; | |
187 | _FPU_SETCW(__r); | |
188 | return (0); | |
189 | } | |
190 | ||
191 | #if __BSD_VISIBLE | |
192 | ||
193 | /* We currently provide no external definitions of the functions below. */ | |
194 | ||
195 | static inline int | |
196 | feenableexcept(int __mask) | |
197 | { | |
198 | fenv_t __r; | |
199 | fenv_t __oldmask; | |
200 | ||
201 | _FPU_GETCW(__r); | |
202 | __oldmask = __r; | |
203 | __r |= (__mask & FE_ALL_EXCEPT) << _FPC_EXC_MASK_SHIFT; | |
204 | _FPU_SETCW(__r); | |
205 | return ((__oldmask & _ENABLE_MASK) >> _FPC_EXC_MASK_SHIFT); | |
206 | } | |
207 | ||
208 | static inline int | |
209 | fedisableexcept(int __mask) | |
210 | { | |
211 | fenv_t __r; | |
212 | fenv_t __oldmask; | |
213 | ||
214 | _FPU_GETCW(__r); | |
215 | __oldmask = __r; | |
216 | __r &= ~((__mask & FE_ALL_EXCEPT) << _FPC_EXC_MASK_SHIFT); | |
217 | _FPU_SETCW(__r); | |
218 | return ((__oldmask & _ENABLE_MASK) >> _FPC_EXC_MASK_SHIFT); | |
219 | } | |
220 | ||
221 | static inline int | |
222 | fegetexcept(void) | |
223 | { | |
224 | fexcept_t __r; | |
225 | ||
226 | _FPU_GETCW(__r); | |
227 | return (__r & (_ENABLE_MASK >> _FPC_EXC_MASK_SHIFT)); | |
228 | } | |
229 | ||
230 | #endif /* __BSD_VISIBLE */ | |
231 | ||
232 | __END_DECLS | |
233 | ||
234 | #endif /* !_FENV_H_ */ |
24 | 24 | #define __WIN32__ |
25 | 25 | #endif |
26 | 26 | |
27 | #ifndef __arm__ | |
28 | #define LONG_DOUBLE | |
27 | #if !defined(__arm__) && !defined(__wasm__) | |
28 | #define OLM_LONG_DOUBLE | |
29 | 29 | #endif |
30 | 30 | |
31 | 31 | #ifndef __pure2 |
3 | 3 | |
4 | 4 | Name: openlibm |
5 | 5 | Version: ${version} |
6 | URL: https://github.com/JuliaLang/openlibm | |
6 | URL: https://github.com/JuliaMath/openlibm | |
7 | 7 | Description: High quality system independent, open source libm. |
8 | 8 | Cflags: -I${includedir} |
9 | 9 | Libs: -L${libdir} -lopenlibm |
0 | $(CUR_SRCS) = fenv.c |
0 | /*- | |
1 | * Copyright (c) 2016 Dan Horák <dan[at]danny.cz> | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions | |
6 | * are met: | |
7 | * 1. Redistributions of source code must retain the above copyright | |
8 | * notice, this list of conditions and the following disclaimer. | |
9 | * 2. Redistributions in binary form must reproduce the above copyright | |
10 | * notice, this list of conditions and the following disclaimer in the | |
11 | * documentation and/or other materials provided with the distribution. | |
12 | * | |
13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
16 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
17 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
19 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
20 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
21 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
23 | * SUCH DAMAGE. | |
24 | * | |
25 | * $FreeBSD$ | |
26 | * | |
27 | * cloned from ppc/fenv.c | |
28 | */ | |
29 | ||
30 | #define __fenv_static | |
31 | #include <openlibm_fenv.h> | |
32 | ||
33 | #ifdef __GNUC_GNU_INLINE__ | |
34 | #error "This file must be compiled with C99 'inline' semantics" | |
35 | #endif | |
36 | ||
37 | const fenv_t __fe_dfl_env = 0x00000000; | |
38 | ||
39 | extern inline int feclearexcept(int __excepts); | |
40 | extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); | |
41 | extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts); | |
42 | extern inline int feraiseexcept(int __excepts); | |
43 | extern inline int fetestexcept(int __excepts); | |
44 | extern inline int fegetround(void); | |
45 | extern inline int fesetround(int __round); | |
46 | extern inline int fegetenv(fenv_t *__envp); | |
47 | extern inline int feholdexcept(fenv_t *__envp); | |
48 | extern inline int fesetenv(const fenv_t *__envp); | |
49 | extern inline int feupdateenv(const fenv_t *__envp); |
14 | 14 | s_copysign.c s_copysignf.c s_cos.c s_cosf.c \ |
15 | 15 | s_csqrt.c s_csqrtf.c s_erf.c s_erff.c \ |
16 | 16 | s_exp2.c s_exp2f.c s_expm1.c s_expm1f.c s_fabs.c s_fabsf.c s_fdim.c \ |
17 | s_floor.c s_floorf.c s_fma.c s_fmaf.c \ | |
17 | s_floor.c s_floorf.c \ | |
18 | 18 | s_fmax.c s_fmaxf.c s_fmin.c \ |
19 | 19 | s_fminf.c s_fpclassify.c \ |
20 | 20 | s_frexp.c s_frexpf.c s_ilogb.c s_ilogbf.c \ |
21 | 21 | s_isinf.c s_isfinite.c s_isnormal.c s_isnan.c \ |
22 | s_llrint.c s_llrintf.c s_llround.c s_llroundf.c \ | |
23 | s_log1p.c s_log1pf.c s_logb.c s_logbf.c s_lrint.c s_lrintf.c \ | |
24 | s_lround.c s_lroundf.c s_modf.c s_modff.c \ | |
25 | s_nearbyint.c s_nextafter.c s_nextafterf.c \ | |
22 | s_log1p.c s_log1pf.c s_logb.c s_logbf.c \ | |
23 | s_modf.c s_modff.c \ | |
24 | s_nextafter.c s_nextafterf.c \ | |
26 | 25 | s_nexttowardf.c s_remquo.c s_remquof.c \ |
27 | 26 | s_rint.c s_rintf.c s_round.c s_roundf.c \ |
28 | 27 | s_scalbln.c s_scalbn.c s_scalbnf.c s_signbit.c \ |
31 | 30 | s_trunc.c s_truncf.c s_cpow.c s_cpowf.c \ |
32 | 31 | w_cabs.c w_cabsf.c |
33 | 32 | |
33 | ifneq ($(ARCH), wasm32) | |
34 | ||
35 | $(CUR_SRCS) += \ | |
36 | s_fma.c s_fmaf.c s_lrint.c s_lrintf.c s_lround.c s_lroundf.c \ | |
37 | s_llrint.c s_llrintf.c s_llround.c s_llroundf.c s_nearbyint.c | |
38 | ||
34 | 39 | ifneq ($(OS), WINNT) |
35 | 40 | $(CUR_SRCS) += s_nan.c |
41 | endif | |
42 | ||
36 | 43 | endif |
37 | 44 | |
38 | 45 | # Add in long double functions for x86, x64 and aarch64 |
11 | 11 | #endif /* !defined(__BEGIN_DECLS) */ |
12 | 12 | |
13 | 13 | #ifdef __GNUC__ |
14 | #ifndef __strong_reference | |
14 | #if defined(__strong_alias) && defined(__NetBSD__) | |
15 | #define openlibm_strong_reference(sym,alias) __strong_alias(alias,sym) | |
16 | #elif defined(__strong_reference) | |
17 | #define openlibm_strong_reference(sym,alias) __strong_reference(sym,alias) | |
18 | #else | |
15 | 19 | #ifdef __APPLE__ |
16 | #define __strong_reference(sym,aliassym) __weak_reference(sym,aliassym) | |
20 | #define openlibm_strong_reference(sym,aliassym) openlibm_weak_reference(sym,aliassym) | |
17 | 21 | #else |
18 | #define __strong_reference(sym,aliassym) \ | |
22 | #define openlibm_strong_reference(sym,aliassym) \ | |
19 | 23 | OLM_DLLEXPORT extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))); |
20 | 24 | #endif /* __APPLE__ */ |
21 | 25 | #endif /* __strong_reference */ |
22 | 26 | |
23 | #ifndef __weak_reference | |
27 | #ifdef __wasm__ | |
28 | #define openlibm_weak_reference(sym,alias) openlibm_strong_reference(sym,alias) | |
29 | #elif defined(__weak_alias) && defined(__NetBSD__) | |
30 | #define openlibm_weak_reference(sym,alias) __weak_alias(alias,sym) | |
31 | #elif defined(__weak_reference) | |
32 | #define openlibm_weak_reference(sym,alias) __weak_reference(sym,alias) | |
33 | #else | |
24 | 34 | #ifdef __ELF__ |
25 | 35 | #ifdef __STDC__ |
26 | #define __weak_reference(sym,alias) \ | |
36 | #define openlibm_weak_reference(sym,alias) \ | |
27 | 37 | __asm__(".weak " #alias); \ |
28 | 38 | __asm__(".equ " #alias ", " #sym) |
29 | #ifndef __warn_references | |
30 | #define __warn_references(sym,msg) \ | |
39 | #ifdef __warn_references | |
40 | #define openlibm_warn_references(sym,msg) __warn_references(sym,msg) | |
41 | #else | |
42 | #define openlibm_warn_references(sym,msg) \ | |
31 | 43 | __asm__(".section .gnu.warning." #sym); \ |
32 | 44 | __asm__(".asciz \"" msg "\""); \ |
33 | 45 | __asm__(".previous") |
34 | 46 | #endif /* __warn_references */ |
35 | 47 | #else |
36 | #define __weak_reference(sym,alias) \ | |
48 | #define openlibm_weak_reference(sym,alias) \ | |
37 | 49 | __asm__(".weak alias"); \ |
38 | 50 | __asm__(".equ alias, sym") |
39 | #ifndef __warn_references | |
40 | #define __warn_references(sym,msg) \ | |
51 | #ifdef __warn_references | |
52 | #define openlibm_warn_references(sym,msg) __warn_references(sym,msg) | |
53 | #else | |
54 | #define openlibm_warn_references(sym,msg) \ | |
41 | 55 | __asm__(".section .gnu.warning.sym"); \ |
42 | 56 | __asm__(".asciz \"msg\""); \ |
43 | 57 | __asm__(".previous") |
45 | 59 | #endif /* __STDC__ */ |
46 | 60 | #elif defined(__clang__) /* CLANG */ |
47 | 61 | #ifdef __STDC__ |
48 | #define __weak_reference(sym,alias) \ | |
62 | #define openlibm_weak_reference(sym,alias) \ | |
49 | 63 | __asm__(".weak_reference " #alias); \ |
50 | 64 | __asm__(".set " #alias ", " #sym) |
51 | 65 | #else |
52 | #define __weak_reference(sym,alias) \ | |
66 | #define openlibm_weak_reference(sym,alias) \ | |
53 | 67 | __asm__(".weak_reference alias");\ |
54 | 68 | __asm__(".set alias, sym") |
55 | 69 | #endif |
56 | 70 | #else /* !__ELF__ */ |
57 | 71 | #ifdef __STDC__ |
58 | #define __weak_reference(sym,alias) \ | |
72 | #define openlibm_weak_reference(sym,alias) \ | |
59 | 73 | __asm__(".stabs \"_" #alias "\",11,0,0,0"); \ |
60 | 74 | __asm__(".stabs \"_" #sym "\",1,0,0,0") |
61 | #ifndef __warn_references | |
62 | #define __warn_references(sym,msg) \ | |
75 | #ifdef __warn_references | |
76 | #define openlibm_warn_references(sym,msg) __warn_references(sym,msg) | |
77 | #else | |
78 | #define openlibm_warn_references(sym,msg) \ | |
63 | 79 | __asm__(".stabs \"" msg "\",30,0,0,0"); \ |
64 | 80 | __asm__(".stabs \"_" #sym "\",1,0,0,0") |
65 | 81 | #endif /* __warn_references */ |
66 | 82 | #else |
67 | #define __weak_reference(sym,alias) \ | |
83 | #define openlibm_weak_reference(sym,alias) \ | |
68 | 84 | __asm__(".stabs \"_/**/alias\",11,0,0,0"); \ |
69 | 85 | __asm__(".stabs \"_/**/sym\",1,0,0,0") |
70 | #ifndef __warn_references | |
71 | #define __warn_references(sym,msg) \ | |
86 | #ifdef __warn_references | |
87 | #define openlibm_warn_references(sym,msg) __warn_references(sym,msg) | |
88 | #else | |
89 | #define openlibm_warn_references(sym,msg) \ | |
72 | 90 | __asm__(".stabs msg,30,0,0,0"); \ |
73 | 91 | __asm__(".stabs \"_/**/sym\",1,0,0,0") |
74 | 92 | #endif /* __warn_references */ |
106 | 106 | } |
107 | 107 | |
108 | 108 | #if LDBL_MANT_DIG == 53 |
109 | __weak_reference(acos, acosl); | |
109 | openlibm_weak_reference(acos, acosl); | |
110 | 110 | #endif |
112 | 112 | } |
113 | 113 | |
114 | 114 | #if LDBL_MANT_DIG == 53 |
115 | __weak_reference(asin, asinl); | |
115 | openlibm_weak_reference(asin, asinl); | |
116 | 116 | #endif |
124 | 124 | } |
125 | 125 | |
126 | 126 | #if LDBL_MANT_DIG == 53 |
127 | __weak_reference(atan2, atan2l); | |
127 | openlibm_weak_reference(atan2, atan2l); | |
128 | 128 | #endif |
126 | 126 | } |
127 | 127 | |
128 | 128 | #if LDBL_MANT_DIG == 53 |
129 | __weak_reference(hypot, hypotl); | |
129 | openlibm_weak_reference(hypot, hypotl); | |
130 | 130 | #endif |
74 | 74 | } |
75 | 75 | |
76 | 76 | #if LDBL_MANT_DIG == 53 |
77 | __weak_reference(remainder, remainderl); | |
77 | openlibm_weak_reference(remainder, remainderl); | |
78 | 78 | #endif |
188 | 188 | } |
189 | 189 | |
190 | 190 | #if (LDBL_MANT_DIG == 53) |
191 | __weak_reference(sqrt, sqrtl); | |
191 | openlibm_weak_reference(sqrt, sqrtl); | |
192 | 192 | #endif |
193 | 193 | |
194 | 194 | /* |
40 | 40 | #include "powerpc_fpmath.h" |
41 | 41 | #elif defined(__mips__) |
42 | 42 | #include "mips_fpmath.h" |
43 | #elif defined(__s390__) | |
44 | #include "s390_fpmath.h" | |
43 | 45 | #endif |
44 | 46 | |
45 | 47 | /* Definitions provided directly by GCC and Clang. */ |
0 | /*- | |
1 | * Copyright (c) 2016 Dan Horák <dan[at]danny.cz> | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions | |
6 | * are met: | |
7 | * 1. Redistributions of source code must retain the above copyright | |
8 | * notice, this list of conditions and the following disclaimer. | |
9 | * 2. Redistributions in binary form must reproduce the above copyright | |
10 | * notice, this list of conditions and the following disclaimer in the | |
11 | * documentation and/or other materials provided with the distribution. | |
12 | * | |
13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
16 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
17 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
19 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
20 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
21 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
23 | * SUCH DAMAGE. | |
24 | * | |
25 | * $FreeBSD$ | |
26 | * | |
27 | * cloned from powerpc_fpmath.h | |
28 | */ | |
29 | ||
30 | union IEEEl2bits { | |
31 | long double e; | |
32 | struct { | |
33 | unsigned int sign :1; | |
34 | unsigned int exp :11; | |
35 | unsigned int manh :20; | |
36 | unsigned int manl :32; | |
37 | } bits; | |
38 | }; | |
39 | ||
40 | #define mask_nbit_l(u) ((void)0) | |
41 | #define LDBL_IMPLICIT_NBIT | |
42 | #define LDBL_NBIT 0 | |
43 | ||
44 | #define LDBL_MANH_SIZE 20 | |
45 | #define LDBL_MANL_SIZE 32 | |
46 | ||
47 | #define LDBL_TO_ARRAY32(u, a) do { \ | |
48 | (a)[0] = (uint32_t)(u).bits.manl; \ | |
49 | (a)[1] = (uint32_t)(u).bits.manh; \ | |
50 | } while(0) |
119 | 119 | } |
120 | 120 | |
121 | 121 | #if LDBL_MANT_DIG == 53 |
122 | __weak_reference(atan, atanl); | |
122 | openlibm_weak_reference(atan, atanl); | |
123 | 123 | #endif |
113 | 113 | } |
114 | 114 | |
115 | 115 | #if (LDBL_MANT_DIG == 53) |
116 | __weak_reference(cbrt, cbrtl); | |
116 | openlibm_weak_reference(cbrt, cbrtl); | |
117 | 117 | #endif |
72 | 72 | } |
73 | 73 | |
74 | 74 | #if LDBL_MANT_DIG == 53 |
75 | __weak_reference(ceil, ceill); | |
75 | openlibm_weak_reference(ceil, ceill); | |
76 | 76 | #endif |
84 | 84 | } |
85 | 85 | |
86 | 86 | #if (LDBL_MANT_DIG == 53) |
87 | __weak_reference(cos, cosl); | |
87 | openlibm_weak_reference(cos, cosl); | |
88 | 88 | #endif |
42 | 42 | } |
43 | 43 | |
44 | 44 | #if LDBL_MANT_DIG == 53 |
45 | __weak_reference(cproj, cprojl); | |
45 | openlibm_weak_reference(cproj, cprojl); | |
46 | 46 | #endif |
109 | 109 | } |
110 | 110 | |
111 | 111 | #if LDBL_MANT_DIG == 53 |
112 | __weak_reference(csqrt, csqrtl); | |
112 | openlibm_weak_reference(csqrt, csqrtl); | |
113 | 113 | #endif |
391 | 391 | } |
392 | 392 | |
393 | 393 | #if (LDBL_MANT_DIG == 53) |
394 | __weak_reference(exp2, exp2l); | |
394 | openlibm_weak_reference(exp2, exp2l); | |
395 | 395 | #endif |
42 | 42 | |
43 | 43 | DECL(double, fdim) |
44 | 44 | DECL(float, fdimf) |
45 | #ifdef OLM_LONG_DOUBLE | |
45 | 46 | DECL(long double, fdiml) |
47 | #endif |
73 | 73 | } |
74 | 74 | |
75 | 75 | #if LDBL_MANT_DIG == 53 |
76 | __weak_reference(floor, floorl); | |
76 | openlibm_weak_reference(floor, floorl); | |
77 | 77 | #endif |
279 | 279 | } |
280 | 280 | |
281 | 281 | #if (LDBL_MANT_DIG == 53) |
282 | __weak_reference(fma, fmal); | |
282 | openlibm_weak_reference(fma, fmal); | |
283 | 283 | #endif |
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | #ifdef LONG_DOUBLE | |
74 | #ifdef OLM_LONG_DOUBLE | |
75 | 75 | OLM_DLLEXPORT int |
76 | 76 | __fpclassifyl(long double e) |
77 | 77 | { |
51 | 51 | } |
52 | 52 | |
53 | 53 | #if (LDBL_MANT_DIG == 53) |
54 | __weak_reference(frexp, frexpl); | |
54 | openlibm_weak_reference(frexp, frexpl); | |
55 | 55 | #endif |
48 | 48 | return (u.bits.exp != 255); |
49 | 49 | } |
50 | 50 | |
51 | #ifdef LONG_DOUBLE | |
51 | #ifdef OLM_LONG_DOUBLE | |
52 | 52 | OLM_DLLEXPORT int |
53 | 53 | __isfinitel(long double e) |
54 | 54 | { |
50 | 50 | return (u.bits.exp == 255 && u.bits.man == 0); |
51 | 51 | } |
52 | 52 | |
53 | #ifdef LONG_DOUBLE | |
53 | #ifdef OLM_LONG_DOUBLE | |
54 | 54 | OLM_DLLEXPORT int |
55 | 55 | __isinfl(long double e) |
56 | 56 | { |
62 | 62 | } |
63 | 63 | #endif |
64 | 64 | |
65 | __weak_reference(__isinff, isinff); | |
65 | openlibm_weak_reference(__isinff, isinff); |
51 | 51 | return (u.bits.exp == 255 && u.bits.man != 0); |
52 | 52 | } |
53 | 53 | |
54 | #ifdef LONG_DOUBLE | |
54 | #ifdef OLM_LONG_DOUBLE | |
55 | 55 | OLM_DLLEXPORT int |
56 | 56 | __isnanl(long double e) |
57 | 57 | { |
63 | 63 | } |
64 | 64 | #endif |
65 | 65 | |
66 | __weak_reference(__isnanf, isnanf); | |
66 | openlibm_weak_reference(__isnanf, isnanf); |
48 | 48 | return (u.bits.exp != 0 && u.bits.exp != 255); |
49 | 49 | } |
50 | 50 | |
51 | #ifdef LONG_DOUBLE | |
51 | #ifdef OLM_LONG_DOUBLE | |
52 | 52 | OLM_DLLEXPORT int |
53 | 53 | __isnormall(long double e) |
54 | 54 | { |
44 | 44 | } |
45 | 45 | |
46 | 46 | #if (LDBL_MANT_DIG == 53) |
47 | __weak_reference(logb, logbl); | |
47 | openlibm_weak_reference(logb, logbl); | |
48 | 48 | #endif |
119 | 119 | } |
120 | 120 | |
121 | 121 | #if (LDBL_MANT_DIG == 53) |
122 | __weak_reference(nan, nanl); | |
122 | openlibm_weak_reference(nan, nanl); | |
123 | 123 | #endif |
76 | 76 | } |
77 | 77 | |
78 | 78 | #if (LDBL_MANT_DIG == 53) |
79 | __weak_reference(nextafter, nexttoward); | |
80 | __weak_reference(nextafter, nexttowardl); | |
81 | __weak_reference(nextafter, nextafterl); | |
79 | openlibm_weak_reference(nextafter, nexttoward); | |
80 | openlibm_weak_reference(nextafter, nexttowardl); | |
81 | openlibm_weak_reference(nextafter, nextafterl); | |
82 | 82 | #endif |
76 | 76 | return ux.e; |
77 | 77 | } |
78 | 78 | |
79 | __strong_reference(nextafterl, nexttowardl); | |
79 | openlibm_strong_reference(nextafterl, nexttowardl); |
19 | 19 | |
20 | 20 | #define LDBL_INFNAN_EXP (LDBL_MAX_EXP * 2 - 1) |
21 | 21 | |
22 | #ifdef LONG_DOUBLE | |
22 | #ifdef OLM_LONG_DOUBLE | |
23 | 23 | OLM_DLLEXPORT float |
24 | 24 | nexttowardf(float x, long double y) |
25 | 25 | { |
153 | 153 | } |
154 | 154 | |
155 | 155 | #if LDBL_MANT_DIG == 53 |
156 | __weak_reference(remquo, remquol); | |
156 | openlibm_weak_reference(remquo, remquol); | |
157 | 157 | #endif |
87 | 87 | } |
88 | 88 | |
89 | 89 | #if (LDBL_MANT_DIG == 53) |
90 | __weak_reference(rint, rintl); | |
90 | openlibm_weak_reference(rint, rintl); | |
91 | 91 | #endif |
61 | 61 | return (scalbnf(x, in)); |
62 | 62 | } |
63 | 63 | |
64 | #ifdef OLM_LONG_DOUBLE | |
64 | 65 | OLM_DLLEXPORT long double |
65 | 66 | scalblnl (long double x, long n) |
66 | 67 | { |
75 | 76 | } |
76 | 77 | return (scalbnl(x, (int)n)); |
77 | 78 | } |
79 | #endif |
58 | 58 | } |
59 | 59 | |
60 | 60 | #if (LDBL_MANT_DIG == 53) |
61 | __weak_reference(scalbn, ldexpl); | |
62 | __weak_reference(scalbn, scalbnl); | |
61 | openlibm_weak_reference(scalbn, ldexpl); | |
62 | openlibm_weak_reference(scalbn, scalbnl); | |
63 | 63 | #endif |
64 | 64 | |
65 | __strong_reference(scalbn, ldexp); | |
65 | openlibm_strong_reference(scalbn, ldexp); |
53 | 53 | return x*twom25; |
54 | 54 | } |
55 | 55 | |
56 | __strong_reference(scalbnf, ldexpf); | |
56 | openlibm_strong_reference(scalbnf, ldexpf); |
66 | 66 | return u.e*0x1p-128; |
67 | 67 | } |
68 | 68 | |
69 | __strong_reference(scalbnl, ldexpl); | |
69 | openlibm_strong_reference(scalbnl, ldexpl); |
48 | 48 | return (u.bits.sign); |
49 | 49 | } |
50 | 50 | |
51 | #ifdef LONG_DOUBLE | |
51 | #ifdef OLM_LONG_DOUBLE | |
52 | 52 | OLM_DLLEXPORT int |
53 | 53 | __signbitl(long double e) |
54 | 54 | { |
84 | 84 | } |
85 | 85 | |
86 | 86 | #if (LDBL_MANT_DIG == 53) |
87 | __weak_reference(sin, sinl); | |
87 | openlibm_weak_reference(sin, sinl); | |
88 | 88 | #endif |
145 | 145 | } |
146 | 146 | |
147 | 147 | #if (LDBL_MANT_DIG == 53) |
148 | __weak_reference(sincos, sincosl); | |
148 | openlibm_weak_reference(sincos, sincosl); | |
149 | 149 | #endif |
78 | 78 | } |
79 | 79 | |
80 | 80 | #if (LDBL_MANT_DIG == 53) |
81 | __weak_reference(tan, tanl); | |
81 | openlibm_weak_reference(tan, tanl); | |
82 | 82 | #endif |
62 | 62 | } |
63 | 63 | |
64 | 64 | #if LDBL_MANT_DIG == 53 |
65 | __weak_reference(trunc, truncl); | |
65 | openlibm_weak_reference(trunc, truncl); | |
66 | 66 | #endif |
20 | 20 | } |
21 | 21 | |
22 | 22 | #if LDBL_MANT_DIG == 53 |
23 | __weak_reference(cabs, cabsl); | |
23 | openlibm_weak_reference(cabs, cabsl); | |
24 | 24 | #endif |
249 | 249 | #define DELTA1663 CHOOSE(2, 2, 2, 2, 2, 1) /* yn (10, 0.1) == -0.11831335132045197885e19 */ |
250 | 250 | #define DELTA1664 CHOOSE(7, 6, 3, 7, 6, 3) /* yn (10, 0.7) == -0.42447194260703866924e10 */ |
251 | 251 | #define DELTA1665 CHOOSE(0, 1, 2, 0, 1, 1) /* yn (10, 1.0) == -0.12161801427868918929e9 */ |
252 | #define DELTA1666 CHOOSE(1, 3, 1, 1, 2, 1) /* yn (10, 2.0) == -129184.54220803928264 */ | |
252 | #define DELTA1666 CHOOSE(1, 3, 3, 1, 2, 1) /* yn (10, 2.0) == -129184.54220803928264 */ | |
253 | 253 | #define DELTA1667 CHOOSE(0, 2, 1, 0, 2, 1) /* yn (10, 10.0) == -0.35981415218340272205 */ |
0 | #define assert(x) ((void)0) |
0 | #pragma once | |
1 | ||
2 | #define FLT_RADIX 2 | |
3 | ||
4 | #define FLT_TRUE_MIN 1.40129846432481707092e-45F | |
5 | #define FLT_MIN 1.17549435082228750797e-38F | |
6 | #define FLT_MAX 3.40282346638528859812e+38F | |
7 | #define FLT_EPSILON 1.1920928955078125e-07F | |
8 | ||
9 | #define FLT_MANT_DIG 24 | |
10 | #define FLT_MIN_EXP (-125) | |
11 | #define FLT_MAX_EXP 128 | |
12 | #define FLT_HAS_SUBNORM 1 | |
13 | ||
14 | #define FLT_DIG 6 | |
15 | #define FLT_DECIMAL_DIG 9 | |
16 | #define FLT_MIN_10_EXP (-37) | |
17 | #define FLT_MAX_10_EXP 38 | |
18 | ||
19 | #define DBL_TRUE_MIN 4.94065645841246544177e-324 | |
20 | #define DBL_MIN 2.22507385850720138309e-308 | |
21 | #define DBL_MAX 1.79769313486231570815e+308 | |
22 | #define DBL_EPSILON 2.22044604925031308085e-16 | |
23 | ||
24 | #define DBL_MANT_DIG 53 | |
25 | #define DBL_MIN_EXP (-1021) | |
26 | #define DBL_MAX_EXP 1024 | |
27 | #define DBL_HAS_SUBNORM 1 | |
28 | ||
29 | #define DBL_DIG 15 | |
30 | #define DBL_DECIMAL_DIG 17 | |
31 | #define DBL_MIN_10_EXP (-307) | |
32 | #define DBL_MAX_10_EXP 308 |
0 | #include <stdint.h> | |
1 | ||
2 | #define INT_MIN INT32_MIN | |
3 | #define INT_MAX INT32_MAX | |
4 | #define LONG_MIN INT32_MIN | |
5 | #define LONG_MAX INT32_MAX | |
6 | #define LLONG_MIN INT64_MIN | |
7 | #define LLONG_MAX INT64_MAX | |
8 |
0 | #pragma once | |
1 | ||
2 | typedef unsigned char uint8_t; | |
3 | typedef unsigned short uint16_t; | |
4 | typedef unsigned int uint32_t; | |
5 | typedef unsigned long long uint64_t; | |
6 | ||
7 | typedef char int8_t; | |
8 | typedef short int16_t; | |
9 | typedef int int32_t; | |
10 | typedef long long int64_t; | |
11 | ||
12 | typedef unsigned int uintptr_t; | |
13 | typedef int intptr_t; | |
14 | ||
15 | _Static_assert(sizeof (uint8_t) == 1, "invalid size"); | |
16 | _Static_assert(sizeof (uint16_t) == 2, "invalid size"); | |
17 | _Static_assert(sizeof (uint32_t) == 4, "invalid size"); | |
18 | _Static_assert(sizeof (uint64_t) == 8, "invalid size"); | |
19 | ||
20 | _Static_assert(sizeof (int8_t) == 1, "invalid size"); | |
21 | _Static_assert(sizeof (int16_t) == 2, "invalid size"); | |
22 | _Static_assert(sizeof (int32_t) == 4, "invalid size"); | |
23 | _Static_assert(sizeof (int64_t) == 8, "invalid size"); | |
24 | ||
25 | _Static_assert(sizeof (uintptr_t) == sizeof (intptr_t), "invalid size"); | |
26 | _Static_assert(sizeof (uintptr_t) == sizeof (void*), "invalid size"); | |
27 | _Static_assert(sizeof (uintptr_t) == 4, "invalid size"); | |
28 | ||
29 | #define UINT8_MAX 0xFF | |
30 | #define UINT16_MAX 0xFFFF | |
31 | #define UINT32_MAX 0xFFFFFFFFUL | |
32 | #define UINT64_MAX 0xFFFFFFFFFFFFFFFFULL | |
33 | ||
34 | #define INT8_MAX 0x7F | |
35 | #define INT16_MAX 0x7FFF | |
36 | #define INT32_MAX 0x7FFFFFFF | |
37 | #define INT64_MAX 0x7FFFFFFFFFFFFFFF | |
38 | ||
39 | #define INT8_MIN (-0x80) | |
40 | #define INT16_MIN (-0x8000) | |
41 | #define INT32_MIN (-0x80000000L) | |
42 | #define INT64_MIN (-0x8000000000000000LL) |