Skip to main content

All Questions

Tagged with
12 votes
4 answers
3k views

Type system for different representations of angle value

I want to implement a Type system for different representations of an angle value. Motivation to implement this as a type system comes from this question. Angle can be represented using the ...
diimdeep's user avatar
  • 221
4 votes
1 answer
7k views

Counting perfect squares

Below is the code I have written for counting perfect squares between a given lower and upper bound. I am using the following concept to solve this: Starting with 1, there are \$\sqrt{m}\$ square ...
iniki's user avatar
  • 335
1 vote
1 answer
497 views

Simple way to decrement number within a repeating range

I currently have a solution to increment numbers within a range: i % x + 1 Where x is the maximum number in the range and <...
Jamie's user avatar
  • 113
1 vote
1 answer
104 views

Is this routine for determining the epsilon of a Double 100% valid?

This algorithm is intended to determine the epsilon of a given double precision number. As numbers increase in value, their accuracy decreases. This algorithm will return the smallest increment / ...
IamIC's user avatar
  • 191
2 votes
1 answer
4k views

Generating Pandigital Numbers

A Base10 Pandigital Number is a number which uses all the digits 0-9 once: 1234567890 2468013579 etc... My naive solution was just to use a bunch of nested loops to do this but it's quite slow. And ...
Eoin Campbell's user avatar
4 votes
1 answer
2k views

Truncating an integer from left to right and right to left

Project Euler problem 37 says: The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797,...
Eoin Campbell's user avatar

15 30 50 per page
1 2 3
4