Advertisement
LucianBlox

Imaginary unit i^n

May 19th, 2022
746
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function imaginaryunitpower(pwr) {
  2.   pdiv = pwr/4-Math.floor(pwr/4)
  3.   if (pdiv=== 0.25) {
  4.     return "i"
  5.   } else if (pdiv === 0.50) {
  6.     return "-1"
  7.   } else if (pdiv === 0.75) {
  8.     return "-i"
  9.   } else if (pdiv === 1) {
  10.     return "1"
  11.   }
  12. }
Advertisement
RAW Paste Data Copied
Advertisement