f32
values off the stack, gives the sign of the second one (either plus or minus) to the first
value, and then pushes it back on to the stack. If the second value is negative then this makes sure the first value is
also negative and pushes the result onto the stack.
f32.copysign
f32 | The value to have its sign reset if required. |
f32 | The value sign the result must have. |
f32 | The first value with the sign that matches the second value. |
;; Push the f32 value 3.142 onto the stack f32.const 3.142 ;; Push the f32 value 2.718 onto the stack f32.const 2.718 ;; Pop the two f32 values off the stack, copy the sign part ;; and push it back onto the stack f32.copysign ;; The stack contains an f32 value of 3.142
;; Push the f32 value -3.142 onto the stack f32.const -3.142 ;; Push the f32 value 2.718 onto the stack f32.const 2.718 ;; Pop the two f32 values off the stack, copy the sign part ;; and push it back onto the stack f32.copysign ;; The stack contains an f32 value of 3.142
;; Push the f32 value 3.142 onto the stack f32.const 3.142 ;; Push the f32 value -2.718 onto the stack f32.const -2.718 ;; Pop the two f32 values off the stack, copy the sign part ;; and push it back onto the stack f32.copysign ;; The stack contains an f32 value of -3.142
;; Push the f32 value -3.142 onto the stack f32.const -3.142 ;; Push the f32 value -2.718 onto the stack f32.const -2.718 ;; Pop the two f32 values off the stack, copy the sign part ;; and push it back onto the stack f32.copysign ;; The stack contains an f32 value of -3.142