New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckBadValues: 0 is "unknown" floating point type on Windows #4238

Closed
snappizz opened this Issue Jan 9, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@snappizz
Copy link
Member

snappizz commented Jan 9, 2019

Environment

  • Your SuperCollider version: latest 3.10 branch, 34c4486
  • Your operating system and version: Windows 10

Steps to reproduce (for bugs)

this code is a minimal reproducer:

{ CheckBadValues.ar(LFPulse.ar(10)); DC.ar(0) }.play;

on windows, CheckBadValues treats 0 as an "unknown" floating-point classification, and therefore posts messages when the input signal changes from zeros to nonzero normal values:

CheckBadValues: unknown found in Synth 10103, ID 0 (previous 2400 values were normal)
CheckBadValues: normal found in Synth 10103, ID 0 (previous 2400 values were infinity)

Discussion

the culprit is in server/plugins/TestUGens.cpp, which has this code:

const char *CheckBadValues_fpclassString(int fpclass)
{
	switch(fpclass) {
		case FP_NORMAL:       return "normal";
		case FP_NAN:          return "NaN";
		case FP_INFINITE:     return "infinity";
#ifndef _MSC_VER
		case FP_ZERO:         return "zero";
#endif
		case FP_SUBNORMAL:    return "denormal";
		default:              return "unknown";
	}
}

for some reason, the FP_ZERO floating point classification is excluded on MSVC. fixing this bug should be as simple as removing the #ifndef _MSC_VER directives (and that file should be refactored for simplicity). but before we fix this -- can anyone figure why it's written this way in the first place? did MSVC not support FP_ZERO at some point?

@brianlheim

This comment has been minimized.

Copy link
Member

brianlheim commented Jan 9, 2019

AFAICT MSVC supports it in 2015 and 2017 - https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fpclassify?view=vs-2015.

looks like this might have been missing in 2012 - 46fa18f. Safe to remove now I think!

@snappizz

This comment has been minimized.

Copy link
Member

snappizz commented Jan 9, 2019

cool, thanks for looking into it. i'll take care of this one.

@snappizz snappizz added this to the 3.10.1 milestone Jan 9, 2019

@snappizz snappizz self-assigned this Jan 9, 2019

snappizz added a commit to snappizz/supercollider that referenced this issue Jan 9, 2019

plugins: Fix CheckBadValues for zeros on MSVC
This commit fixes a bug in the CheckBadValues ugen affecting MSVC. Preprocessor directives were in this code as a workaround for MSVC std::fpclassify not supporting FP_ZERO. This is no longer the case.

For supercollider#4238.
@snappizz

This comment has been minimized.

Copy link
Member

snappizz commented Jan 13, 2019

fixed #4240

@snappizz snappizz closed this Jan 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment