The NetBSD Project

CVS log for src/tests/lib/libm/t_cos.c

[BACK] Up to [cvs.NetBSD.org] / src / tests / lib / libm

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.12: download - view: text, markup, annotated - select for diffs
Sun Jun 9 16:53:12 2024 UTC (6 months ago) by riastradh
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs, HEAD
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +19 -19 lines
tests/lib/libm: Fix various xfails related to PR lib/45362.

Writing

	if (condition) {
		atf_tc_expect_fail(...);
		atf_tc_fail(...);
	}

in order to paper over a bug in qemu renders the test nearly useless
because it will never actually fail in the event that something
unexpected is broken.

atf_tc_expect_fail only makes senes _before_ doing the test.  If we
want to paper over a bug in qemu, we can do:

	if (isQEMU)
		atf_tc_expect_fail("qemu is broken, PR lib/...");
	ATF_CHECK(condition);

That way, we are still doing the test in non-qemu circumstances, and
if the qemu bug is fixed the test will give the feedback of an
unexpected pass.

While here: Use `volatile double x = ...' as input so the compiler
doesn't optimize calls like sin(x) away at build-time, and print the
bad values with ATF_CHECK_MSG on failure in case anything goes wrong.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Mon May 6 15:45:20 2024 UTC (7 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +5 -4 lines
tests/lib/libm/t_cos: Fix comment about necessity of volatile.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Mon May 6 15:44:08 2024 UTC (7 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +2 -7 lines
tests/lib/libm/t_cos: Nix __HAVE_LONG_DOUBLE.

cosl should always be defined even on architectures where long double
is the same as double so the confusingly named __HAVE_LONG_DOUBLE is
not defined.

Revision 1.4.26.1: download - view: text, markup, annotated - select for diffs
Mon Jun 10 22:10:07 2019 UTC (5 years, 6 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.4: preferred, colored; next MAIN 1.5: preferred, colored
Changes since revision 1.4: +166 -30 lines
Sync with HEAD

Revision 1.9: download - view: text, markup, annotated - select for diffs
Mon May 27 00:10:36 2019 UTC (5 years, 6 months ago) by maya
Branches: MAIN
CVS tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-4-RELEASE, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, is-mlppp-base, is-mlppp, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +14 -3 lines
on i386 with FLT_EVAL_METHOD=2, the computation inside cosf was done in
binary80 arithmetic and never rounded to binary32 at the end, so it
appeared farther from the correctly rounded result in binary32 than expected.

Force binary32 using volatile float.

PR lib/54232: lib/libm/t_cos:cosf_angles regression on i386

From Riastradh.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Thu Apr 25 22:58:23 2019 UTC (5 years, 7 months ago) by maya
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +110 -1 lines
Expand to cover long double somewhat.

The given data is for double, so use DBL_EPSILON and don't expect better
results.

Revision 1.4.24.1: download - view: text, markup, annotated - select for diffs
Mon Nov 26 01:52:53 2018 UTC (6 years ago) by pgoyette
Branches: pgoyette-compat
CVS tags: pgoyette-compat-merge-20190127
Diff to: previous 1.4: preferred, colored; next MAIN 1.5: preferred, colored
Changes since revision 1.4: +46 -30 lines
Sync with HEAD, resolve a couple of conflicts

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sat Nov 10 23:04:16 2018 UTC (6 years, 1 month ago) by riastradh
Branches: MAIN
CVS tags: pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +3 -3 lines
Print the input to cosf on failure too.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Wed Nov 7 04:00:13 2018 UTC (6 years, 1 month ago) by riastradh
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +1 -11 lines
Disable x87 implementations of sin, cos, tan.

The x87 hardware uses a bad approximation to pi for argument
reduction, and consequently yields bad answers for inputs near pi or
pi/2.

Tweak one tanf test whose doubly rounded output is a little too far
from the correct answer on the doubly rounded input.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Wed Nov 7 03:59:36 2018 UTC (6 years, 1 month ago) by riastradh
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +56 -30 lines
Fix up libm tests.

- Fix up last few digits of a lot of known-answer tests.

  Confirmed with GNU mpfr to 200 bits of precision and cross-checked
  with whatever libm Ubuntu ships with.

- Test relative error, not absolute error.

- Set bounds in terms of *_EPSILON, not magic numbers.

  *_EPSILON is twice the largest relative error of a correctly
  rounded operation, and equal to the largest relative error of an
  operation with up to 1ulp error.

  Most of the operations we're testing are not correctly rounded, but
  they ought to be no more than 1ulp away.  For the few cases where
  that's not a priori clear (like comparing cbrt and pow(x, 1/3)),
  use twice *_EPSILON to allow some leeway.

- Write the success condition positively as error <= eps.

  This comes out false if the result is a NaN, meaning failure.  In
  contrast, if we write error > eps for the _failure_ condition, then
  if the result is a NaN, it will also come out false, but meaning
  success, which is not what we want.

- Fix the trigonometric test cases near bad spots.

  sin(pi - d) for nonzero d is not zero; it is d + O(d^3).  pi is not
  a floating-point number, so these results should be approximately
  the nonzero error of our approximation to pi.  Likewise with
  cos(pi/2 - d) and tan(pi + d).

  (Yes, I know the sin _function_ is ill-conditioned near pi so you
  shouldn't pass approximate inputs near there, but that's separate
  from whether a sin _implementation_ gives an answer that is wrong
  by quintillions of ulps.)

  Since on x86 (i386 and amd64 alike) we currently use x87 hardware
  trigonometric instructions, which are bad, these are marked xfail
  on x86 for now until we switch to software implementations (coming
  soon to a repository near you).

- Use %.8g, %.17g, %.35g to print float, double, long double in failures.

  This should be enough to identify the problematic outputs and/or
  reproduce the computation, even if long double is binary128 with
  115 bits of precision.

If there are any new libm test failures after this, tell me what
architecture you're on and send me the atf output and I'll try to
figure it out.

Revision 1.3.8.1: download - view: text, markup, annotated - select for diffs
Wed Aug 20 00:04:50 2014 UTC (10 years, 3 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.3: preferred, colored; next MAIN 1.4: preferred, colored
Changes since revision 1.3: +1 -21 lines
Rebase to HEAD as of a few days ago.

Revision 1.3.2.1: download - view: text, markup, annotated - select for diffs
Thu May 22 11:42:21 2014 UTC (10 years, 6 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.3: preferred, colored; next MAIN 1.4: preferred, colored
Changes since revision 1.3: +1 -21 lines
sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.4: download - view: text, markup, annotated - select for diffs
Mon Mar 3 10:39:08 2014 UTC (10 years, 9 months ago) by martin
Branches: MAIN
CVS tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-base, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base, netbsd-8-3-RELEASE, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: phil-wifi, pgoyette-compat
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +1 -21 lines
Remove all cargo-cult #ifndef __vax__ from the tests, that just paper
over bugs in the vax libm.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Wed Sep 14 13:29:58 2011 UTC (13 years, 2 months ago) by jruoho
Branches: MAIN
CVS tags: yamt-pagecache-tag8, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, agc-symver-base, agc-symver
Branch point for: yamt-pagecache, tls-maxphys
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +9 -3 lines
Additions to PR lib/45362: the float variants cosf(3), sinf(3), and tanf(3)
do not detect NaN for positive and negative infinity on i386 (qemu).

Revision 1.2: download - view: text, markup, annotated - select for diffs
Wed Sep 14 06:50:43 2011 UTC (13 years, 2 months ago) by jruoho
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +2 -2 lines
Use fabsf(3) when appropriate.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Wed Sep 14 05:18:19 2011 UTC (13 years, 2 months ago) by jruoho
Branches: MAIN
Some tests for sine, cosine, and tangent.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>