Merge branch 'master' of git://factorcode.org/git/factor
commit
8fe9bf5429
|
@ -192,14 +192,16 @@ IN: compiler.cfg.builder.tests
|
|||
[ [ ##unbox-alien? ] contains-insn? ] bi
|
||||
] unit-test
|
||||
|
||||
[ f t ] [
|
||||
[ { byte-array fixnum } declare alien-cell 4 alien-float ]
|
||||
[ [ ##box-alien? ] contains-insn? ]
|
||||
[ [ ##box-float? ] contains-insn? ] bi
|
||||
] unit-test
|
||||
\ alien-float "intrinsic" word-prop [
|
||||
[ f t ] [
|
||||
[ { byte-array fixnum } declare alien-cell 4 alien-float ]
|
||||
[ [ ##box-alien? ] contains-insn? ]
|
||||
[ [ ##box-float? ] contains-insn? ] bi
|
||||
] unit-test
|
||||
|
||||
[ f t ] [
|
||||
[ { byte-array fixnum } declare alien-cell { simple-alien } declare 4 alien-float ]
|
||||
[ [ ##box-alien? ] contains-insn? ]
|
||||
[ [ ##box-float? ] contains-insn? ] bi
|
||||
] unit-test
|
||||
[ f t ] [
|
||||
[ { byte-array fixnum } declare alien-cell { simple-alien } declare 4 alien-float ]
|
||||
[ [ ##box-alien? ] contains-insn? ]
|
||||
[ [ ##box-float? ] contains-insn? ] bi
|
||||
] unit-test
|
||||
] when
|
|
@ -1,6 +1,7 @@
|
|||
USING: kernel math math.floats.env math.floats.env.private
|
||||
math.functions math.libm sequences tools.test locals
|
||||
compiler.units kernel.private fry compiler math.private words ;
|
||||
compiler.units kernel.private fry compiler math.private words
|
||||
system ;
|
||||
IN: math.floats.env.tests
|
||||
|
||||
: set-default-fp-env ( -- )
|
||||
|
@ -29,7 +30,13 @@ set-default-fp-env
|
|||
[ t ] +fp-overflow+ [ 1.0e250 1.0e100 ] [ * ] test-fp-exception-compiled unit-test
|
||||
[ t ] +fp-underflow+ [ 1.0e-250 1.0e-100 ] [ * ] test-fp-exception-compiled unit-test
|
||||
[ t ] +fp-overflow+ [ 2.0 100,000.0 ] [ fpow ] test-fp-exception-compiled unit-test
|
||||
[ t ] +fp-underflow+ [ 2.0 -100,000.0 ] [ fpow ] test-fp-exception-compiled unit-test
|
||||
|
||||
! No underflow on Linux with this test, just inexact. Reported as an Ubuntu bug:
|
||||
! https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/429113
|
||||
os linux? cpu x86.64? and [
|
||||
[ t ] +fp-underflow+ [ 2.0 -100,000.0 ] [ fpow ] test-fp-exception-compiled unit-test
|
||||
] unless
|
||||
|
||||
[ t ] +fp-invalid-operation+ [ 0.0 0.0 ] [ /f ] test-fp-exception-compiled unit-test
|
||||
[ t ] +fp-invalid-operation+ [ -1.0 ] [ fsqrt ] test-fp-exception-compiled unit-test
|
||||
|
||||
|
@ -106,19 +113,19 @@ set-default-fp-env
|
|||
append '[ _ _ with-fp-traps ] ;
|
||||
|
||||
: test-traps-compiled ( traps inputs quot -- quot' )
|
||||
swapd '[ _ [ _ _ with-fp-traps ] compile-call ] ;
|
||||
swapd '[ @ [ _ _ with-fp-traps ] compile-call ] ;
|
||||
|
||||
{ +fp-zero-divide+ } [ 1.0 0.0 ] [ /f ] test-traps must-fail
|
||||
{ +fp-inexact+ } [ 1.0 3.0 ] [ /f ] test-traps must-fail
|
||||
{ +fp-zero-divide+ } [ 1.0 0.0 ] [ /f ] test-traps must-fail
|
||||
{ +fp-inexact+ } [ 1.0 3.0 ] [ /f ] test-traps must-fail
|
||||
{ +fp-invalid-operation+ } [ -1.0 ] [ fsqrt ] test-traps must-fail
|
||||
{ +fp-overflow+ } [ 2.0 ] [ 100,000.0 ^ ] test-traps must-fail
|
||||
{ +fp-underflow+ } [ 2.0 ] [ -100,000.0 ^ ] test-traps must-fail
|
||||
{ +fp-overflow+ } [ 2.0 ] [ 100,000.0 ^ ] test-traps must-fail
|
||||
{ +fp-underflow+ +fp-inexact+ } [ 2.0 ] [ -100,000.0 ^ ] test-traps must-fail
|
||||
|
||||
{ +fp-zero-divide+ } [ 1.0 0.0 ] [ /f ] test-traps-compiled must-fail
|
||||
{ +fp-inexact+ } [ 1.0 3.0 ] [ /f ] test-traps-compiled must-fail
|
||||
{ +fp-zero-divide+ } [ 1.0 0.0 ] [ /f ] test-traps-compiled must-fail
|
||||
{ +fp-inexact+ } [ 1.0 3.0 ] [ /f ] test-traps-compiled must-fail
|
||||
{ +fp-invalid-operation+ } [ -1.0 ] [ fsqrt ] test-traps-compiled must-fail
|
||||
{ +fp-overflow+ } [ 2.0 ] [ 100,000.0 ^ ] test-traps-compiled must-fail
|
||||
{ +fp-underflow+ } [ 2.0 ] [ -100,000.0 ^ ] test-traps-compiled must-fail
|
||||
{ +fp-overflow+ } [ 2.0 ] [ 100,000.0 ^ ] test-traps-compiled must-fail
|
||||
{ +fp-underflow+ +fp-inexact+ } [ 2.0 ] [ -100,000.0 ^ ] test-traps-compiled must-fail
|
||||
|
||||
! Ensure ordered comparisons raise traps
|
||||
:: test-comparison-quot ( word -- quot )
|
||||
|
|
|
@ -33,9 +33,9 @@ IN: math.functions.tests
|
|||
[ 0.0 ] [ 1.0 log ] unit-test
|
||||
[ 1.0 ] [ e log ] unit-test
|
||||
|
||||
[ t ] [ 1 exp e = ] unit-test
|
||||
[ t ] [ 1.0 exp e = ] unit-test
|
||||
[ 1.0 ] [ -1 exp e * ] unit-test
|
||||
[ t ] [ 1 exp e 1.e-10 ~ ] unit-test
|
||||
[ t ] [ 1.0 exp e 1.e-10 ~ ] unit-test
|
||||
[ t ] [ -1 exp e * 1.0 1.e-10 ~ ] unit-test
|
||||
|
||||
[ 1.0 ] [ 0 cosh ] unit-test
|
||||
[ 1.0 ] [ 0.0 cosh ] unit-test
|
||||
|
|
|
@ -25,6 +25,6 @@ IN: benchmark.simd-1
|
|||
>fixnum make-points [ normalize-points ] [ max-points ] bi print-point ;
|
||||
|
||||
: main ( -- )
|
||||
5000000 simd-benchmark ;
|
||||
10 [ 500000 simd-benchmark ] times ;
|
||||
|
||||
MAIN: main
|
||||
|
|
|
@ -47,6 +47,6 @@ SPECIALIZED-ARRAY: point
|
|||
: struct-array-benchmark ( len -- )
|
||||
make-points [ normalize-points ] [ max-points ] bi print-point ;
|
||||
|
||||
: main ( -- ) 5000000 struct-array-benchmark ;
|
||||
: main ( -- ) 10 [ 500000 struct-array-benchmark ] times ;
|
||||
|
||||
MAIN: main
|
||||
|
|
Loading…
Reference in New Issue