Skip to content

Instantly share code, notes, and snippets.

@vitorpacheco
Last active October 16, 2020 00:37
Show Gist options
  • Save vitorpacheco/d4980e765bf8d93b056bb2bbcd56a34e to your computer and use it in GitHub Desktop.
Save vitorpacheco/d4980e765bf8d93b056bb2bbcd56a34e to your computer and use it in GitHub Desktop.
class Main {
static void calc_err(float xb, float x) {
float erroAbsoluto = Math.abs(x - xb);
float erroRelativo = Math.abs(erroAbsoluto/xb);
System.out.printf("%.5f %.5f\n", erroAbsoluto, erroRelativo);
}
public static void main(String[] args) {
calc_err(9.24956f, 9.238f);
calc_err(4.24499f, 4.243f);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment