[pypy-svn] r47101 - pypy/dist/demo

arigo at codespeak.net arigo at codespeak.net
Tue Oct 2 16:22:30 CEST 2007


Author: arigo
Date: Tue Oct  2 16:22:29 2007
New Revision: 47101

Modified:
   pypy/dist/demo/bpnn.py
Log:
Avoid float **.


Modified: pypy/dist/demo/bpnn.py
==============================================================================
--- pypy/dist/demo/bpnn.py	(original)
+++ pypy/dist/demo/bpnn.py	Tue Oct  2 16:22:29 2007
@@ -131,7 +131,8 @@
         # calculate error
         error = 0.0
         for k in range(len(targets)):
-            error = error + 0.5*(targets[k]-self.ao[k])**2
+            delta = targets[k]-self.ao[k]
+            error = error + 0.5*delta*delta
         return error
 
 



More information about the Pypy-commit mailing list