floating-accuracy Questions

2

Someone just asked why sum(myfloats) differed from sum(reversed(myfloats)). Quickly got duped to Is floating point math broken? and deleted. But it made me curious: How many different sums can we g...
Transarctic asked 15/9, 2021 at 12:17

3

While going through this post at SO by the user @skrebbel who stated that the google testing framework does a good and fast job for comparing floats and doubles. So I wrote the following code to ch...
Dudek asked 6/9, 2013 at 21:14

3

Solved

I am working on some programming problems where I have to transition probabilities between standard space and log-space. For this purpose, I am trying to find out the maximum absolute error for the...
Farmelo asked 21/6, 2021 at 7:32

9

I've heard of "error" when using floating point variables. Now I'm trying to solve this puzzle and I think I'm getting some rounding/floating point error. So I'm finally going to figure out the bas...
Larynx asked 30/10, 2008 at 7:12

6

Solved

I am trying to figure this out, the market data returns money values as a string that is 8 places after the digit long. money = "124.19000540" I need this to be 124.19, any idea how to achieve t...
Ignaz asked 14/7, 2015 at 19:58

10

Solved

I'm trying to separate the decimal and integer parts of a double in swift. I've tried a number of approaches but they all run into the same issue... let x:Double = 1234.5678 let n1:Double = x % 1....
Justly asked 14/7, 2015 at 1:47

4

Solved

i had a problem where i was trying to reconstruct the the formula used in an existing system, a fairly simple formula of one input and one output: y = f(x) After a lot of puzzling, we managed to...
Mcphail asked 23/9, 2012 at 14:28

1

Using the IEEE Standard for float, how many different numbers can a 32 bit float represent?
Lorelle asked 4/10, 2020 at 18:42

17

Solved

In the C++ standard libraries I found only a floating point log method. Now I use log to find the level of an index in a binary tree ( floor(2log(index)) ). Code (C++): int targetlevel = int(log...
Rriocard asked 15/6, 2009 at 5:30

1

Solved

The difference of two products and the sum of two products are two primitives found in a variety of common computations. diff_of_products (a,b,c,d) := ab - cd and sum_of_products(a,b,c,d) := ab + c...
Pfaff asked 31/8, 2020 at 4:57

2

Solved

I'm writing a unit test for a class for 3D vector objects and its algebra (dot product, cross product etc.) and just observed a behavior I can somehow understand, but not to its fully extent. What ...

4

Solved

In the following query declare @a float(23) declare @b float(23) declare @c float(53) set @a = 123456789012.1234 set @b = 1234567.12345678 set @c = @a * @b select @c select LTRIM(STR((@c),32,12))...
Dissect asked 7/12, 2011 at 11:28

7

I'm having an infinite loop when I run this code: intensity = 0.50 while intensity != 0.65: print(intensity) intensity = intensity + 0.05 intensity values should be like 0.50 -> 0.55 -> ...
Directions asked 18/4, 2020 at 4:32

3

What's the threshold value of binary_accuracy in keras Metrices is used to predicted one sample as positive and negative cases? is that threshold value 0.5? how to adjust it? I want to set the thre...
Faison asked 14/1, 2017 at 14:22

1

Solved

On Intel processors, x87 trigonometric instructions such as FSIN have limited accuracy due to the use of a 66-bit approximation of pi even though the computation itself is otherwise accurate to the...

2

Solved

FLT_DIG, DBL_DIG, LDBL_DIG are the number of decimal digits that can be accurately represented by float, double, and long double types respectively. #include <stdio.h> #include <flo...
Shakeup asked 30/11, 2019 at 21:57

9

In Java the floating point arithmetic is not represented precisely. For example this java code: float a = 1.2; float b= 3.0; float c = a * b; if(c == 3.6){ System.out.println("c is 3.6"); } el...
Aleece asked 24/5, 2010 at 9:42

2

Solved

I have just noticed that the following code returns true: Mathf.Approximately(0.0f, float.Epsilon); // true I have read the Mathf.Approximately Documentation and it states that: Approximatel...

6

Solved

My question is not about floating precision. It is about why Equals() is different from ==. I understand why .1f + .2f == .3f is false (while .1m + .2m == .3m is true). I get that == is reference ...
Methacrylate asked 27/2, 2013 at 16:21

4

For large quotients, integer division (//) doesn't seem to be necessarily equal to the floor of regular division (math.floor(a/b)). According to Python docs (https://docs.python.org/3/reference/ex...
Aurore asked 21/12, 2018 at 22:44

5

say I have the following list: my_list = [3.5, 1.6, 2.4, 8.9, 5.6] I want to find the top 3 largest number in its original place, so the result should be: [3.5, 8.9, 5.6] How could I do that?...
Samal asked 23/9, 2019 at 21:6

4

TL;DR: The question is about multiplication ACCURACY I have to multiply matrices A (100x8000), B (8000x27) and C (27x1). Since matrices B and C are constant and A is variable, I prefer to calculate...

2

Solved

I have a series I get from an outside source (x). It's all positive, and is mostly zero. x.describe() count 23275.000000 mean 0.015597 std 0.411720 min 0.000000 25% 0.000000 50% 0.000000 75% 0.000...
Blamable asked 9/3, 2015 at 21:31

1

I'm trying to write a function to handle movement within a game I'm programming. What I have nearly works, but there are a couple situations where it breaks down. I've coded up a minimal demonstra...
Acetone asked 10/5, 2019 at 19:49

2

Solved

I've always assumed, that numpy uses a kind of pairwise-summation, which ensures high precision also for float32 - operations: import numpy as np N=17*10**6 # float32-precision no longer enough to...
Wavemeter asked 4/4, 2019 at 9:23

© 2022 - 2024 — McMap. All rights reserved.