floating-accuracy Questions
2
Solved
I'm writing a program which converts CIL bytecode to C source code for machine consumption. I was concerned about inaccuracy in floating-point constants due to conversion to and from decimal. After...
Etch asked 12/8, 2013 at 5:32
2
Solved
I am having problems reading probabilities from CSV using pandas.read_csv; some of the values are read as floats with > 1.0.
Specifically, I am confused about the following behavior:
>>&...
Kendry asked 29/5, 2017 at 17:7
2
Solved
Anybody know about documentation for this behaviour?
import numpy as np
A = np.random.uniform(0,1,(10,5))
w = np.ones(5)
Aw = A*w
Sym1 = Aw.dot(Aw.T)
Sym2 = (A*w).dot((A*w).T)
diff = Sym1 - Sym2
...
Aile asked 17/4, 2017 at 14:46
3
Solved
I have a list of floats and want to check if it already contains a particular value with the List.Contains() method. I know that for float equality tests you often can't use == but something like m...
Jordonjorey asked 8/3, 2017 at 0:37
10
Solved
I have a simple C++ program compiled using gcc 4.2.4 on 32-bit Ubuntu 8.04. It has a for-loop in which a double variable is incremented from zero to one with a certain step size. When the step size...
Prone asked 17/8, 2009 at 6:15
5
Solved
I am making a rigid body physics engine from scratch (for educational purposes), and I'm wondering if I should choose single or double precision floats for it.
I will be using OpenGL to visualize ...
Lama asked 6/12, 2013 at 19:27
2
Solved
I'm storing monetary values in a mysql table as floats.
problem being, mysql is rounding the numbers up or down.
ex. 12345.68 gets rounded to 12345.7
How can I stop this or is there a better da...
Fortunate asked 5/1, 2017 at 18:29
3
I need to perform a simple multiplication of 400 * 256.3. The result is 102520. Straight forward and simple. But to implement this multiplication in C++ (or C) is a little tricky and confusing to m...
Vatic asked 14/11, 2016 at 9:39
8
Solved
Every time I start a new project and when I need to compare some float or double variables I write the code like this one:
if (fabs(prev.min[i] - cur->min[i]) < 0.000001 &&
fabs(pre...
Romeliaromelle asked 28/12, 2010 at 17:38
7
I and my Ph.D. student have encountered a problem in a physics data analysis context that I could use some insight on. We have code that analyzes data from one of the LHC experiments that gives irr...
Abrasion asked 15/2, 2011 at 19:35
2
Solved
Looks like both 4.5 and 5.5 have exact float representations in Python 3.5:
>>> from decimal import Decimal
>>> Decimal(4.5)
Decimal('4.5')
>>> Decimal(5.5)
Decima...
Profound asked 4/10, 2016 at 14:43
1
Solved
The (exponentially) scaled complementary error function, commonly designated by erfcx, is defined mathematically as erfcx(x) := ex2 erfc(x). It frequently occurs in diffusion problems in physics as...
Foxhole asked 29/9, 2016 at 18:19
4
Solved
I know that most decimals don't have an exact floating point representation (Is floating point math broken?).
But I don't see why 4*0.1 is printed nicely as 0.4, but 3*0.1 isn't, when
both values ...
Ancestry asked 21/9, 2016 at 14:7
1
Solved
I reviewed the following posts beforehand. Is there a way to use DataFrame.isin() with an approximation factor or a tolerance value? Or is there another method that could?
Filter dataframe rows if...
Igbo asked 20/9, 2016 at 19:7
2
I am working with a problem that routinely needs to compute the density of the t distribution rather far in the tails in R.
For example, using R's t distribution function, dt(1.424781, 1486, -5) r...
Nyberg asked 27/8, 2016 at 17:35
1
The code here is straight forward but I don't understand the results:
float percent = 0.69f;
int firstInt = (int)(percent*100f);
float tempFloat = percent*100f;
int secondInt = (int)tempFlo...
Cailly asked 8/8, 2016 at 22:56
4
Solved
Is there a way to programmatically get the double that is closest to 1.0, but isn't actually 1.0?
One hacky way to do this would be to memcpy the double to a same-sized integer, and then subtract ...
Calandra asked 6/8, 2016 at 7:52
2
Solved
What is the invertability of the IEEE 754 floating-point division? I mean is it guaranteed by the standard that if double y = 1.0 / x then x == 1.0 / y, i.e. x can be restored precisely bit by bit?...
Rome asked 1/8, 2016 at 22:44
8
Solved
$a = '35';
$b = '-34.99';
echo ($a + $b);
Results in 0.009999999999998
What is up with that? I wondered why my program kept reporting odd results.
Why doesn't PHP return the expected 0.01...
Anaptyxis asked 16/9, 2010 at 12:39
4
Solved
When this floating point calculation is executed in boost::thread, it gives different result than when executed in std::thread or in main thread.
void print_number()
{
double a = 5.66;
double b ...
Meuser asked 14/7, 2016 at 10:17
1
Solved
I am working with an array of doubles called indata (in the heap, allocated with malloc), and a local double called sum.
I wrote two different functions to compare values in indata, and obtained ...
Marhtamari asked 4/6, 2016 at 5:24
6
Solved
I am trying to find out the precision level for various floating point formats in C (i.e. float, double and long double). Here is the code I'm using at the moment:
#include <stdio.h>
#define...
Habitue asked 13/8, 2010 at 16:14
3
Solved
Is there a function for integer exponentiation in OCaml? ** is only for floats. Although it seems to be mostly accurate, isn't there a possibility of precision errors, something like 2. ** 3. = 8. ...
Pepperandsalt asked 5/6, 2013 at 22:3
1
Solved
I have files of the below format in a text file which I am trying to read into a pandas dataframe.
895|2015-4-23|19|10000|LA|0.4677978806|0.4773469340|0.4089938425|0.8224291972|0.8652525793|0.6829...
Wampler asked 28/4, 2016 at 8:35
2
Solved
For example:
float a = 3.14159f;
If I was to inspect the bits in this number (or any other normalized floating point number), what are the chances that the bits are different in some other plat...
Providenciaprovident asked 25/4, 2016 at 17:40
© 2022 - 2024 — McMap. All rights reserved.