553 questions
0
votes
1
answer
94
views
Does integer zero division always raise exception on 64-bit Arm on Windows?
When I perform integer division by zero on Windows 11 on Arm64, it raises a SEH exception.
That is rather surprising, considering Arm by default does not trap zero division.
My question is: does the ...
1
vote
1
answer
48
views
Netlogo 7.0 vs. 6.4 run differently the same line of code
I have the following two lines of code:
let lowest-rank max [relevance-rank] of banks
ask banks [set raw-eta normalized-logistic (((relevance-rank - 1 + 1) / (lowest-rank - 1 + 2)) * 100) 0 100 eta-...
2
votes
1
answer
102
views
Why doesn't divsion by zero return an error (using pcall) in Lua?
The following code should result in an error message (runtime error):
local status, result = pcall(function()
return 10 / 0
end)
if not status then
print("Error during division:", ...
1
vote
1
answer
80
views
Why does ⎕DIV not affect Matrix divide (⌹)?
With ⎕DIV←1, dividing by 0 does not give an error but gives a 0 every time.
When dividing by 0, ⌹ (quad divide) seems to always throw a domain error even with ⎕DIV←1.
Is there a reason why the value ...
2
votes
1
answer
243
views
How to deal with word counts of zero when calculating Pointwise Mutual Information (PMI) for word cooccurrences in Natural Language Processing
I have a co-occurrence matrix of words in a text (two words x and y are considered co-occurring, if they both occur in a context window of w words). I want to calculate the Pointwise Mutual ...
1
vote
1
answer
148
views
Dymola division by zero during initialization, how to debug
I have a Modelica model that fails to initialize, with below division by zero error message:
Error: The following error was detected at time: 0
Model error - division by zero: (0.0) / (0.0) = (0) / (0)...
6
votes
1
answer
305
views
Why is floating-point zero-divide forbidden in a constexpr?
Using the g++ compiler, both of these compile fine:
constexpr double d1 = 2.0 / 1.0;
const double d2 = 2.0 / 0.0;
But this does not:
constexpr double d2 = 2.0 / 0.0;
The compile-time error is:
error:...
1
vote
0
answers
124
views
numpy.histogram is there a way to get a binning so there is at least one count per bin?
I'm using numpy.histogram on my data and then I want to perform a fit to some curve where the number of occurrences in each bin is dividing, so it cannot be zero. So I need the bins to contain at ...
1
vote
1
answer
80
views
Postgresql:How to avoid zero-divisioin error in where section?
One of methods to handle zero-division error is to use case when structure.
\set start '2024-05-20'
\set end '2024-05-31'
\set change (q2.close-q1.close)/q1.close
select q1.ticker,q1.date,
...
0
votes
0
answers
56
views
Error Division Zero when hit endoint with rspec rails
I have some test with rspec, but when i run that test, appear error division zero like images below, can someone help me?
This my code
This my result when i run rspec
there is no error code in ...
0
votes
1
answer
61
views
Why does "divide by zero" sometimes work in python3? [closed]
I wrote a python script that progressively scales an image from a rectangle to a triangle. It works. it should not. I discovered that in the for loop, the index starts at zero and is used as the ...
1
vote
3
answers
471
views
Does Python not follow IEEE-754 in case of division by zero?
Here's a toy example in case of which Python exhibits behaviour that surprised me:
def harmonic_mean(x, y):
return 2/(1/x+1/y)
print(harmonic_mean(0.0, 1.0))
In IEEE-754 division by 0.0 shouldn'...
3
votes
1
answer
148
views
Handling zero cell counts in the "survey" package
[Edited to include smaller reproducible example]
The Goal
I'm learning the R survey package to get cell proportions (specifically, row percentages) and confidence intervals for a two-way, 58 x 4 ...
0
votes
0
answers
47
views
numpy.where does not filter points == 0 out [duplicate]
using numpy.where() to filter out cases where the input array element is == 0 in order to avoid divisin by 0 does not work.
using a simple for loop everything is fine, but using np.where() the ...
0
votes
1
answer
579
views
How to make SIMD divisions by zero give zero? (x86-64)
I have floats that I want to divide, some of them may be zeros. How can I make it such that division by zeroes, when they happen, just return zero instead of NaN on x86-64?
I tried setting the FZ and ...