# How to use cmath Bessel functions with Mac

Advertisements So I am using Mac with the developer tools coming from XCode and according to other answers I should compile using something like: g++ –std=c++17 test.cpp -o test or using clang++ but I still I am having trouble making the script find the special functions. What else can I try? Minimum example #include <cmath>… Read More How to use cmath Bessel functions with Mac

# Why is abs(x)+abs(y) different from sqrt(x*x + y*y)

Advertisements I was making a Physics Engine in C++ when I noticed that when I replace: float absDistance = sqrt(vectorDistance.x * vectorDistance.x + vectorDistance.y * vectorDistance.y); With: float absDistance = abs(vectorDistance.x) + abs(vectorDistance.y) Different things happen. I’m using the library <cmath> I looked at a lot of stack exchanges but I couldn’t find anyone saying… Read More Why is abs(x)+abs(y) different from sqrt(x*x + y*y)

# c++ entering values two times instead of one

Advertisements I have to solve this " create class for describing triangle and trapeze with ability to return values and finding S of the figures.. declare function which allows comparing S of the both figures.. in main function declare object triangle and trapeze and compare their areas .. " – im trying to translate it… Read More c++ entering values two times instead of one

# Ceil function returns the wrong number

Advertisements I was trying to do this math operation and I use ceil() for rounding the number. But I noticed that it gives the wrong result. The output of the operation is 48.90510949 and when we round the number it must be 49. But instead of ceil() gives 48. But when I give the number… Read More Ceil function returns the wrong number