Skip to main content
4 votes
1 answer
52 views

I am running inference on a trained PyTorch model using the same input tensor, fixed random seeds, and evaluation mode enabled. import torch torch.manual_seed(42) torch.cuda.manual_seed_all(42) model....
Colin Leede's user avatar
1 vote
4 answers
292 views

My expected outcome is that I'm able to compare floats up to the sixth decimal point. The actual results are that they that it's incorrect, only sometimes though. Bonus if you can tell me why without ...
Etetherin's user avatar
24 votes
4 answers
3k views

C23 added the classification macro iszero for testing whether an argument value is zero, specified like: int iszero(real-floating x); What is the difference between using iszero(x) and writing x == 0?...
Jan Schultke's user avatar
  • 44.5k
3 votes
1 answer
261 views

Example: i = 292893227695 j = 8*i**2 + 1 k = math.sqrt(j) print(j) print(k) print(k.is_integer()) gives output 686291542636760920104201 828427149867.0 True Even though k is not an integer. More ...
Dominic 's user avatar
9 votes
1 answer
186 views

[charconv.to.chars] says the following: The functions that take a floating-point value but not a precision parameter ensure that the string representation consists of the smallest number of ...
Jan Schultke's user avatar
  • 44.5k
7 votes
2 answers
303 views

C23 now has four different ways of computing the maximum or minimum of two floating-point numbers: x > y ? x : y for maximum (or the other way for minimum) fmax / fmin fmaximum / fminimum ...
Jan Schultke's user avatar
  • 44.5k
2 votes
2 answers
248 views

I write a cross-platform program for Windows and Linux, and I would like it to behave as similar on both platforms as possible. I use some mathematics in the program, e.g. std::atan2 function calls, ...
Fedor's user avatar
  • 24.9k
2 votes
3 answers
228 views

C23 §5.2.5.3.3 [Characteristics of floating types <float.h>] paragraph 8 says: Floating types shall be able to represent signed zeros or an unsigned zero and all normalized floating-point ...
Jan Schultke's user avatar
  • 44.5k
2 votes
2 answers
139 views

In Kotlin, if you do println(String.format("%.17f", 10.45)), you will see 10.45000000000000000 in the output. In Swift, if you do print(String(format: "%.17f", 10.45)) you will see ...
infoMining's user avatar
3 votes
1 answer
248 views

The inverse of the gamma function over the reals is multivalued with an infinite number of branches. This self-answered question is about the principal inverse of the gamma function, Γ0-1(x), whose ...
njuffa's user avatar
  • 27.2k
4 votes
3 answers
255 views

I am in the process of upgrading our code from php 8.2 to 8.4 I noticed we are getting some test failures because of round() returning different values than expected. Ultimately the problem could be ...
yeaitsme's user avatar
  • 129
4 votes
1 answer
143 views

Consider the following snippet: ldr q0, [x0] cmeq v0.16b, v0.16b, #0 shrn v0.8b, v0.8h, #4 fcmp d0, #0.0 This is a common way to implement functions such as strlen with SIMD. According to the Arm64 ...
alexisrdt's user avatar
  • 524
Advice
2 votes
10 replies
190 views

Is the minimum range that remquo(x, y, quo) assigns *quo [-7 ... +7]? Is not, what is the minimum compliant range? double remquo(double x, double y, int *quo); has the following description: The ...
chux's user avatar
  • 158k
16 votes
2 answers
739 views

I have a program that reads the coordinates of some points from a text file using std::istringstream, and then it verifies the correctness of parsing by calling stream's operator bool(). In general it ...
Fedor's user avatar
  • 24.9k
-4 votes
3 answers
317 views

I read Calculating very large exponents in python , and Ignacio Vazquez-Abrams's answer was to use the pow() function So , I run the following command in Python 3.9.6 : print(int(pow(1.5,96))) and ...
Lhachimi's user avatar
  • 119

15 30 50 per page
1
2 3 4 5
1034