Category "floating-point"

how to prevent float variables displaying as scientific notation when printing [duplicate]

I am using "(float)$val" for some calculation, but for some decimal value like -0.00000025478625 (float)-0.00000025478625 is resulting to -2.5

What's the maximum precision (after the decimal point) of a float in Javascript

An algorithm I'm using needs to squeeze as many levels of precision as possible from a float number in Javascript. I don't mind whether the precision comes from

Bit shifting a half-float into a float

I have no choice but to read in 2 bytes that make up a half-float. I would like to work with this in the form of a 4 byte float. Ive done some research and the

k-diff sequences in a float array

Looking for an algorithm to find longest sequences (pairs, triplets, up to quadruplets) that are separated by a constant, non-integer difference k in a sorted a

Concept related to precision of float and double

Why the precision of the float is up to 6 digits after the decimal point and the precision of the double is up to 15 digits after the decimal point? Can anyone

How do I select floating-point infinity literals from a SQLite database?

I have a SQLite database with a table named measurements, which contains some experimental data measured by a power meter. They're stored as data type REAL in a

Is there a standard way to get the nth `nextafter` floating-point value in C++

C++ has std::nextafter(), which returns the next representable value after a given floating-point value f. In my case, I'd like to allow for n bits of slop in t

What does "e" mean in logged output of a floating point number

If I std::cout a float or a double and if logs something like -5.58794e-09, then does this mean that the number is close to zero? This is very basic programming

Ho to convert base 10 floating point input to base 2 in MIPS?

I have been tasked with writing a program in MIPS that converts a user-inputted base 10 floating point number to base 2. I am a relatively inexperienced program

Round 37.1-28.75 float calculation correctly to 8.4 instead of 8.3

I have problem with floating point rounding. I want to calculate floating point numbers and round them to (given) N decimals. In this example I want to round to

How to detect non IEEE-754 float, and how to use them?

I'm writing classes for basic types, so that code is logically the same on multiple platforms and compilers (like int_least16_t for int). For fun! (I'm still a

Fast floating-point power of 2 on x86_64

Is there a fast way to take 2.0 to some floating-point degree x? I mean something faster than pow(2.0, x) and preferrably what vectorizes well with AVX2. The c

Convert float to int in Julia Lang

Is there a way to convert a floating number to int in Julia? I'm trying to convert a floating point number to a fixed precision number with the decimal part rep

How to solve - ValueError: could not convert string to float: ''

training_age_in = [1, 2, 3] training_salary_dep = [5, 9, 10] m = [(training_age_in[0], training_salary_dep[0]), (training_age_in[1], training_salary_dep[1]),

Python round a float to nearest 0.05 or to multiple of another float

I want to emulate this function. I want to round a floating point number down to the nearest multiple of 0.05 (or generally to the nearest multiple of anything)

DynamoDBNumberError on trying to insert floating point number using python boto library

Code snippet : conn = dynamo_connect() company = Table("companydb",connection=conn) companyrecord = {'company-slug':'www-google-com12','founding-year':1991,

Excel - float number cannot be summed

I have a bunch of values like 0.5, 1.0, 1.5 etc. I want to write a SUM function for those cells but the value is 0. If I use integers the summing works so the

How can I use a HashMap with f64 as key in Rust?

I want to use a HashMap<f64, f64>, for saving the distances of a point with known x and key y to another point. f64 as value shouldn't matter here, the fo

How to convert float to uint by float representation?

In C I will do this to convert float representation of number into DWORD. Take the value from the address and cast the content to DWORD. dwordVal = *(DWORD*)&a

How can I remove ".0" of float numbers?

Say I have a float number. If it is an integer (e.g. 1.0, 9.0, 36.0), I want to remove the ".0 (the decimal point and zero)" and write to stdout. For example, t