From a60a31ab9017209b8359dc5c97649faecb7b99f6 Mon Sep 17 00:00:00 2001 From: C Jones Date: Sat, 14 Jul 2018 15:25:09 -0400 Subject: [PATCH] Add some extra notes to CONTRIBUTING --- library/compiler-builtins/libm/CONTRIBUTING.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/compiler-builtins/libm/CONTRIBUTING.md b/library/compiler-builtins/libm/CONTRIBUTING.md index 6f8e984f3004..680c40e80e7d 100644 --- a/library/compiler-builtins/libm/CONTRIBUTING.md +++ b/library/compiler-builtins/libm/CONTRIBUTING.md @@ -28,7 +28,7 @@ Check [PR #65] for an example. have any external dependencies (other than `core` itself). - Only use relative imports within the `math` directory / module, e.g. `use self::fabs::fabs` or -`use super::isnanf`. Absolute imports from core are OK, e.g. `use core::u64`. +`use super::k_cos`. Absolute imports from core are OK, e.g. `use core::u64`. - To reinterpret a float as an integer use the `to_bits` method. The MUSL code uses the `GET_FLOAT_WORD` macro, or a union, to do this operation. @@ -36,6 +36,13 @@ Check [PR #65] for an example. - To reinterpret an integer as a float use the `f32::from_bits` constructor. The MUSL code uses the `SET_FLOAT_WORD` macro, or a union, to do this operation. +- You may use other methods from core like `f64::is_nan`, etc. as appropriate. + +- If you're implementing one of the private double-underscore functions, take a look at the + "source" name in the comment at the top for an idea for alternate naming. For example, `__sin` + was renamed to `k_sin` after the FreeBSD source code naming. Do `use` these private functions in + `mod.rs`. + - You may encounter weird literals like `0x1p127f` in the MUSL code. These are hexadecimal floating point literals. Rust (the language) doesn't support these kind of literals. The best way I have found to deal with these literals is to turn them into their integer representation using the