[12/12] benchtests: Add tanhf function to bench-math

Message ID 20211029171941.4161172-13-skpgkp2@gmail.com
State Dropped
Headers
Series benchtests: Add float version of math functions to bench-math |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Sunil Pandey Oct. 29, 2021, 5:19 p.m. UTC
  Add tanhf function to bench-math and copy tanhf-inputs to benchtests.
Motivation for this patch is to prepare for upcoming libmvec new
functions.  Float and double version of libmvec functions stays
together.

tanhf-inputs file generated from tanh-inputs file using following
scaling formula:

f = d * (FLT_MAX/DBL_MAX)

Where d is input(double) and f is output(float).  If scaled float value
is duplicate in new input file, nextafterf() function used to find next
float value, ensuring no duplicates.
---
 benchtests/Makefile     |   1 +
 benchtests/tanhf-inputs | 203 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 204 insertions(+)
 create mode 100644 benchtests/tanhf-inputs
  

Comments

Paul Zimmermann Nov. 3, 2021, 4:53 p.m. UTC | #1
Dear Sunil,

out of the 200 inputs, 28 yield tanh(x)=1 or -1, and 52 yield tanh(x)=x,
thus only 120 exercise the "real cases".

Also maybe you could enlarge the file to 1000 inputs?

Paul
  

Patch

diff --git a/benchtests/Makefile b/benchtests/Makefile
index 8d050d270d..9e81eb8842 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -90,6 +90,7 @@  bench-math := \
   sqrt \
   tan \
   tanh \
+  tanhf \
   tgamma \
   trunc \
   truncf \
