Commit graph

165 commits

Author SHA1 Message Date
Jared Ramirez
7daa008a9a
Add Num.fromBool 2024-12-24 10:10:20 -05:00
Brendan Hansknecht
2475feeb2f
more wasm fixes 2024-12-11 21:47:18 -08:00
Brendan Hansknecht
0a573ca557
Merge remote-tracking branch 'origin/main' into upgrade-llvm-zig 2024-12-11 16:38:34 -08:00
Ayaz
793a95264d
Merge branch 'main' into wrapped 2024-12-08 13:54:43 -05:00
shua
def796f146
PR: refac tests, add all int cases for *wrap tests 2024-12-07 16:27:25 +01:00
Asher Frost
c2d06e3658
Made test pass 2024-12-01 16:03:40 -05:00
Asher Frost
7055253564
Merge branch 'main' into int_overflow 2024-12-01 15:32:39 -05:00
Luke Boswell
d7556be7bf
Merge pull request #7264 from shua/saturated
gen-dev: complete Num{Mul,Add,Sub}Saturated impls
2024-12-01 14:01:48 +11:00
shua
8fd2fbc3a1
gen-dev: complete Num{Mul,Add,Sub}Saturated impls
MulSaturated and AddSaturated are now implemented for u128, i128
SubSaturated is now implemented for Dec even if it's a little strange to
saturate at a decimal value:

```
» Num.subSaturated -170_141_183_460_469_231_731dec 1

-170141183460469231731.687303715884105728 : Dec
```

I decided to rm the `build_num_{mul,add}_saturated` methods because
they don't require any asm-specifics. They either call out to bitcode, or
use the non-saturated version for floats.
2024-11-30 23:01:44 +01:00
shua
6dfa458e6c
Num.powInt: panic on overflow 2024-11-30 11:26:42 +01:00
Luke Boswell
656a7bcd87
Merge remote-tracking branch 'remote/main' into upgrade-llvm-zig 2024-11-30 10:18:11 +11:00
wizard7377
7866331f67
Merge branch 'main' into int_overflow 2024-11-28 21:26:38 -05:00
Luke Boswell
1ecb003887
Merge pull request #7250 from shua/fracdec
implement Num.isNaN,isFinite,isInfinite for Dec
2024-11-29 10:16:17 +11:00
Luke Boswell
2feb5d3c2e
Merge remote-tracking branch 'remote/main' into upgrade-llvm-zig 2024-11-29 08:58:47 +11:00
Asher Frost
0eb11932d9
Re-added tests 2024-11-28 10:11:05 -05:00
JRI98
61ca278e31
Fix division of zero by zero for Dec 2024-11-27 23:38:21 +00:00
shua
10f04f1d94
implement Num.isNaN,isFinite,isInfinite for Dec 2024-11-27 00:36:54 +01:00
shua
a98acff0b9
gen-dev: impl Num.neg for Dec,F32,F64
Dec negation was implemented across gen-dev, gen-llvm, gen-wasm as a call
to the compiled zig function `bitcode::DEC_NEGATE`.

f32 and f64 negation were implemented already for gen-llvm, gen-wasm.

for gen-dev x86_64, float negation is implemented by flipping the sign
bit, which means `xorps` for f32, and `xorpd` for f64

