Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,556

bobbym wrote:

Its ctrl + pause/break : this key is above the arrow keys (at the top).

Ah - found it! I'd never used that key before and must have skimmed over it when looking for it.

It stops program execution, as you said.

Thanks!

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,418

Hi phrontister;

I tried that, but I got the same incorrect responses as before. Maybe I didn't code it correctly. I'll try again...

```
for n=10 to 0 step -1/5
print n
next n
```

Notice how instead of getting 0 he gets 0.20539126e-14, but at least the for next loop terminates.

*Last edited by bobbym (2009-08-14 13:30:06)*

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,556

Hi Bobby,

bobbym wrote:

Notice how instead of getting 0 he gets 0.20539126e-14, but at least the for next loop terminates.

Yes - I'll have to remember that for situations where that is important (or maybe I should make it a habit anyway).

Some day this quirk won't exist and we won't have to dream up workarounds...and we'll laugh at the clunky ways of the old days.

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,418

Hi phrontister;

This problem will always exist with floating point arithmetic, you can delay it with more digits of precision, but when used incorrectly it will bite you.

Exact integer and rational arithmetic do not have this problem but it is not always possible to use them.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

Why not try contraint programming here?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,418

Can you set it up?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

But not in M

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,418

What then?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

Minizinc?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,418

What exactly do you mean by constraint programming?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

It is a paradigm where programming is donw by mentioning properties of the soltuion rather than explaining how to compute the solution.

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,030

It's something like logic programming except more specialized. And it seems it's often mixed with another paradigm (functional, imperative,...). The two languages mentioned on W are Oz, which is functional, and Kaleidoscope, which is imperative.

Oz seems really interresting.

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline