Skip to content

Reimplement strtod and parseFloat / strtod + Fix String.fromCodePoint + improve strtol #768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 74 commits into from
Sep 15, 2019
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
4b3c01a
init
MaxGraey Jun 21, 2019
0cd4c72
wip
MaxGraey Jun 26, 2019
80992cf
wip
MaxGraey Jun 26, 2019
315c9a7
wip
MaxGraey Jun 26, 2019
e2acae8
Merge branch 'master' into improve-strtod
MaxGraey Jun 27, 2019
6830551
fix String.fromCodePoint
MaxGraey Jun 27, 2019
a88033d
add some tests
MaxGraey Jun 28, 2019
4c66030
add assert wich discard neg units for String.fromCahrCode
MaxGraey Jul 2, 2019
f24e88c
Merge branch 'master' into improve-strtod
MaxGraey Jul 31, 2019
df8ee28
update build
MaxGraey Jul 31, 2019
3a5ace2
update (wip)
MaxGraey Aug 10, 2019
9324691
update (wip)
MaxGraey Aug 10, 2019
374dc5b
update (wip)
MaxGraey Aug 10, 2019
5f992e1
update (wip)
MaxGraey Aug 10, 2019
0ebe332
update (wip)
MaxGraey Aug 10, 2019
af4170d
update (wip)
MaxGraey Aug 11, 2019
f270c55
fix
MaxGraey Aug 11, 2019
53787a9
fix
MaxGraey Aug 11, 2019
8fc79e3
fixes
MaxGraey Aug 13, 2019
e2858d2
update (wip)
MaxGraey Aug 16, 2019
bf15b9b
update tests (wip)
MaxGraey Aug 16, 2019
920d703
update (wip)
MaxGraey Aug 17, 2019
0d4944c
update (wip)
MaxGraey Aug 17, 2019
ba13bf5
fixes
MaxGraey Aug 17, 2019
24dba43
more tests (wip)
MaxGraey Aug 17, 2019
08fe09d
fix sign
MaxGraey Aug 17, 2019
4fd2f4f
cleanup
MaxGraey Aug 17, 2019
0d09667
improve stdtol
MaxGraey Aug 17, 2019
7ba7ea6
more tests
MaxGraey Aug 17, 2019
a3423ce
more tests (wip)
MaxGraey Aug 17, 2019
14a349c
add more tests
MaxGraey Aug 17, 2019
0036547
fix one edge case. Add rint
MaxGraey Aug 17, 2019
d21aa12
rint -> nearest
MaxGraey Aug 17, 2019
6771a0f
update (wip)
MaxGraey Aug 17, 2019
9a9addd
finish implementation
MaxGraey Aug 17, 2019
00a4f78
clenaup (wip)
MaxGraey Aug 18, 2019
6f0133e
add comments and hints
MaxGraey Aug 18, 2019
c2d5577
simplify fixmul
MaxGraey Aug 18, 2019
f933857
more tests
MaxGraey Aug 18, 2019
a21dfa0
more tests
MaxGraey Aug 19, 2019
838aaed
fix
MaxGraey Aug 19, 2019
1b8d239
minor optimize for fast path
MaxGraey Aug 19, 2019
4d46e54
more tests
MaxGraey Aug 19, 2019
04b6ef0
simplify test
MaxGraey Aug 19, 2019
94818ab
more tests
MaxGraey Aug 19, 2019
3d3b04f
Fix rest parsing issues
MaxGraey Aug 19, 2019
bddd863
more tests
MaxGraey Aug 19, 2019
3c6d546
minor improvment
MaxGraey Aug 19, 2019
dc9027b
more tests
MaxGraey Aug 19, 2019
b63d877
improve fast path
MaxGraey Aug 19, 2019
407f0ad
improve isSpace
MaxGraey Aug 20, 2019
901a867
finalise isSpace
MaxGraey Aug 20, 2019
1b63560
Merge branch 'master' into improve-strtod
MaxGraey Aug 20, 2019
47772d6
improve isSpace more
MaxGraey Aug 20, 2019
3567be3
Merge branch 'master' into improve-strtod
MaxGraey Aug 25, 2019
d53e988
rebuild tests
MaxGraey Aug 25, 2019
25631c9
fixes according review
MaxGraey Sep 4, 2019
64808ce
Merge branch 'master' into improve-strtod
MaxGraey Sep 4, 2019
4c3d937
rebuild tests
MaxGraey Sep 4, 2019
277fdaf
Fixes which to address the comments
MaxGraey Sep 5, 2019
aae9aee
add some test262 tests. Fix pow10
MaxGraey Sep 5, 2019
396e806
more test262 tests. Minor fix
MaxGraey Sep 5, 2019
396268b
last test from test262 set
MaxGraey Sep 5, 2019
9b5c3e9
minor refactoring
MaxGraey Sep 5, 2019
b3a14aa
simplify pow10
MaxGraey Sep 5, 2019
6c44c8b
update comment
MaxGraey Sep 5, 2019
d83309a
add comments about failure cases
MaxGraey Sep 6, 2019
b516f21
Merge branch 'master' into improve-strtod
MaxGraey Sep 10, 2019
fc2c425
rebuild tests
MaxGraey Sep 10, 2019
a9a6e7c
Merge branch 'master' into improve-strtod
MaxGraey Sep 15, 2019
36733b9
rebuild
MaxGraey Sep 15, 2019
23c28cd
refactor
MaxGraey Sep 15, 2019
6bbcf3c
Merge branch 'master' into improve-strtod
MaxGraey Sep 15, 2019
06dda3b
rebuild
MaxGraey Sep 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions std/assembly/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,8 @@ interface INativeMath<T> extends IMath<T> {
sincos_cos: T;
/** Seeds the random number generator. */
seedRandom(value: i64): void;
/** Multiplies a floating point `x` by 2 raised to power exp `n`. */
scalbn(x: T, n: i32): T;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this useful to a user as a public API?

Copy link
Member Author

@MaxGraey MaxGraey Sep 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess yes. It's has different name in C/C++ as ldexp

/** Returns the floating-point remainder of `x / y` (rounded towards zero). */
mod(x: T, y: T): T;
/** Returns the floating-point remainder of `x / y` (rounded to nearest). */
Expand Down
4 changes: 2 additions & 2 deletions std/assembly/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import { idof } from "./builtins";
store<u16>(out, <u16>code);
} else {
code -= 0x10000;
let hi: u32 = (code >>> 10) + 0xD800;
let lo: u32 = (code & 0x3FF) + 0xDC00;
store<u32>(out, (hi << 16) | lo);
let hi: u32 = (code >>> 10) + 0xD800;
store<u32>(out, hi | (lo << 16));
}
return changetype<string>(out); // retains
}
Expand Down
Loading