Expose rust math with a feature flag
This commit is contained in:
@@ -133,6 +133,7 @@ redox_protocols.workspace = true
|
||||
default = ["check_against_libc_crate", "ld_so_cache", "no_trace"]
|
||||
check_against_libc_crate = ["__libc_only_for_layout_checks"]
|
||||
ld_so_cache = []
|
||||
math_libm = []
|
||||
no_trace = ["log/release_max_level_debug"]
|
||||
# for very verbose activity beyond trace level
|
||||
trace_tls = []
|
||||
|
||||
@@ -7,19 +7,26 @@ CARGOFLAGS?=$(CARGO_COMMON_FLAGS)
|
||||
CC_WRAPPER?=
|
||||
RUSTCFLAGS?=
|
||||
LINKFLAGS?=-lgcc
|
||||
USE_RUST_LIBM?=
|
||||
TESTBIN?=
|
||||
export OBJCOPY?=objcopy
|
||||
|
||||
export CARGO_TARGET_DIR?=$(shell pwd)/target
|
||||
BUILD?=$(CARGO_TARGET_DIR)/$(TARGET)
|
||||
CARGOFLAGS+=--target=$(TARGET)
|
||||
EXCEPT_MATH=-not -name "math"
|
||||
FEATURE_MATH=
|
||||
ifneq ($(USE_RUST_LIBM),)
|
||||
FEATURE_MATH=--features math_libm
|
||||
EXCEPT_MATH=
|
||||
endif
|
||||
|
||||
TARGET_HEADERS?=$(BUILD)/include
|
||||
export CFLAGS=-I$(TARGET_HEADERS)
|
||||
|
||||
PROFILE?=release
|
||||
|
||||
HEADERS_UNPARSED=$(shell find src/header -mindepth 1 -maxdepth 1 -type d -not -name "_*" -printf "%f\n")
|
||||
HEADERS_UNPARSED=$(shell find src/header -mindepth 1 -maxdepth 1 -type d -not -name "_*" $(EXCEPT_MATH) -printf "%f\n")
|
||||
HEADERS_DEPS=$(shell find src/header -type f \( -name "cbindgen.toml" -o -name "*.rs" \))
|
||||
#HEADERS=$(patsubst %,%.h,$(subst _,/,$(HEADERS_UNPARSED)))
|
||||
|
||||
@@ -37,12 +44,14 @@ headers: $(HEADERS_DEPS)
|
||||
rm -rf $(TARGET_HEADERS)
|
||||
mkdir -p $(TARGET_HEADERS)
|
||||
cp -r include/* $(TARGET_HEADERS)
|
||||
ifeq ($(USE_RUST_LIBM),)
|
||||
cp "openlibm/include"/*.h $(TARGET_HEADERS)
|
||||
cp "openlibm/src"/*.h $(TARGET_HEADERS)
|
||||
endif
|
||||
@set -e ; \
|
||||
for header in $(HEADERS_UNPARSED); do \
|
||||
echo -e "\033[0;36;49mWriting Header $$header\033[0m"; \
|
||||
if test -f "src/header/$$header/cbindgen.toml"; then \
|
||||
echo -e "\033[0;36;49mWriting Header $$header\033[0m"; \
|
||||
out=`echo "$$header" | sed 's/_/\//g'`; \
|
||||
out="$(TARGET_HEADERS)/$$out.h"; \
|
||||
cat "src/header/$$header/cbindgen.toml" cbindgen.globdefs.toml \
|
||||
@@ -83,7 +92,9 @@ install-libs: headers libs
|
||||
cp -v "$(BUILD)/$(PROFILE)/crti.o" "$(DESTDIR)/lib"
|
||||
cp -v "$(BUILD)/$(PROFILE)/crtn.o" "$(DESTDIR)/lib"
|
||||
cp -v "$(BUILD)/$(PROFILE)/ld_so" "$(DESTDIR)/$(LD_SO_PATH)"
|
||||
ifeq ($(USE_RUST_LIBM),)
|
||||
cp -v "$(BUILD)/openlibm/libopenlibm.a" "$(DESTDIR)/lib/libm.a"
|
||||
endif
|
||||
# Empty libraries for dl, pthread, and rt
|
||||
$(AR) -rcs "$(DESTDIR)/lib/libdl.a"
|
||||
$(AR) -rcs "$(DESTDIR)/lib/libpthread.a"
|
||||
@@ -149,7 +160,7 @@ $(BUILD)/$(PROFILE)/libc.a: $(BUILD)/$(PROFILE)/librelibc.a $(BUILD)/openlibm/li
|
||||
# Debug targets
|
||||
|
||||
$(BUILD)/debug/librelibc.a: $(SRC)
|
||||
$(CARGO) rustc $(CARGOFLAGS) -- --emit link=$@ -g -C debug-assertions=no $(RUSTCFLAGS)
|
||||
$(CARGO) rustc $(CARGOFLAGS) $(FEATURE_MATH) -- --emit link=$@ -g -C debug-assertions=no $(RUSTCFLAGS)
|
||||
./renamesyms.sh "$@" "$(BUILD)/debug/deps/"
|
||||
./stripcore.sh "$@"
|
||||
touch $@
|
||||
@@ -205,6 +216,12 @@ $(BUILD)/openlibm: openlibm
|
||||
mv $@.partial $@
|
||||
touch $@
|
||||
|
||||
ifeq ($(USE_RUST_LIBM),)
|
||||
$(BUILD)/openlibm/libopenlibm.a: $(BUILD)/openlibm $(BUILD)/$(PROFILE)/librelibc.a
|
||||
$(MAKE) -s AR=$(AR) CC="$(CC_WRAPPER) $(CC)" LD=$(LD) CPPFLAGS="$(CPPFLAGS) -fno-stack-protector -I$(shell pwd)/include -I$(TARGET_HEADERS)" -C $< libopenlibm.a
|
||||
./renamesyms.sh "$@" "$(BUILD)/release/deps/"
|
||||
else
|
||||
$(BUILD)/openlibm/libopenlibm.a:
|
||||
mkdir -p "$(BUILD)/openlibm"
|
||||
$(AR) -rcs "$(BUILD)/openlibm/libopenlibm.a"
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# Note: changing this file requires `make clean`.
|
||||
sys_includes = []
|
||||
include_guard = "_RELIBC_MATH_H"
|
||||
language = "C"
|
||||
style = "Type"
|
||||
no_includes = true
|
||||
cpp_compat = true
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
+120
-108
@@ -7,25 +7,25 @@ use crate::platform::types::{c_double, c_float, c_int};
|
||||
// TODO constants (some already defined in C)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/acos.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn acos(x: c_double) -> c_double {
|
||||
libm::acos(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/acos.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn acosf(x: c_float) -> c_float {
|
||||
libm::acosf(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/acosh.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn acosh(x: c_double) -> c_double {
|
||||
libm::acosh(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/acosh.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn acoshf(x: c_float) -> c_float {
|
||||
libm::acoshf(x)
|
||||
}
|
||||
@@ -33,25 +33,25 @@ pub unsafe extern "C" fn acoshf(x: c_float) -> c_float {
|
||||
// TODO acoshl, acosl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/asin.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn asin(x: c_double) -> c_double {
|
||||
libm::asin(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/asin.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn asinf(x: c_float) -> c_float {
|
||||
libm::asinf(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/asinh.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn asinh(x: c_double) -> c_double {
|
||||
libm::asinh(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/asinh.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn asinhf(x: c_float) -> c_float {
|
||||
libm::asinhf(x)
|
||||
}
|
||||
@@ -59,19 +59,19 @@ pub unsafe extern "C" fn asinhf(x: c_float) -> c_float {
|
||||
// TODO asinhl, asinl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/atan.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn atan(x: c_double) -> c_double {
|
||||
libm::atan(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/atan2.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn atan2(y: c_double, x: c_double) -> c_double {
|
||||
libm::atan2(y, x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/atan2.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn atan2f(y: c_float, x: c_float) -> c_float {
|
||||
libm::atan2f(y, x)
|
||||
}
|
||||
@@ -79,19 +79,19 @@ pub unsafe extern "C" fn atan2f(y: c_float, x: c_float) -> c_float {
|
||||
// TODO atan2l (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/atan.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn atanf(x: c_float) -> c_float {
|
||||
libm::atanf(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/atanh.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn atanh(x: c_double) -> c_double {
|
||||
libm::atanh(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/atanh.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn atanhf(x: c_float) -> c_float {
|
||||
libm::atanhf(x)
|
||||
}
|
||||
@@ -99,13 +99,13 @@ pub unsafe extern "C" fn atanhf(x: c_float) -> c_float {
|
||||
// TODO atanhl, atanl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/cbrt.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn cbrt(x: c_double) -> c_double {
|
||||
libm::cbrt(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/cbrt.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn cbrtf(x: c_float) -> c_float {
|
||||
libm::cbrtf(x)
|
||||
}
|
||||
@@ -113,13 +113,13 @@ pub unsafe extern "C" fn cbrtf(x: c_float) -> c_float {
|
||||
// TODO cbrtl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ceil.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn ceil(x: c_double) -> c_double {
|
||||
libm::ceil(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ceil.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn ceilf(x: c_float) -> c_float {
|
||||
libm::ceilf(x)
|
||||
}
|
||||
@@ -127,13 +127,13 @@ pub unsafe extern "C" fn ceilf(x: c_float) -> c_float {
|
||||
// TODO ceill (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/copysign.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn copysign(x: c_double, y: c_double) -> c_double {
|
||||
libm::copysign(x, y)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/copysign.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn copysignf(x: c_float, y: c_float) -> c_float {
|
||||
libm::copysignf(x, y)
|
||||
}
|
||||
@@ -141,25 +141,25 @@ pub unsafe extern "C" fn copysignf(x: c_float, y: c_float) -> c_float {
|
||||
// TODO copysignl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/cos.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn cos(x: c_double) -> c_double {
|
||||
libm::cos(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/cos.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn cosf(x: c_float) -> c_float {
|
||||
libm::cosf(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/cosh.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn cosh(x: c_double) -> c_double {
|
||||
libm::cosh(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/cosh.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn coshf(x: c_float) -> c_float {
|
||||
libm::coshf(x)
|
||||
}
|
||||
@@ -167,19 +167,19 @@ pub unsafe extern "C" fn coshf(x: c_float) -> c_float {
|
||||
// TODO coshl, cosl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/erf.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn erf(x: c_double) -> c_double {
|
||||
libm::erf(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/erfc.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn erfc(x: c_double) -> c_double {
|
||||
libm::erfc(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/erfc.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn erfcf(x: c_float) -> c_float {
|
||||
libm::erfcf(x)
|
||||
}
|
||||
@@ -187,7 +187,7 @@ pub unsafe extern "C" fn erfcf(x: c_float) -> c_float {
|
||||
// TODO erfcl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/erf.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn erff(x: c_float) -> c_float {
|
||||
libm::erff(x)
|
||||
}
|
||||
@@ -195,19 +195,19 @@ pub unsafe extern "C" fn erff(x: c_float) -> c_float {
|
||||
// TODO erfl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/exp.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn exp(x: c_double) -> c_double {
|
||||
libm::exp(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/exp2.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn exp2(x: c_double) -> c_double {
|
||||
libm::exp2(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/exp2.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn exp2f(x: c_float) -> c_float {
|
||||
libm::exp2f(x)
|
||||
}
|
||||
@@ -215,7 +215,7 @@ pub unsafe extern "C" fn exp2f(x: c_float) -> c_float {
|
||||
// TODO exp2l (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/exp.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn expf(x: c_float) -> c_float {
|
||||
libm::expf(x)
|
||||
}
|
||||
@@ -223,13 +223,13 @@ pub unsafe extern "C" fn expf(x: c_float) -> c_float {
|
||||
// TODO expl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/expm1.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn expm1(x: c_double) -> c_double {
|
||||
libm::expm1(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/expm1.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn expm1f(x: c_float) -> c_float {
|
||||
libm::expm1f(x)
|
||||
}
|
||||
@@ -237,13 +237,13 @@ pub unsafe extern "C" fn expm1f(x: c_float) -> c_float {
|
||||
// TODO expm1l (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fabs.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fabs(x: c_double) -> c_double {
|
||||
libm::fabs(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fabsf.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fabsf(x: c_float) -> c_float {
|
||||
libm::fabsf(x)
|
||||
}
|
||||
@@ -251,13 +251,13 @@ pub unsafe extern "C" fn fabsf(x: c_float) -> c_float {
|
||||
// TODO fabsl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fdim.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fdim(x: c_double, y: c_double) -> c_double {
|
||||
libm::fdim(x, y)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fdim.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fdimf(x: c_float, y: c_float) -> c_float {
|
||||
libm::fdimf(x, y)
|
||||
}
|
||||
@@ -265,13 +265,13 @@ pub unsafe extern "C" fn fdimf(x: c_float, y: c_float) -> c_float {
|
||||
// TODO fdiml (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/floor.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn floor(x: c_double) -> c_double {
|
||||
libm::floor(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/floor.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn floorf(x: c_float) -> c_float {
|
||||
libm::floorf(x)
|
||||
}
|
||||
@@ -279,13 +279,13 @@ pub unsafe extern "C" fn floorf(x: c_float) -> c_float {
|
||||
// TODO floorl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fma.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fma(x: c_double, y: c_double, z: c_double) -> c_double {
|
||||
libm::fma(x, y, z)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fma.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fmaf(x: c_float, y: c_float, z: c_float) -> c_float {
|
||||
libm::fmaf(x, y, z)
|
||||
}
|
||||
@@ -293,13 +293,13 @@ pub unsafe extern "C" fn fmaf(x: c_float, y: c_float, z: c_float) -> c_float {
|
||||
// TODO fmal (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fmax.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fmax(x: c_double, y: c_double) -> c_double {
|
||||
libm::fmax(x, y)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fmax.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fmaxf(x: c_float, y: c_float) -> c_float {
|
||||
libm::fmaxf(x, y)
|
||||
}
|
||||
@@ -307,13 +307,13 @@ pub unsafe extern "C" fn fmaxf(x: c_float, y: c_float) -> c_float {
|
||||
// TODO fmaxl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fmin.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fmin(x: c_double, y: c_double) -> c_double {
|
||||
libm::fmin(x, y)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fmin.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fminf(x: c_float, y: c_float) -> c_float {
|
||||
libm::fminf(x, y)
|
||||
}
|
||||
@@ -321,13 +321,13 @@ pub unsafe extern "C" fn fminf(x: c_float, y: c_float) -> c_float {
|
||||
// TODO fminl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fmod.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fmod(x: c_double, y: c_double) -> c_double {
|
||||
libm::fmod(x, y)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fmod.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn fmodf(x: c_float, y: c_float) -> c_float {
|
||||
libm::fmodf(x, y)
|
||||
}
|
||||
@@ -335,31 +335,35 @@ pub unsafe extern "C" fn fmodf(x: c_float, y: c_float) -> c_float {
|
||||
// TODO fmodl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/frexp.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn frexp(num: c_double, exp: *mut c_int) -> c_double {
|
||||
let (number, exponent) = libm::frexp(num);
|
||||
unsafe { *exp = exponent; }
|
||||
unsafe {
|
||||
*exp = exponent;
|
||||
}
|
||||
number
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/frexp.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn frexpf(num: c_float, exp: *mut c_int) -> c_float {
|
||||
let (number, exponent) = libm::frexpf(num);
|
||||
unsafe { *exp = exponent; }
|
||||
unsafe {
|
||||
*exp = exponent;
|
||||
}
|
||||
number
|
||||
}
|
||||
|
||||
// TODO frexpl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/hypot.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn hypot(x: c_double, y: c_double) -> c_double {
|
||||
libm::hypot(x, y)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/hypot.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn hypotf(x: c_float, y: c_float) -> c_float {
|
||||
libm::hypotf(x, y)
|
||||
}
|
||||
@@ -367,13 +371,13 @@ pub unsafe extern "C" fn hypotf(x: c_float, y: c_float) -> c_float {
|
||||
// TODO hypotl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ilogb.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn ilogb(x: c_double) -> c_int {
|
||||
libm::ilogb(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ilogb.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn ilogbf(x: c_float) -> c_int {
|
||||
libm::ilogbf(x)
|
||||
}
|
||||
@@ -381,31 +385,31 @@ pub unsafe extern "C" fn ilogbf(x: c_float) -> c_int {
|
||||
// TODO ilogbl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/j0.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn j0(x: c_double) -> c_double {
|
||||
libm::j0(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/j0.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn j1(x: c_double) -> c_double {
|
||||
libm::j1(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/j0.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn jn(n: c_int, x: c_double) -> c_double {
|
||||
libm::jn(n, x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ldexp.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn ldexp(x: c_double, exp: c_int) -> c_double {
|
||||
libm::ldexp(x, exp)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ldexp.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn ldexpf(x: c_float, exp: c_int) -> c_float {
|
||||
libm::ldexpf(x, exp)
|
||||
}
|
||||
@@ -413,13 +417,13 @@ pub unsafe extern "C" fn ldexpf(x: c_float, exp: c_int) -> c_float {
|
||||
// TODO ldexpl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/lgamma.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn lgamma(x: c_double) -> c_double {
|
||||
libm::lgamma(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/lgamma.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn lgammaf(x: c_float) -> c_float {
|
||||
libm::lgammaf(x)
|
||||
}
|
||||
@@ -435,19 +439,19 @@ pub unsafe extern "C" fn lgammaf(x: c_float) -> c_float {
|
||||
// TODO llroundl (long double to c_longlong)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/log.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn log(x: c_double) -> c_double {
|
||||
libm::log(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/log10.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn log10(x: c_double) -> c_double {
|
||||
libm::log10(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/log10.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn log10f(x: c_float) -> c_float {
|
||||
libm::log10f(x)
|
||||
}
|
||||
@@ -455,13 +459,13 @@ pub unsafe extern "C" fn log10f(x: c_float) -> c_float {
|
||||
// TODO log10l (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/log1p.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn log1p(x: c_double) -> c_double {
|
||||
libm::log1p(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/log1p.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn log1pf(x: c_float) -> c_float {
|
||||
libm::log1pf(x)
|
||||
}
|
||||
@@ -469,13 +473,13 @@ pub unsafe extern "C" fn log1pf(x: c_float) -> c_float {
|
||||
// TODO log1pl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/log2.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn log2(x: c_double) -> c_double {
|
||||
libm::log2(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/log2.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn log2f(x: c_float) -> c_float {
|
||||
libm::log2f(x)
|
||||
}
|
||||
@@ -487,7 +491,7 @@ pub unsafe extern "C" fn log2f(x: c_float) -> c_float {
|
||||
// TODO logbl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/log.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn logf(x: c_float) -> c_float {
|
||||
libm::logf(x)
|
||||
}
|
||||
@@ -503,18 +507,22 @@ pub unsafe extern "C" fn logf(x: c_float) -> c_float {
|
||||
// TODO lroundl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/modf.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn modf(x: c_double, iptr: *mut c_double) -> c_double {
|
||||
let (integral, fractional) = libm::modf(x);
|
||||
unsafe { *iptr = integral; }
|
||||
unsafe {
|
||||
*iptr = integral;
|
||||
}
|
||||
fractional
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/modf.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn modff(value: c_float, iptr: *mut c_float) -> c_float {
|
||||
let (integral, fractional) = libm::modff(value);
|
||||
unsafe { *iptr = integral; }
|
||||
unsafe {
|
||||
*iptr = integral;
|
||||
}
|
||||
fractional
|
||||
}
|
||||
|
||||
@@ -530,13 +538,13 @@ pub unsafe extern "C" fn modff(value: c_float, iptr: *mut c_float) -> c_float {
|
||||
// TODO nearbyintl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/nextafter.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn nextafter(x: c_double, y: c_double) -> c_double {
|
||||
libm::nextafter(x, y)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/nextafter.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn nextafterf(x: c_float, y: c_float) -> c_float {
|
||||
libm::nextafterf(x, y)
|
||||
}
|
||||
@@ -548,13 +556,13 @@ pub unsafe extern "C" fn nextafterf(x: c_float, y: c_float) -> c_float {
|
||||
// TODO nexttowardl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/pow.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn pow(x: c_double, y: c_double) -> c_double {
|
||||
libm::pow(x, y)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/pow.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn powf(x: c_float, y: c_float) -> c_float {
|
||||
libm::powf(x, y)
|
||||
}
|
||||
@@ -562,13 +570,13 @@ pub unsafe extern "C" fn powf(x: c_float, y: c_float) -> c_float {
|
||||
// TODO powl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/remainder.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn remainder(x: c_double, y: c_double) -> c_double {
|
||||
libm::remainder(x, y)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/remainder.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn remainderf(x: c_float, y: c_float) -> c_float {
|
||||
libm::remainderf(x, y)
|
||||
}
|
||||
@@ -576,31 +584,35 @@ pub unsafe extern "C" fn remainderf(x: c_float, y: c_float) -> c_float {
|
||||
// TODO remainderl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/remquo.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn remquo(x: c_double, y: c_double, quo: *mut c_int) -> c_double {
|
||||
let (remainder, quotient) = libm::remquo(x, y);
|
||||
unsafe { *quo = quotient; }
|
||||
unsafe {
|
||||
*quo = quotient;
|
||||
}
|
||||
remainder
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/remquo.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn remquof(x: c_float, y: c_float, quo: *mut c_int) -> c_float {
|
||||
let (remainder, quotient) = libm::remquof(x, y);
|
||||
unsafe { *quo = quotient; }
|
||||
unsafe {
|
||||
*quo = quotient;
|
||||
}
|
||||
remainder
|
||||
}
|
||||
|
||||
// TODO remquol (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/rint.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn rint(x: c_double) -> c_double {
|
||||
libm::rint(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/rint.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn rintf(x: c_float) -> c_float {
|
||||
libm::rintf(x)
|
||||
}
|
||||
@@ -608,13 +620,13 @@ pub unsafe extern "C" fn rintf(x: c_float) -> c_float {
|
||||
// TODO rintl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/round.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn round(x: c_double) -> c_double {
|
||||
libm::round(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/round.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn roundf(x: c_float) -> c_float {
|
||||
libm::roundf(x)
|
||||
}
|
||||
@@ -626,13 +638,13 @@ pub unsafe extern "C" fn roundf(x: c_float) -> c_float {
|
||||
// TODO scalblnl (long double, c_long)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/scalbln.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn scalbn(x: c_double, n: c_int) -> c_double {
|
||||
libm::scalbn(x, n)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/scalbln.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn scalbnf(x: c_float, n: c_int) -> c_float {
|
||||
libm::scalbnf(x, n)
|
||||
}
|
||||
@@ -640,25 +652,25 @@ pub unsafe extern "C" fn scalbnf(x: c_float, n: c_int) -> c_float {
|
||||
// TODO scalbnl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sin.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn sin(x: c_double) -> c_double {
|
||||
libm::sin(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sin.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn sinf(x: c_float) -> c_float {
|
||||
libm::sinf(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sinh.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn sinh(x: c_double) -> c_double {
|
||||
libm::sinh(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sinh.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn sinhf(x: c_float) -> c_float {
|
||||
libm::sinhf(x)
|
||||
}
|
||||
@@ -667,13 +679,13 @@ pub unsafe extern "C" fn sinhf(x: c_float) -> c_float {
|
||||
// TODO sinl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sqrt.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn sqrt(x: c_double) -> c_double {
|
||||
libm::sqrt(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sqrt.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn sqrtf(x: c_float) -> c_float {
|
||||
libm::sqrtf(x)
|
||||
}
|
||||
@@ -681,25 +693,25 @@ pub unsafe extern "C" fn sqrtf(x: c_float) -> c_float {
|
||||
// TODO sqrtl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tan.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn tan(x: c_double) -> c_double {
|
||||
libm::tan(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tan.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn tanf(x: c_float) -> c_float {
|
||||
libm::tanf(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tanh.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn tanh(x: c_double) -> c_double {
|
||||
libm::tanh(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tanh.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn tanhf(x: c_float) -> c_float {
|
||||
libm::tanhf(x)
|
||||
}
|
||||
@@ -708,13 +720,13 @@ pub unsafe extern "C" fn tanhf(x: c_float) -> c_float {
|
||||
// TODO tanl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tgamma.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn tgamma(x: c_double) -> c_double {
|
||||
libm::tgamma(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tgamma.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn tgammaf(x: c_float) -> c_float {
|
||||
libm::tgammaf(x)
|
||||
}
|
||||
@@ -722,13 +734,13 @@ pub unsafe extern "C" fn tgammaf(x: c_float) -> c_float {
|
||||
// TODO tgammal (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/trunc.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn trunc(x: c_double) -> c_double {
|
||||
libm::trunc(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/trunc.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn truncf(x: c_float) -> c_float {
|
||||
libm::truncf(x)
|
||||
}
|
||||
@@ -736,19 +748,19 @@ pub unsafe extern "C" fn truncf(x: c_float) -> c_float {
|
||||
// TODO truncl (long double)
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/y0.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn y0(x: c_double) -> c_double {
|
||||
libm::y0(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/y0.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn y1(x: c_double) -> c_double {
|
||||
libm::y1(x)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/y0.html>.
|
||||
//#[unsafe(no_mangle)]
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn yn(n: c_int, x: c_double) -> c_double {
|
||||
libm::yn(n, x)
|
||||
}
|
||||
|
||||
+3
-2
@@ -44,8 +44,9 @@ pub mod libgen;
|
||||
pub mod limits;
|
||||
pub mod locale;
|
||||
pub mod malloc;
|
||||
// pub mod math; // TODO unfinished, uncomment when ready to export
|
||||
// math.h implemented in C // TODO replace openlibm with rust libm as above
|
||||
// TODO unfinished, unguard feature when ready
|
||||
#[cfg(feature = "math_libm")]
|
||||
pub mod math;
|
||||
pub mod monetary;
|
||||
// TODO: mqueue.h
|
||||
// TODO: ndbm.h
|
||||
|
||||
Reference in New Issue
Block a user