bug in raisedTo:, arctan: primitives

Tim Olson tim at io.com
Thu Nov 11 16:03:20 PST 2004


Hi,
I scanned the Slate email archives, but didn't see anything about this, 
so I don't know if it is an already known bug or not:

The raisedTo: and arctan: primitives currently incorrectly set their b 
value from the first incoming parameter (x) instead of y.  This results 
in, for example:

	2.0 sqrt.
	-> 4.0

The fix is simple (in prims.slate):

x at FloatTraits raisedTo: y at FloatTraits
[| z!(Object pointer) a!Float b!Float |
   z: (CurrentMemory cloneSpecial: FloatProto).
   a: x pointer arrayElements!(Float pointer) cast load.
   b: y pointer arrayElements!(Float pointer) cast load.
   z arrayElements!(Float pointer) cast store: 'pow (a, b)' 
directly!Float.
   interpreter stackPush: z asObject
] `pidginPrimitive.

x at FloatTraits arctan: y at FloatTraits
[| z!(Object pointer) a!Float b!Float |
   z: (CurrentMemory cloneSpecial: FloatProto).
   a: x pointer arrayElements!(Float pointer) cast load.
   b: y pointer arrayElements!(Float pointer) cast load.
   z arrayElements!(Float pointer) cast store: 'atan2 (a, b)' 
directly!Float.
   interpreter stackPush: z asObject
] `pidginPrimitive.




More information about the Slate mailing list