swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange occurence of NaN


From: Marcus G. Daniels
Subject: Re: Strange occurence of NaN
Date: 17 May 2000 14:34:43 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4

>>>>> "MM" == Matthew Mitchell <address@hidden> writes:

MM> I have noticed I am getting NaN's occuring. 

Is this all `double' arithmetic, including the return type of
getLearningRate?

Does it go away when optimization is off?

Can you make this program exhibit the behavior?

#import <simtools.h>
#import <defobj/Create.h>

@interface AgentModel: CreateDrop
- (double)getLearningRate;
@end

@implementation AgentModel
- (double)getLearningRate
{
  return 0.2;
}
@end

int
main (int argc, const char **argv)
{
  double tempStrength = 0.0;
  double rewardStrength = 0.0;
  double Qreturn = 0.0;
  double discountRate = 0.9;
  id agentModel;

  initSwarmBatch (argc, argv);

  agentModel = [AgentModel create: globalZone];

  tempStrength = tempStrength +
    ([agentModel getLearningRate] *
     ((rewardStrength + (discountRate * Qreturn)) - tempStrength));
  
  printf ("%f\n", tempStrength);
  return 0;
}
/*
Local Variables:
compile-command: "$SWARMHOME/bin/libtool-swarm --mode=link gcc -O2 -o diff 
-Wall -Werror -g -Wno-import -I$SWARMHOME/include/swarm -L$SWARMHOME/lib/swarm 
diff.m -lswarm -lobjc"
End:
*/

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]