aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/float_SUITE.erl
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-01-24 08:52:21 +0100
committerGitHub <[email protected]>2019-01-24 08:52:21 +0100
commita0104bc16c8c6f57c2725d07b811bf3bcb0a2455 (patch)
tree02ea5e7585b66c04c3d775b42f8ccfa9a68a6d8b /lib/compiler/test/float_SUITE.erl
parent5a9adb7b9b600fc2a406e677a673047045a494d8 (diff)
parent294d66a295f6c2101fe3c2da630979ad4e736c08 (diff)
downloadotp-a0104bc16c8c6f57c2725d07b811bf3bcb0a2455.tar.gz
otp-a0104bc16c8c6f57c2725d07b811bf3bcb0a2455.tar.bz2
otp-a0104bc16c8c6f57c2725d07b811bf3bcb0a2455.zip
Merge pull request #2100 from jhogberg/john/compiler/module-type-optimization
Apply type optimizations across local function calls
Diffstat (limited to 'lib/compiler/test/float_SUITE.erl')
-rw-r--r--lib/compiler/test/float_SUITE.erl15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/compiler/test/float_SUITE.erl b/lib/compiler/test/float_SUITE.erl
index 012810aba2..831e8279aa 100644
--- a/lib/compiler/test/float_SUITE.erl
+++ b/lib/compiler/test/float_SUITE.erl
@@ -20,7 +20,8 @@
-module(float_SUITE).
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
init_per_group/2,end_per_group/2,
- pending/1,bif_calls/1,math_functions/1,mixed_float_and_int/1]).
+ pending/1,bif_calls/1,math_functions/1,mixed_float_and_int/1,
+ subtract_number_type/1]).
-include_lib("common_test/include/ct.hrl").
@@ -28,7 +29,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
[pending, bif_calls, math_functions,
- mixed_float_and_int].
+ mixed_float_and_int, subtract_number_type].
groups() ->
[].
@@ -176,5 +177,15 @@ mixed_float_and_int(Config) when is_list(Config) ->
pc(Cov, NotCov, X) ->
round(Cov/(Cov+NotCov)*100) + 42 + 2.0*X.
+subtract_number_type(Config) when is_list(Config) ->
+ 120 = fact(5).
+
+fact(N) ->
+ fact(N, 1).
+
+fact(0, P) -> P;
+fact(1, P) -> P;
+fact(N, P) -> fact(N-1, P*N).
+
id(I) -> I.