Skip to main content
Best practices
0 votes
9 replies
138 views

Surely, a number of ways are at a developer's disposal to reduce a rounding error of 1.78814e-07 variable assignment to 0.000000. What is best practice? My best solution is to include a method as such:...
ndtech's user avatar
  • 11
0 votes
1 answer
120 views

I have a GeoDjango (v5.2) model ("Location") with a MultiPolygonField ("coordinates") and use PostGIS (v17-3.5) as database backend. When I annotate a queryset with the multi-...
gunnar's user avatar
  • 76
0 votes
0 answers
72 views

My project is having a problem with decimal rounding errors in Spark v3 compared to Spark v2, where rounding to second decimal place works fine in Spark v2 but Spark v3 rounds the values up or down (...
Elle Panahi's user avatar
0 votes
2 answers
69 views

For this example, I am working with the following data: Z_Value <- c(-0.6745, 0.6745) I'm using the following function and want to use 3 sig figs. (If I have results that are 999 or higher, I want ...
SharonP's user avatar
  • 59
0 votes
2 answers
71 views

I'm trying to round the output of some calculations to 3 or less decimal places, so they can stored compactly in a comma-delimited text file. That is 2 should be stored as 2 not 2.000, 3.14 should be ...
Anachronist's user avatar
  • 1,132
0 votes
1 answer
78 views

I'm trying to make a code for a simple calculator for a programming problem, and I can't figure out how the rounding works in this case. 1 + 0 + 0.0005 returns 1.000 but 2 + 1 + 0.0005 returns 3.001. ...
이석민's user avatar
1 vote
2 answers
193 views

I'm trying to understand the practical utility of the G9 format specifier in C# when dealing with round-tripping floating-point numbers. The book C#12 in a nutshell mentions that G9 is helpful to ...
FluidMechanics Potential Flows's user avatar
3 votes
2 answers
228 views

I stumbled upon a failing unit-test, that involves converting doubles to integers. The actual number that is converted is 1.234 * 1000., and the code basically boils down to: #include <iostream> ...
umläute's user avatar
  • 32.4k
2 votes
1 answer
129 views

Basically I want to create my own tools for developing a 2D top-down game and when it comes to collision detection I'm trying to implement the SAT method, but somehow my calculations seem to be way ...
Péter Marschall's user avatar
1 vote
1 answer
378 views

When writing shaders in HLSL, sometimes you can run into very large floating point numbers, and with large floating point numbers, they struggle to maintain precision. When I wrote the blow code, I ...
Charles Lohr's user avatar
  • 1,070
2 votes
1 answer
360 views

I'm using a Metal compute pipeline to render into a CAMetalLayer's drawable and keep running into problems with non-integer pixel formats resulting in a slightly noisy image, due to some apparent ...
Marcel Tesch's user avatar
0 votes
2 answers
93 views

There's something wrong with my understanding of either the round function in python or how doubles are represented in python. I find a very perplexing behavior when rounding numbers that have a ...
AXensen's user avatar
  • 101
0 votes
3 answers
194 views

I'm searching a table for an exact match on an amount column DOUBLE(10,2). Due to the database driver I'm using, I have to bind my amount as a string parameter. In general this works well, hoever this ...
Peter Scopes's user avatar
-1 votes
1 answer
79 views

I am incredibly new to java and this is the description for a lab I currently have: Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-...
thatlittlerose's user avatar
0 votes
1 answer
78 views

I want to model demographic changes within a population, using historical data going from 1986 until the present. My data covers a population divided into age cohorts of a single year: 0,1,2 ... 106+. ...
KjetilH's user avatar
  • 59

15 30 50 per page
1
2 3 4 5
25