58 questions
0 votes
1 answer
170 views
GCC offers a _Float16 type, but - what about the functions to work with it?
GCC offers a 16-bit floating point type, outside of the C language standard: _Float16 - at least for x86_64. This allowance is described here. However - the GCC documentation does not seem to indicate ...
0 votes
1 answer
121 views
Why does NVCC not optimize ldexpf with a constexpr power-of-two exponent into a simple fmul?
Consider the following CUDA code: enum { p = 5 }; __device__ float adjust_mul(float x) { return x * (1 << p); } __device__ float adjust_ldexpf(float x) { return ldexpf(x, p); } I would expect ...
1 vote
3 answers
212 views
Is Math.sqrt(x) and Math.pow(x, 0.5) equivalent?
In ECMAScript, given a non-negative, finite double x, is the following assertion always true? Math.sqrt(x) === Math.pow(x, 0.5) I know that both Math.sqrt() and Math.pow() are implementation-...
1 vote
0 answers
136 views
Weird movement using Mathf.LerpAngle Unity
I was making half 2d ,half 3d game. I wanted the up/down movement to be accompanied by a slight rotation in the direction the player is moving, for that I decided to use Mathf.LerpAngle method , ...
0 votes
1 answer
65 views
Why does the vibrational module graph show blue zones?
Title: Vibrations in a Structure Excited - Determination of Damping Coefficient The objective of this practical work is to determine the damping coefficient to prevent excessive vibrations in a ...
0 votes
0 answers
29 views
How do I graph an input function? [duplicate]
With pyplot you can plot a function with x = np.linspace(-10, 10, num=100) #start x, end x, number of points on line fx = [] for i in range(len(x)): fx.append(-2*x[i]**3 - 35*x[i]**2 + 39*x[i] + 70)...
-1 votes
1 answer
182 views
How to plot negative values in the base of an exponent [duplicate]
I want to plot f(x) = x^(2/3) using python, however, I'm only able to get it to plot for the positive values of x. Does anyone have any ideas where I'm going wrong? import numpy as np import ...
3 votes
1 answer
231 views
Why is Boost implementation 5-10x slower than R's
I am building an app that frequently computes the regularized incomplete beta function. The app is written in C++ and calls R::pbeta(). When I tried to multithread the app, some warning messages from ...
0 votes
0 answers
31 views
Why does math.floor() round up numbers after 15 decimal places in python? [duplicate]
I am trying to calculate the floor value of certain numbers. It works fine when I run this: math.floor(9.999999999999999) . I get the output as 9 . This number has 15 decimal places. However, math....
0 votes
1 answer
251 views
How to create a (math) function for the position of a billiard ball when considering friction
so I'm creating a billiard ball simulation. The current version I have calculates the new position of the ball for each step, but I would like to create a math function (f(x)) for the balls position. ...
0 votes
1 answer
92 views
how to plot functions containing variables in function-plot?
I have the code to generate a sine wave in the javascript library- function-plot: functionPlot({ target: '#domain', yAxis: {domain: [-1, 1]}, xAxis: {domain: [8, 24]}, data: [{ fn: '...
0 votes
1 answer
807 views
Why is the Cos function in C# giving me wrong answers?
I have a method, in which I am using the Cos() Function from the namespace "Mathf". Sadly, when I give, for example the in put of 45 it returns 0,52532, which is wrong. Using a calculator I ...
0 votes
0 answers
119 views
C# Lower Math.Infinity
how can I change the Mathf.Infinity to make the Raycast length be something like 0.1 Meters? // Fire a ray through the scene at the mouse position and place the target where it hits RaycastHit hit; if ...
0 votes
0 answers
165 views
Algorithm for a Pow2() function for fractions?
Does anyone know an algorithm for a Pow2() function for fractions? For a function of the following form, where BigRational stands for any rational number type, with arbitrarily large integers for ...
1 vote
1 answer
179 views
How do I add values to my graph in core plot swift?
let graph = CPTXYGraph(frame: hostview.bounds) hostview.hostedGraph = graph graph.paddingLeft = 0.0 graph.paddingTop = 0.0 graph.paddingRight = 0.0 graph....