![]() |
| | #1 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,927
| Addition using only multiply and divide +/- 100000.0 The entry must work with all numbers in that range. Rules - 1. I will disqualify any entry that I do not feel is in the spirit of the contest with or without an explanation. This decision is final. 2. Qualification is not commutative. Approximation of a qualifying function does not guarantee the approximation will qualify. 3. I reserve the right to change the specific or general nature of the contest at any time.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet |
| abachler is offline | |
| | #2 | |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,381
| Quote:
Code: double sum(double b, double c)
{
return log(exp(b) * exp(c));
}
| |
| brewbuck is offline | |
| | #3 |
| Registered User Join Date: Sep 2001
Posts: 752
| implementing log and exp without addition seems... non-trivial.
__________________ Callou collei we'll code the way Of prime numbers and pings! |
| QuestionC is offline | |
| | #4 | |
| Anti-Poster Join Date: Feb 2002
Posts: 1,212
| Quote:
To what precision should we expect the inputs? From the original statement, it appeared only to matter to the first decimal place. Please define "the entry must work". Does this mean you will not accept any approximation?
__________________ Rule #1: Every rule has exceptions Traveller's Dilemma Contest Site - Results posted! | |
| pianorain is offline | |
| | #5 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,927
| The contest is to implement it using only multiplication and addition, I dont think log or exp count as either of those. I was originally going to say to do it without using addition or subtraction, but I foresaw people trying to make entries using macros and functions that themselves use those, and then arguing that the rule was vague. So I nipped it in the bud and made it multiplication and division only.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet Last edited by abachler; 07-19-2007 at 09:01 AM. |
| abachler is offline | |
| | #6 | ||
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,927
| Quote:
Quote:
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet | ||
| abachler is offline | |
| | #7 | |||
| Anti-Poster Join Date: Feb 2002
Posts: 1,212
| Quote:
Quote:
Quote:
edit: I hope I'm missing something. The only operators we're allowed to use are * and / ?
__________________ Rule #1: Every rule has exceptions Traveller's Dilemma Contest Site - Results posted! Last edited by pianorain; 07-19-2007 at 10:07 AM. | |||
| pianorain is offline | |
| | #8 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,927
| Thats pretty much it, multiply and divide only. Sort of a twist on the old implement multiply or divide using only additon and subtraction.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet |
| abachler is offline | |
| | #9 |
| Anti-Poster Join Date: Feb 2002
Posts: 1,212
| I've designed a solution, but it requires the comparison and assignment operators. Are those allowable?
__________________ Rule #1: Every rule has exceptions Traveller's Dilemma Contest Site - Results posted! |
| pianorain is offline | |
| | #10 |
| aoeuhtns Join Date: Jul 2005
Posts: 581
| And.... what decides the winner?
__________________ There are 10 types of people in this world, those who cringed when reading the beginning of this sentence and those who salivated to how superior they are for understanding something as simple as binary. |
| Rashakil Fol is offline | |
| | #11 |
| Anti-Poster Join Date: Feb 2002
Posts: 1,212
| Oh Rashakil...next you'll be asking what languages are valid for a submission.
__________________ Rule #1: Every rule has exceptions Traveller's Dilemma Contest Site - Results posted! |
| pianorain is offline | |
| | #12 |
| aoeuhtns Join Date: Jul 2005
Posts: 581
| Will the function be required to work on denormalized values? Also, are arrays, and indexing thereof, allowed? Edit: Also, what languages are valid for a submission? Seriously. Edit 2: Can we use std::strings and concatenate them and then use size() to implement addition for positive integers as part of the algorithm?
__________________ There are 10 types of people in this world, those who cringed when reading the beginning of this sentence and those who salivated to how superior they are for understanding something as simple as binary. Last edited by Rashakil Fol; 07-19-2007 at 11:31 PM. |
| Rashakil Fol is offline | |
| | #13 |
| Registered Abuser Join Date: Jun 2006 Location: Toronto
Posts: 572
| just a guess, but usually these types of problems are geared towards a solution that uses some sort of bitwise manipulations.
__________________ MSDN knows exactly what you're looking for... |
| @nthony is offline | |
| | #14 | ||
| Anti-Poster Join Date: Feb 2002
Posts: 1,212
| Quote:
Quote:
__________________ Rule #1: Every rule has exceptions Traveller's Dilemma Contest Site - Results posted! | ||
| pianorain is offline | |
| | #15 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,927
| Again, you can only use multiply and divide. Since this is a C programming site, id say that C is the only acceptable language. Since I speak C and assembly Ill expand it to include assembly for the Xeon. The impetus for this challenge is I have a GPU that for some reason is faster at multiply than it is at adds. The solution to this wont solve my problem with the GPU, it was just inspired by it. Our problem is the GPU doesnt properly parallelize the addition of all members of a vector. Its an implementation issue we are sure, but one thought we had was to switch it to multiplies. Turns otu its just that it executes operations across members of a vecvtor in series, which makes it run very slowly.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet Last edited by abachler; 07-20-2007 at 09:47 AM. |
| abachler is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Faster way to divide numbers | scwizzo | C++ Programming | 3 | 04-29-2009 11:45 AM |
| Overflow and range checking for mul/div | Elysia | C++ Programming | 28 | 06-06-2008 02:09 PM |
| working with rotation matrices | hannibar | Game Programming | 23 | 03-30-2005 01:10 PM |
| How to multiply and Divide Huge int numbers | Dewayne | C++ Programming | 3 | 10-21-2004 08:41 PM |
| calculator in c++ | gamer | C++ Programming | 11 | 02-19-2003 10:46 AM |