Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
pitch errors verification for Nowhk
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#include <cmath> #include <iostream> #include <iomanip> const double C0 = 16.352; const double ln2per12 = std::log(2.) / 12; // your ref and approx frequency values: const int index[] = {46, 623, 954}; const double refFreq[] = {1.33304775683583476286742097727255895733833313, 37.3506591867008808094396954402327537537, 252.719842525523120002617361024022102356}; const double apxFreq[] = {1.33304797524971263555926270782947540283203125, 37.3506628974037084844894707202911376953, 252.719804590087733231484889984130859375}; // ............................................................ void testErrors() { using namespace std; cout.precision(12); const int n = sizeof(index)/sizeof(*index); cout << "pitch index: "; for (int i = 0; i < n; i++) cout << " " << setw(18) << left << index[i]; cout << endl; cout << "relative errors:"; for (int i = 0; i < n; i++) cout << " " << abs(refFreq[i] - apxFreq[i]) / refFreq[i]; cout << endl; cout << "pitch errors: "; for (int i = 0; i < n; i++) { double a = log(refFreq[i] / C0) / ln2per12; double b = log(apxFreq[i] / C0) / ln2per12; cout << " " << abs(a - b); } cout << endl; } // ............................................................ int main() { testErrors(); return 0; }
cl.exe
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 1,91 sec, absolute running time: 10,29 sec, absolute service time: 12,21 sec
edit mode
|
history
|
discussion