Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [floating-point]

For challenges which are specific to numbers represented in floating-point format.

4
votes
9answers
263 views

Floating over the integers

As you may know, the typical binary floating point numbers in a computer language are quite different than the typical integer numbers in a computer language. Floating point numbers can represent a ...
7
votes
12answers
827 views

Decimal Digit Truncating

Input: A decimal Output: The input truncated How to truncate them? The integer part of the input will remain the same. The decimal part of the input will be truncated based on the lowest digit in ...
1
vote
3answers
222 views

Finding Factorials with Gamma [duplicate]

Introduction We know that the factorial notation is valid for all natural numbers. However, Euler had extended it for all positive real numbers, as well as for complex numbers by defining a function, ...
-4
votes
8answers
284 views

Selling electricity

Jack is a little businessman. He found out a way to earn money by buying electricity on days when it's cheap and selling it when it's much more expensive. He stores the electricity in a battery he ...
8
votes
29answers
1k views

Output with the same number of digits of pi as the length of the code

Your challenge is to print x digits of pi where x is your code length. Examples: ...
29
votes
20answers
2k views

Float 754 to Hamming

You will be given as input an integer k in the range from -4503599627370496 (−252) to ...
5
votes
1answer
234 views

Find the Closest Double Palindrome

Given a double-precision float, find the closest double-precision float whose binary representation is a palindrome. Input A floating point number x. You may use ...
-6
votes
6answers
219 views

Floor implementation

Target: Write a floor() function from scratch. Manipulating like converting float to string, and cutting all after dot are allowed. All languages are allowed. ...
-1
votes
1answer
137 views

Print all decimals [duplicate]

You must write a program or function that will output all decimals with the specified precision if run forever. Example: Input: 2 Output: ...
-6
votes
4answers
237 views

Converting floating numbers to string [closed]

Task Convert input point integer to string Using format or other helpers is not allowed. You need to write it's from scratch. Data types Output must be array of chars Example in\out Input: float ...
15
votes
13answers
1k views

Decimal Time of Day Conversion

Introduction Time is confusing. Sixty seconds to a minute, sixty minutes to an hour, twenty-four hours to a day (and not to mention that pesky am/pm!). There's no room for such silliness nowadays, ...
9
votes
3answers
381 views

Format a floating point number exactly as decimal

Any binary floating point can be formatted exactly in decimal. The resulting string might be somewhat long, but it is possible. In my article on floating point I cover the importance of precision, and ...
7
votes
3answers
806 views

Compute the shortest decimal representation of a IEEE 754 double-precision binary floating-point number

Format The format is a 64 bit value x representing a IEEE-754 double-precision binary floating-point number (a.k.a "a double"). x is assumed to represent a real number (not a NaN or Infinity). Goal ...
12
votes
6answers
527 views

False Positives on an Integer Lattice

Leaderboard ...
12
votes
1answer
717 views

Implement an IEEE 754 64-bit binary floating point number through integer manipulation

(I've tagged the question "C" for the time being, but if you're aware of another language that supports unions, you can also use that.) Your task is to build the four standard mathematical operators <...
7
votes
10answers
2k views

Fast inverse square root

Inspired by http://meta.codegolf.stackexchange.com/questions/547/write-a-code-golf-problem-in-which-script-languages-are-at-a-major-disadvantage question on meta, I've decided to make a question which ...
7
votes
2answers
617 views

GolfScript - The missing function

The GolfScript language has one serious lack, no float or fixed point handling. Remedy this by creating a function F for converting an integer number, given as a string, to a string representing 1 / ...