Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit af263a6

Browse files
committed
Initial coarse pass
1 parent 8f2a9ae commit af263a6

File tree

7 files changed

+261
-106
lines changed

7 files changed

+261
-106
lines changed

crates/libm-test/src/domain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<F: Float, I: Int> EitherPrim<Domain<F>, Domain<I>> {
171171
Box::new((0..u8::MAX).map(|scale| {
172172
let mut base = F::ZERO;
173173
for _ in 0..scale {
174-
base = base - F::ONE;
174+
base -= F::ONE;
175175
}
176176
base
177177
}))

crates/libm-test/src/f8_impl.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ impl Float for f8 {
3939
const NEG_PI: Self = Self::ZERO;
4040
const FRAC_PI_2: Self = Self::ZERO;
4141

42+
/// `2^sig_bits`
43+
const TWO_POW_SIG_BITS: Self =
44+
Self(((Self::SIG_BITS + Self::EXP_BIAS) as Self::Int) << Self::SIG_BITS);
45+
/// `2^-sig_bits`
46+
const TWO_POW_NEG_SIG_BITS: Self =
47+
Self(((-(Self::SIG_BITS as i32) + Self::EXP_BIAS as i32) as Self::Int) << Self::SIG_BITS);
48+
4249
const BITS: u32 = 8;
4350
const SIG_BITS: u32 = 3;
4451
const SIGN_MASK: Self::Int = 0b1_0000_000;

etc/consts-cbrt.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
using Printf
3+
using Remez
4+
5+
function main()
6+
run_one("f64", "hf64!", 53)
7+
end
8+
9+
function run_one(name::String, hf::String, precision::Integer)
10+
setprecision(precision)
11+
12+
println("Constants for ", name)
13+
14+
println("const ESCALE: [Self; 3] = [")
15+
for n in 0:2
16+
val = big(2) ^ (n / 3)
17+
@printf " %s(\"%a\"),\n" hf val
18+
end
19+
print("];")
20+
21+
end
22+
23+
main()

etc/update-api-list.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
# These files do not trigger a retest.
2727
IGNORED_SOURCES = ["src/libm_helper.rs"]
28+
# Same as above, limited to specific functions
29+
IGNORED_SOURCES_MAP = {"fma": ["src/math/cbrt.rs"]}
2830

2931
IndexTy: TypeAlias = dict[str, dict[str, Any]]
3032
"""Type of the `index` item in rustdoc's JSON output"""
@@ -138,6 +140,8 @@ def _init_defs(self, index: IndexTy) -> None:
138140

139141
for src in IGNORED_SOURCES:
140142
sources.discard(src)
143+
for src in IGNORED_SOURCES_MAP.get(name, []):
144+
sources.discard(src)
141145

142146
# Sort the set
143147
self.defs = {k: sorted(v) for (k, v) in defs.items()}

0 commit comments

Comments
 (0)