From 1f05883799957300ea88d7ec314a5897e6c0ccb1 Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Tue, 13 Feb 2024 16:51:17 -0800 Subject: Add SIN/COS to elementwise operator set Only defined for floating-point types. Signed-off-by: Eric Kunze Change-Id: Ieae355076f9aac6882fab8530e6d7d9985a6e661 --- chapters/ewise_unary.adoc | 36 ++++++++++++++++++++++++++++++++++++ chapters/introduction.adoc | 12 ++++++++++++ 2 files changed, 48 insertions(+) (limited to 'chapters') diff --git a/chapters/ewise_unary.adoc b/chapters/ewise_unary.adoc index 4b8cd4d..e2d3779 100644 --- a/chapters/ewise_unary.adoc +++ b/chapters/ewise_unary.adoc @@ -67,6 +67,24 @@ include::{generated}/operators/CLZ.adoc[] include::{pseudocode}/operators/CLZ.tosac[lines=10..-1] ---- +==== COS + +Elementwise cosine operation for values given in radians. + +include::{generated}/operators/COS.adoc[] + +[source, c++] +---- +include::{pseudocode}/operators/COS.tosac[] +---- + +*Floating-point behavior:* +|=== +|Input|-infinity|+infinity|-0|+0|NaN + +|Output|NaN|NaN|+1|+1|NaN +|=== + ==== EXP Elementwise e to the x operation @@ -185,3 +203,21 @@ include::{generated}/operators/RSQRT.adoc[] ---- include::{pseudocode}/operators/RSQRT.tosac[lines=10..-1] ---- + +==== SIN + +Elementwise sine operation for values given in radians. + +include::{generated}/operators/COS.adoc[] + +[source, c++] +---- +include::{pseudocode}/operators/COS.tosac[] +---- + +*Floating-point behavior:* +|=== +|Input|-infinity|+infinity|-0|+0|NaN + +|Output|NaN|NaN|-0|+0|NaN +|=== diff --git a/chapters/introduction.adoc b/chapters/introduction.adoc index 17c16a8..a580472 100644 --- a/chapters/introduction.adoc +++ b/chapters/introduction.adoc @@ -309,6 +309,18 @@ Let n be number of elements in the product, out_imp the implementation result, a Let `err_bnd = abs(out_ref) * (pow(1 + pow(2, -normal_frac - 1), n) - 1)` + Then `tosa_reference_check_fp_bnd(out_imp, out_ref, err_bnd)` must be true +| <> +| Let `x` be an input element and `out_imp` the implementation output of `cos(x)`. + +Let `out_ref` be the result of the fp64_t reference implementation of `cos(x)`. + +Let `err_bnd = abs(out_ref) * exp2(-normal_frac/2)` + +Then `tosa_reference_check_fp_bnd(out_imp, out_ref, err_bnd)` must be true + +| <> +| Let `x` be an input element and `out_imp` the implementation output of `sin(x)`. + +Let `out_ref` be the result of the fp64_t reference implementation of `sin(x)`. + +Let `err_bnd = abs(out_ref) * exp2(-normal_frac/2)` + +Then `tosa_reference_check_fp_bnd(out_imp, out_ref, err_bnd)` must be true + |=== ===== Operator sequence precision requirement -- cgit v1.2.1