Benchmark: Savage
12-05-2017, 10:51 PM
Post: #3
 StephenG1CMZ Senior Member Posts: 1,033 Joined: May 2015
RE: Benchmark: Savage
Version 0.2

Code:
  //Benchmark: Savage   //PPL V0.2   //OMITTED: "RAD" in the original  LOCAL AA;  EXPORT A_SavagePPL()  BEGIN   LOCAL AA;   AA:=1;   FOR I FROM 1 TO 2499 DO     AA:=TAN(ATAN(EXP(LN(√(AA*AA)))))+1   END;   RETURN AA;  END;  MLFOR ()  BEGIN   //LOCAL AA;   RETURN AA:=TAN(ATAN(EXP(LN(√(AA*AA)))))+1;  END;    EXPORT A_SavageMAKE()  BEGIN   //LOCAL AA;   AA:=1;   MAKELIST(MLFOR(),AA,1,2499);   RETURN AA;  END; #CAS  A_SavageCAS1(f):=  BEGIN   LOCAL aa;   aa:=1;   FOR I FROM 1 TO 2499 DO     aa:=TAN(ATAN(EXP(LN(√(aa*aa)))))+1   END;   RETURN (aa);  END; #END  A_SavageCAS2()  BEGIN   LOCAL aa;   aa:=1;   FOR I FROM 1 TO 2499 DO     aa:=CAS(TAN(ATAN(EXP(LN(√(aa*aa))))))+1;   END;   RETURN (aa);  END;  RRR(RR)  //REPORT RESULT,RELATIVE ERROR  BEGIN   RETURN {RR,((2500-RR)/2500)};  END;  //APPROX:  //I FIND NO CLEAR WINNER BETWEEN PPL AND MAKE.  //EXACT:  //I FIND CAS2 CONSISTENTLY FASTER THAN CAS1  EXPORT SAVAGE()  BEGIN   LOCAL RR;   PRINT();   PRINT("Savage Benchmark");   PRINT({" PPL1: ",TEVAL(RR:=A_SavagePPL()),RRR(RR)});   PRINT({" MAKE: ",TEVAL(RR:=A_SavageMAKE()),RRR(RR)});     PRINT({" CAS1: ",TEVAL(RR:=A_SavageCAS1("")),RRR(RR)});   PRINT({" CAS2: ",TEVAL(RR:=A_SavageCAS2()),RRR(RR)});     END;

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
 « Next Oldest | Next Newest »

 Messages In This Thread Benchmark: Savage - StephenG1CMZ - 12-03-2017, 11:40 PM RE: Benchmark: Savage - StephenG1CMZ - 12-03-2017, 11:42 PM RE: Benchmark: Savage - StephenG1CMZ - 12-05-2017 10:51 PM RE: Benchmark: Savage - StephenG1CMZ - 08-29-2018, 07:37 AM RE: Benchmark: Savage - StephenG1CMZ - 09-28-2018, 07:20 PM RE: Benchmark: Savage - StephenG1CMZ - 09-29-2018, 08:16 AM RE: Benchmark: Savage - Albert Chan - 09-29-2018, 10:47 PM RE: Benchmark: Savage - StephenG1CMZ - 09-30-2018, 07:20 AM RE: Benchmark: Savage - Albert Chan - 09-30-2018, 11:15 AM RE: Benchmark: Savage - Albert Chan - 09-30-2018, 02:13 PM RE: Benchmark: Savage - StephenG1CMZ - 09-30-2018, 04:54 PM RE: Benchmark: Savage - StephenG1CMZ - 10-12-2018, 09:51 AM RE: Benchmark: Savage - StephenG1CMZ - 10-12-2018, 10:46 AM RE: Benchmark: Savage - StephenG1CMZ - 11-01-2018, 08:20 AM

User(s) browsing this thread: 1 Guest(s)