Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libm/complex similar to csqrt, spare ourselves a fabsf c...
details: https://anonhg.NetBSD.org/src/rev/0104a5d0cfad
branches: trunk
changeset: 350002:0104a5d0cfad
user: maya <maya%NetBSD.org@localhost>
date: Sat Dec 31 22:54:56 2016 +0000
description:
similar to csqrt, spare ourselves a fabsf call. we already check sign
later on, use this to our advantage.
No functional change.
diffstat:
lib/libm/complex/csqrtf.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (27 lines):
diff -r b1b91a23d424 -r 0104a5d0cfad lib/libm/complex/csqrtf.c
--- a/lib/libm/complex/csqrtf.c Sat Dec 31 22:47:01 2016 +0000
+++ b/lib/libm/complex/csqrtf.c Sat Dec 31 22:54:56 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: csqrtf.c,v 1.2 2016/12/31 20:01:15 maya Exp $ */
+/* $NetBSD: csqrtf.c,v 1.3 2016/12/31 22:54:56 maya Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -55,12 +55,13 @@
}
if (x == 0.0f) {
- r = fabsf(y);
- r = sqrtf(0.5f * r);
- if (y > 0)
+ if (y > 0) {
+ r = sqrtf(0.5f * y);
w = r + r * I;
- else
+ } else {
+ r = sqrtf(-0.5f * y);
w = r - r * I;
+ }
return w;
}
Home |
Main Index |
Thread Index |
Old Index