for gen-dev aarch64, there is conveniently a `fneg` instruction
2024-11-23 19:17:55 +01:00
Luke Boswell
dc3aa06d61
Merge remote-tracking branch 'remote/main' into upgrade-llvm-zig 2024-11-13 09:02:20 +11:00
Norbert Hajagos
72863daa7e
gen_dev-x86_64 extend Num.neg to all Signed and Unsigned int sizes 2024-10-07 23:43:58 +02:00
Luke Boswell
a589d7d789
fix num_to_str_f32 test 2024-07-31 05:29:50 +10:00
shua
e2eb9c9aaa
rm dead FIXME comment
this comment was added originally in 24e6cd80e7, but was a comment on a `if cfg(..) {...}` block. Later that `if` was removed but the comment was not, and eventually got copied to another location making it even harder to figure out why it's there.
2024-06-22 19:07:26 +02:00
Andy Ferris
e636853bc8 Run cargo fmt 2024-05-04 12:39:34 +10:00
Andy Ferris
c74cc19220 Fix unit test with lambda 2024-05-04 11:42:04 +10:00
Andy Ferris
03e9344a83 Add new constants to symbol table, attempt to add tests 2024-05-03 19:50:12 +10:00
Anton-4
c1d0c24194
fix expected type
Rust's u128 and Roc's U128 have different alignment. They can not be used interchangebly, that leads to segmentation faults. See also 434410692
2024-04-20 19:57:47 +02:00
Fabian Schmalzried
6786fd45c0
add tests 2024-04-01 21:08:12 +02:00
Fabian Schmalzried
f145f73aa0
add tests for decimal point 2024-04-01 21:08:11 +02:00
Richard Feldman
24a38c4a26
Merge remote-tracking branch 'origin/main' into remove-nat 2024-02-11 12:26:36 -05:00
Richard Feldman
50ea255703
Fix some tests that were expecting usize over u64 2024-02-11 12:21:50 -05:00
Brendan Hansknecht
fc6b519b59
Merge pull request #6463 from roc-lang/dec-pow
`Num.pow` for `Dec`
2024-02-01 09:17:55 -08:00
Richard Feldman
aabd95404f
Merge remote-tracking branch 'origin/main' into remove-nat 2024-01-30 21:42:45 -05:00
Brendan Hansknecht
e7be9d435d
Merge pull request #6460 from roc-lang/dec-div-floor
`floor`, `ceiling` and `round` for `Dec`
2024-01-30 16:38:12 -08:00
Folkert
e16b25c93e
Num.pow for Dec 2024-01-30 16:33:50 +01:00
Kiryl Dziamura
b3dfdb562b
crash on rem div by zero 2024-01-30 11:12:02 +01:00
Richard Feldman
7c19b42a99
Merge pull request #6457 from roc-lang/division-by-zero
Division by zero
2024-01-29 08:37:31 -05:00
Folkert
db3b40a07b
Dec floor/ceiling/round 2024-01-29 13:39:38 +01:00
Richard Feldman
3e27e18566
Merge remote-tracking branch 'origin/main' into remove-nat 2024-01-29 07:23:58 -05:00
Folkert de Vries
eadc0d37cd
Merge pull request #6448 from roc-lang/dev-backend-glue-new
glue with the dev backend works again
2024-01-29 11:51:12 +01:00
Folkert
979128cf32
make division by zero (integer) not trap 2024-01-29 01:38:32 +01:00
Folkert de Vries
4a593a5b77
Merge pull request #6442 from roc-lang/dev-backend-glue-primitives
Dev backend glue primitives
2024-01-29 00:08:51 +01:00
Folkert
2794348722
fix bug in casting to u128/i128 2024-01-27 21:58:56 +01:00
Folkert
076fafe02f
enable some float conversion tests for gen-dev 2024-01-27 15:04:30 +01:00
Richard Feldman
fb84c9487d
Remove Num.Natural, Num.toNat, and Num.toNatChecked 2024-01-26 16:23:20 -05:00
Richard Feldman
9518d76cd8
Remove Num.bytesTo___ functions
These may be reintroduced in some form later,
but they don't handle endianness and it's not
clear builtins are the right place for them.
2024-01-26 16:23:19 -05:00
Richard Feldman
bf660ad094
Remove Nat from tests 2024-01-26 16:19:52 -05:00
Richard Feldman
8f82bc38c0
Remove Nat from tests 2024-01-26 16:19:52 -05:00
Brian Teague
4499f8c6f4
isApproxEq function 2024-01-23 21:06:35 -05:00
Folkert
351c9215fe
dev backend: f32 abs 2024-01-19 15:16:32 +01:00
Folkert
7a365eb88f
enable even more dev-backend num tests 2024-01-02 22:23:47 +01:00