diff --git a/benchtests/tanhf-inputs b/benchtests/tanhf-inputs
new file mode 100644
index 0000000000..e9a641f34e
--- /dev/null
+++ b/benchtests/tanhf-inputs
@@ -0,0 +1,203 @@ 
+## args: float
+## ret: float
+## includes: math.h
+-0x1.79ea72p-9
+-0x1.94d4ep+3
+-0x1.b63e92p+0
+-0x1.299708p-5
+-0x1.35ec26p-19
+-0x1.d139c6p-49
+-0x1.ba38b6p-6
+-0x1.83f902p+3
+-0x1.dc3722p-51
+-0x1.922cb4p-3
+0x1.357956p+1
+0x1.3d52b2p+3
+-0x1.f7e794p-7
+-0x1.3f96b4p+0
+-0x1.a82266p+1
+-0x1.ced122p+0
+0x1.e4e264p-4
+0x1.8c5fdp-40
+0x1.c1b892p+0
+-0x1.223b8p-33
+0x1.718468p-41
+-0x1.8a4422p-1
+-0x1.67e982p-41
+-0x1.368b8p+1
+-0x1.663534p-39
+0x1.1aa844p-18
+-0x1.d70654p-43
+0x1.c84f96p+2
+-0x1.f327d6p-9
+0x1.212b32p-49
+0x1.62533p+3
+0x1.ca2524p-32
+0x1.d502b8p+2
+-0x1.5c6892p-29
+-0x1.c05afp+0
+-0x1.3f35f8p+4
+0x1.f71314p+1
+0x1.ffb1ep+2
+0x1.cad8c2p-32
+-0x1.ff34f2p-3
+0x1.6156d8p-53
+-0x1.4b5a84p+0
+0x1.c22fd4p+3
+0x1.3fa1e6p+2
+-0x1.90f3f6p-52
+0x1.0d16c6p+1
+0x1.421a76p+1
+-0x1.4b251p+3
+0x1.ac89b6p+0
+-0x1.f5a006p+1
+0x1.263f96p-25
+-0x1.81c16p+2
+-0x1.4c0a56p+4
+-0x1.2c2e34p-47
+-0x1.b57eb4p-21
+-0x1.53a808p-39
+0x1.535964p-43
+-0x1.d049e6p-23
+-0x1.ad3f88p+1
+-0x1.b95594p-35
+0x1.480e54p-33
+0x1.9f8f62p-54
+-0x1.80ed54p+2
+0x1.0a15bp-42
+-0x1.2700a6p+3
+0x1.825744p-42
+-0x1.a96978p+1
+0x1.0fbf54p-16
+-0x1.68dc34p+0
+-0x1.08c496p+1
+0x1.7112c2p+1
+0x1.45aa62p-13
+0x1.243186p+1
+0x1.2712f6p-52
+0x1.cd7698p-32
+0x1.9ab284p-15
+0x1.9cf328p-21
+0x1.dccc32p-48
+-0x1.b2a4e6p+0
+-0x1.9802a6p+0
+0x1.3da496p-27
+-0x1.d46704p-50
+0x1.12d69p-25
+0x1.347632p-39
+-0x1.2f5428p+1
+-0x1.44a7fp-18
+0x1.c95486p-45
+0x1.c9922p+3
+0x1.a067b2p+2
+-0x1.4cfdd4p-10
+0x1.509082p-43
+0x1.bbbc04p-34
+-0x1.d7973p+1
+0x1.4aeba2p-11
+0x1.721152p+2
+-0x1.3a4016p+3
+0x1.555714p-37
+0x1.a877a8p-46
+0x1.ba8ad2p-6
+0x1.e500b2p+0
+-0x1.7c7802p+1
+-0x1.89c342p-21
+-0x1.9653b8p+1
+0x1.cbc546p+1
+0x1.80dd34p-29
+0x1.a8861p-35
+0x1.3bf708p+1
+-0x1.58fc26p-51
+0x1.99f184p-37
+0x1.a5c078p+3
+0x1.1676a2p-31
+-0x1.151f62p+0
+-0x1.82b124p-21
+-0x1.9c78a8p+2
+0x1.81db56p+0
+-0x1.403546p+3
+-0x1.884176p-5
+-0x1.8cd808p+2
+0x1.28b7d4p-16
+-0x1.dbdfc6p+3
+-0x1.93ca44p+2
+-0x1.863014p-40
+0x1.6f0606p-48
+0x1.e4bbp+0
+0x1.4e7cd6p-22
+0x1.d82514p+0
+0x1.08ea66p-4
+-0x1.4eb052p+3
+-0x1.94754p-38
+-0x1.9d4c18p-18
+0x1.ffdc34p+3
+-0x1.f01e86p-45
+-0x1.040acp-37
+0x1.deca68p+3
+0x1.7ea616p-31
+-0x1.5ad552p+1
+-0x1.184778p+2
+-0x1.da6836p+1
+0x1.d47856p-32
+-0x1.8dff62p+2
+0x1.512c92p-42
+0x1.0d46e6p-38
+-0x1.f2cba4p+3
+-0x1.1bd606p+1
+-0x1.314a92p+1
+0x1.78e992p+3
+0x1.547ba4p+1
+-0x1.10b636p+1
+0x1.2bc994p-3
+-0x1.8edd86p+3
+-0x1.0f5bf4p-54
+0x1.e38d84p-43
+-0x1.9c3138p-25
+-0x1.01ea82p+3
+0x1.b68126p-9
+-0x1.49f406p+0
+-0x1.72a778p-8
+0x1.198eap+1
+-0x1.ecc604p-21
+-0x1.e649cp+3
+0x1.06f164p+0
+-0x1.693d86p-10
+-0x1.008746p+1
+-0x1.05519p-51
+-0x1.df8af6p+2
+-0x1.fa5552p-13
+0x1.5d5fap-9
+0x1.726ff6p+2
+-0x1.17fe02p+2
+0x1.261da4p-35
+-0x1.55b502p+1
+-0x1.5b3682p+2
+-0x1.2e7716p-16
+0x1.5be034p+0
+-0x1.b530c4p+2
+0x1.b3c984p-50
+0x1.9286b6p+3
+0x1.106138p+2
+0x1.df2ad2p-26
+-0x1.1ae766p+4
+0x1.1cecd8p+4
+0x1.e1619p-48
+-0x1.43ad34p+3
+0x1.f978d6p+2
+0x1.340976p+2
+0x1.2ca3d4p+3
+-0x1.75fb14p+0
+0x1.1c6be4p+4
+0x1.1b5488p+0
+-0x1.73c328p-33
+0x1.0e0354p-54
+-0x1.168b02p+1
+-0x1.816c54p-45
+-0x1.ee867p+2
+-0x1.137d5p+1
+0x1.094c26p-22
+0x1.87a6a4p-37
+0x1.9c4674p-9
+0x1.2ba8d8p-43
+0x1.35e724p+4