Wink Saville
634d11ab28
Add add compiler_rt routines for float to signed integer conversion
...
And add std.math.f128_* constants.
The routines are:
__fixdfdi, __fixdfsi, __fixdfti,
__fixsfdi, __fixsfsi, __fixsfti,
__fixtfdi, __fixtfsi, __fixtfti.
These all call fixint which is a generic zig function that does the
conversion:
pub fn fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t) fixint_t
There are also a set tests:
__fixdfdi_test, __fixdfsi_test, __fixdfti_test,
__fixsfdi_test, __fixsfsi_test, __fixsfti_test,
__fixtfdi_test, __fixtfsi_test, __fixtfti_test.
2018-12-12 00:21:42 -05:00
Andrew Kelley
7005ec5efe
Revert "Add math min/max for Float and Value"
...
This reverts commit 078a0a6999
.
On closer inspection, I'm not sure these values for float min/max
make sense. Why is it max instead of true_max? Why isn't it positive
and negative infinity?
Let's discuss further before committing to these changes.
2018-11-29 09:33:47 -05:00
Wink Saville
078a0a6999
Add math min/max for Float and Value
2018-11-28 23:13:12 -05:00
daurnimator
2baf0e2ffc
add std.math.IntFittingRange
2018-11-27 10:19:06 -05:00
Vallentin
398914eb71
Fixed typos
2018-11-16 14:03:39 -05:00
Jimmi Holst Christensen
8139c5a516
New Zig formal grammar ( #1685 )
...
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-11-13 05:08:37 -08:00
emekoi
c7799ff2b2
fixed comments
2018-10-27 12:58:40 -05:00
Andrew Kelley
2b395d4ede
remove @minValue,@maxValue; add std.math.minInt,maxInt
...
closes #1466
closes #1476
2018-10-26 15:01:51 -04:00
Andrew Kelley
d5648d2640
remove implicit cast from T to *const T
...
closes #1465
2018-10-15 18:23:47 -04:00
Jimmi Holst Christensen
378d3e4403
Solve the return type ambiguity ( #1628 )
...
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
2018-10-15 09:51:15 -04:00
emekoi
a22d9daaec
added math.pow support for integer types. resolves #1637 ( #1642 )
...
added math.powi for integers; pow now handles ints
2018-10-10 10:50:23 -04:00
Andrew Kelley
d40c4e7c89
Merge pull request #1429 from shawnl/arm64
...
initial arm64 support
2018-10-06 00:11:39 -04:00
Andrew Kelley
275b4100c0
remove unnecessary setFloatMode calls
...
Now that Strict is the default, these calls only add noise.
2018-09-18 15:15:03 -04:00
Andrew Kelley
a2abdb185f
Merge remote-tracking branch 'origin/master' into llvm7
2018-09-16 10:51:58 -04:00
Andrew Kelley
c06a61e9bf
remove this
. add @This()
.
...
closes #1283
2018-09-13 16:34:33 -04:00
Marc Tiehuis
e70c543bc4
math/complex: cexp test correction and ldexp usage fix
2018-09-13 20:33:05 +12:00
Shawn Landden
f8808edff4
simplify f64_min to equivilent value
...
arm64 complains about the old value (I added a test)
2018-09-08 03:52:28 +00:00
Andrew Kelley
7109035b78
Merge remote-tracking branch 'origin/master' into llvm7
2018-08-25 21:57:28 -04:00
Marc Tiehuis
353419f82d
Default to strict IEEE floating point
...
Closes #1227 .
2018-08-23 22:54:46 +12:00
Andrew Kelley
dd9728c5a0
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-24 00:43:12 -04:00
Andrew Kelley
5a919dd82d
Merge remote-tracking branch 'origin/master' into self-hosted-libc-hello-world
2018-07-23 14:32:13 -04:00
Andrew Kelley
99153ac0aa
add std.math.big.Int.fitsInTwosComp
...
so that we can pass runtime-known values
2018-07-22 10:58:45 -04:00
Marc Tiehuis
d53fae3551
Add big int fits function ( #1279 )
...
Returns whether the current value in an Int fits in the requested type.
2018-07-22 10:11:27 -04:00
Marc Tiehuis
07b6a3d335
Tighten Int.to bounds and add twos-complement bitcount
2018-07-22 17:47:57 +12:00
Andrew Kelley
f5a67dba08
self-hosted: implicit cast comptime ints to other ints
...
we now have successful exit codes from main linking
against libc
2018-07-20 01:46:49 -04:00
Andrew Kelley
1d85b588ea
self-hosted: progress on IR for supporting libc hello world
...
* add c int types
* some more ir stubs
2018-07-19 00:08:47 -04:00
Andrew Kelley
558b0b8791
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-16 13:37:16 -04:00
Andrew Kelley
e9a03cccf3
all integer sizes are available as primitives
...
* fix wrong implicit cast for `@IntType` bit_count parameter.
* fix incorrect docs for `@IntType` bit_count parameter.
closes #1242
closes #745
closes #1240
2018-07-16 10:53:15 -04:00
Andrew Kelley
6e1425e312
Merge remote-tracking branch 'origin/master' into llvm7
2018-07-02 20:00:13 -04:00
Ben Noordhuis
30cfc0ab2c
test std.math f16 sqrt support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
be36179064
add std.math f16 signbit support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
ca444e6191
add std.math f16 copysign support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
d293f1a0ed
add std.math f16 floor support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
1abc925292
add std.math f16 fabs support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
f36b095b5f
add std.math f16 isnormal support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
30b75ae353
add std.math f16 isfinite support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
a36d7b6131
add std.math f16 inf support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
27b02413dc
add std.math f16 nan support
...
refs #1122
2018-06-30 01:58:17 +02:00
Ben Noordhuis
61df5bc142
add std.math f16 constants
...
refs #1122
2018-06-30 01:58:17 +02:00
Marc Tiehuis
f50c0c664f
Add float repr bit extraction functions
2018-06-21 01:45:12 -04:00
Andrew Kelley
c7804277bf
@floatToInt
now has safety-checked undefined behavior
...
when the integer part does not fit in the destination integer type
* Also fix incorrect safety triggered for integer casting an
`i32` to a `u7`. closes #1138
* adds compiler-rt function: `__floatuntidf`
2018-06-19 16:06:10 -04:00
Andrew Kelley
c757984879
Merge remote-tracking branch 'origin/master' into llvm7
2018-06-18 14:51:23 -04:00
Andrew Kelley
4210f1f6a0
remove bool to int syntax. add @boolToInt
...
add missing docs
See #1061
2018-06-18 03:07:16 -04:00
Andrew Kelley
7912061226
remove integer and float casting syntax
...
* add `@intCast`
* add `@floatCast`
* add `@floatToInt`
* add `@intToFloat`
See #1061
2018-06-17 02:57:07 -04:00
Andrew Kelley
06a26f0965
std.Complex: use better arg passing convention and fix a TODO
2018-06-16 21:32:53 -04:00
Andrew Kelley
e311cd562b
don't automatically take pointer when passing by non-copying value
...
this commit does not have all tests passing
2018-06-16 19:37:00 -04:00
Andrew Kelley
65d04cbeb4
std.DynLib: open the fd with CLOEXEC
2018-06-16 17:27:45 -04:00
Andrew Kelley
48de57d824
add basic std lib code for loading dynamic libraries
...
this is going to only work for very basic libraries;
I plan to slowly add more features over time to support more
complicated libraries
2018-06-16 17:01:23 -04:00
Andrew Kelley
32dd98b19f
Merge remote-tracking branch 'origin/master' into llvm7
2018-06-14 18:27:59 -04:00
Marc Tiehuis
dc8bda7e02
Add arbitrary-precision integer to std
...
A few notes on the implementation:
- Any unsigned power of two integer type less than 64 bits in size is supported
as a Limb type.
- The algorithms used are kept simple for the moment. More complicated
algorithms are generally only more useful as integer sizes increase a
lot and I don't expect our current usage to be used for this purpose
just yet.
- All branches (practically) have been covered by tests.
See 986a2b3243/bench
for rough performance comparison numbers.
Closes #364 .
2018-06-10 18:24:34 +12:00