From cb6c6b33cc85d6c40d46b1ee78bcbd6a049017d5 Mon Sep 17 00:00:00 2001 From: Dominic Symes Date: Fri, 29 Apr 2022 16:15:56 +0100 Subject: Specify width of integer types Clarify for types previously definded as int the width assumed by the specification. Signed-off-by: Dominic Symes Change-Id: Ied62d4803a4323a600d33cff09752a76ca48f18d --- chapters/activation_funcs.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'chapters/activation_funcs.adoc') diff --git a/chapters/activation_funcs.adoc b/chapters/activation_funcs.adoc index 84a1039..87f213c 100644 --- a/chapters/activation_funcs.adoc +++ b/chapters/activation_funcs.adoc @@ -58,7 +58,7 @@ The sigmoid table has 513 entries each of 16-bit precision and covering the inpu [source,c++] ---- -int sigmoid_reference(int x) {|// input x range is -256 to + 256 inclusive +int16_t sigmoid_reference(int16_t x) { // input x range is -256 to + 256 inclusive F64 v = (double)x / (double)16; v = 1.0/(1.0 + exp(-v)); return round_to_nearest_int(32768.0 * v); @@ -95,7 +95,7 @@ The tanh_table has 513 entries each of 16-bit precision and covering the input r [source,c++] ---- -int tanh_reference(int x) { // input x range is -256 to +256 inclusive +int16_t tanh_reference(int16_t x) { // input x range is -256 to +256 inclusive F64 v = (double)x/(double)32; v = exp(-2.0*v); v = (1.0-v)/(1.0+v); -- cgit v1.2.1