Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
160 views

SICP Exercise 2.5 - selector behaves inconstantly

I'm reading SICP and doing exercise 2.5: Exercise 2.5. Show that we can represent pairs of nonnegative integers using only numbers and arithmetic operations if we represent the pair a and b as ...
nalzok's user avatar
  • 16k
1 vote
1 answer
205 views

Digit recurrence square root

I need to implement a digit recurrence square root for generic floating point format such that exp_size + mant_size + 1 <= 64. I basically followed the implementation suggested here handbook of ...
user8469759's user avatar
  • 2,712
3 votes
0 answers
499 views

Kahan summation and relative errors; or real life war stories of "getting the wrong result instead of the correct one" [closed]

I am interested in "war stories" like this one: I wrote a program involving the sum of floating point numbers but I did not use the Kahan summation. The sum was bad_sum and the program gave me a ...
Alessandro Jacopson's user avatar
14 votes
2 answers
295 views

Which floating-point comparison is more accurate, and why?

I'm experimenting with different implementations of the Newton method for calculating square roots. One important decision is when to terminate the algorithm. Obviously it won't do to use the ...
lindelof's user avatar
  • 35.2k
8 votes
5 answers
941 views

Calculating average of two values, minimizing errors

I am doing some floating point calculations and the results are not as accurate as I want them to be. This is the algorithm: ... center = (max_x + min_x) / 2 distance = old_x - center new_x = center ...
MxLDevs's user avatar
  • 19.4k