[Question]
  [
Write a program or function that can distinguish the following 12 trigonometric functions: [`sin`](https://de.mathworks.com/help/matlab/ref/sin.html),
[`cos`](https://de.mathworks.com/help/matlab/ref/cos.html),
[`tan`](https://de.mathworks.com/help/matlab/ref/tan.html),
[`asin`](https://de.mathworks.com/help/matlab/ref/asin.html),
[`acos`](https://de.mathworks.com/help/matlab/ref/acos.html),
[`atan`](https://de.mathworks.com/help/matlab/ref/atan.html),
[`sinh`](https://de.mathworks.com/help/matlab/ref/sinh.html),
[`cosh`](https://de.mathworks.com/help/matlab/ref/cosh.html),
[`tanh`](https://de.mathworks.com/help/matlab/ref/tanh.html),
[`asinh`](https://de.mathworks.com/help/matlab/ref/asinh.html),
[`acosh`](https://de.mathworks.com/help/matlab/ref/acosh.html),
[`atanh`](https://de.mathworks.com/help/matlab/ref/atanh.html).
Your program is given one of the above functions as [black box](https://codegolf.meta.stackexchange.com/a/13706/56433) and should output the function's name either as given above or the way it is named in your language.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer in each language wins. You should show that your code works correctly by including test cases with all 12 possible inputs. If the language of your choice does not include build-ins for all of the above functions, you have to provide your own sensible implementations of the missing ones.
### Further Clarifications
* Using complex numbers to query the black box is allowed if the underlying build-ins can handle them.
* As \$ dom\ acosh \cap dom\ atanh = \emptyset \$ when using only real numbers, queries to the black box function can give domain errors. In this case you should assume that the black box only communicates the existence of an error, but not from which function it originates.
* If instead of an error some other value, e.g. `NaN` or `null`, is returned, then your submission should be able to handle them.
---
Thanks for the helpful [sandbox feedback](https://codegolf.meta.stackexchange.com/a/16569/56433)!
  
[Answer]
# Python 3.6.4 on Linux, 99 bytes
Bit of a silly answer, but:
```
lambda f:"asinh acos cos cosh atan atanh tan sin asin tanh sinh acosh".split()[hash(f(.029))%19%12]
```
Requires the trigonometric functions to be one out of the built-in `cmath` module for complex in/output.
[Answer]
# [Perl 6](http://perl6.org/), 75 bytes
```
->&f {([X~] ("","a"),<sin cos tan>,("","h")).min({abs(f(2i)-&::($_)(2i))})}
```
[Try it online!](https://tio.run/##LY1BCoMwEEWvMgwSMhBddNGFVM9RKCVMxRChxmLahYT06mlq3HyGx@PNa1yf5zRvIMzHDdCluhcGgrxdv3eQiAoZSV385GBYPLzZ9WrHFomaeXIy8MNLI08T1aJtZaXpf1OkmDxvgKHSjeN5jND1EPYvlY4IZllB5K4Ckct5czsvF8SFcYGZ2eLZItrDtIdqD9emHw "Perl 6 – Try It Online")
As it happens, all twelve of the functions to be discriminated amongst are built-in and all take complex arguments.
`[X~] ("", "a"), <sin cos tan>, ("", "h")` generates all twelve function names by reducing the three input lists with cross-product-concatenation. Given those, `.min(...)` finds the one which the smallest difference from the input function at `2i`.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~178~~ 172 bytes
```
double d;_;f(double(*x)(double)){d=x(0.9247);_=*(int*)&d%12;puts((char*[]){"acosh","sinh","asinh","atanh","tan","cosh","asin","sin","cos","atan","tanh","acos"}[_<0?-_:_]);}
```
[Try it online!](https://tio.run/##Xc7RasIwFAbg@z5FqExyyipVBNmi80FEwlnSmkIbpU1BKH31xdS0LniT/z/JxyEivQhhrbx2v1VOJOOsoH6gyR2mCtDLw51mq6/NdgeMHxJaapPAUn6sN@zWmZZSobBJTmfoYxTXVsWfcVvqMXBOg8904c7JjI@e@rvJefYE4@Vw4vvsmPJvfgY22EWpRdXJnOxrNGqlfiL3G1JjqSmQPiKEFNRtBOar2zBXt3SuGAgMCL4ZFSIVqtcQqhD9myY3XaNJxqIhsn@iqPDS2rSqHw "C (gcc) – Try It Online")
# Old but cool: [C (gcc)](https://gcc.gnu.org/), 194 bytes
```
double d;_;f(double(*x)(double)){char n[]="asinhacoshatanh";d=x(0.9247);_=*(int*)&d%12;_=(_<0?-_:_);n[(int[]){10,5,5,0,14,10,4,4,9,14,0,9}[_]]=0;puts(n+(int[]){5,1,0,10,11,6,0,1,6,10,11,5}[_]);}
```
[Try it online!](https://tio.run/##XY/haoMwFEb/@xShYyNxscSiGy51exCRcBu1ETQdGqEgvvqyiHML44ZwPnI@yJXRVUprq9t06WpUccEbvAUc3skPEjJLBQPSRZkfYGy1AnkbFRjQ6sCr/I7ZMTslr4SLPMStNiF5qh7jk4tYnNlHJN4E4bpYn4qSzDGjqRtG44Q6TtxkKzOaLYUoy5zxz8mMWD/vjZTGq@5OTF9WcveW0rVB@GIfWi27qarRuQejjuo9cF3UQ6sxQXOAEGqw@zrhG7oFdnRr7AieAZ4C/xzlS8q3foNv@dKfM9RmGjRiPFgC@yWbDq6jjbr@Gw "C (gcc) – Try It Online")
The `-lm` switch in TIO is merely to test. If you could write a *perfect*
implementation of the standard trig functions you would get the right answer.
## Explanation
The idea was to find some input value such that when I interpret the outputs of
each of the trig functions as integers they have different remainders modulo 12.
This will allow them to be used as array indices.
In order to find such an input value I wrote the following snippet:
```
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
// Names of trig functions
char *names[12] = {"sin","cos","tan","asin","acos","atan","sinh","cosh","tanh","asinh","acosh","atanh"};
// Pre-computed values of trig functions
double data[12] = {0};
#define ABS(X) ((X) > 0 ? (X) : -(X))
// Performs the "interpret as abs int and modulo by" operation on x and i
int tmod(double x, int i) {
    return ABS((*(int*)&x)%i);
}
// Tests whether m produces unique divisors of each trig function
// If it does, it returns m, otherwise it returns -1
int test(int m) {
    int i,j;
    int h[12] = {0}; // stores the modulos
    // Load the values
    for (i = 0; i < 12; ++i)
        h[i] = tmod(data[i],m);
    // Check for duplicates
    for (i = 0; i < 12; ++i)
        for (j = 0; j < i; ++j)
            if (h[i] == h[j])
                return -1;
    return m;
}
// Prints a nicely formatted table of results
#define TEST(val,i) printf("Value: %9f\n\tsin      \tcos      \ttan      \n  \t%9f\t%9f\t%9f\na \t%9f\t%9f\t%9f\n h\t%9f\t%9f\t%9f\nah\t%9f\t%9f\t%9f\n\n\tsin      \tcos      \ttan      \n  \t%9d\t%9d\t%9d\na \t%9d\t%9d\t%9d\n h\t%9d\t%9d\t%9d\nah\t%9d\t%9d\t%9d\n\n",\
        val,\
        sin(val), cos(val), tan(val), \
        asin(val), acos(val), atan(val),\
        sinh(val), cosh(val), tanh(val),\
        asinh(val), acosh(val), atanh(val),\
        tmod(sin(val),i), tmod(cos(val),i), tmod(tan(val),i), \
        tmod(asin(val),i), tmod(acos(val),i), tmod(atan(val),i),\
        tmod(sinh(val),i), tmod(cosh(val),i), tmod(tanh(val),i),\
        tmod(asinh(val),i), tmod(acosh(val),i), tmod(atanh(val),i))
// Initializes the data array to the trig functions evaluated at val
void initdata(double val) {
    data[0] = sin(val);
    data[1] = cos(val);
    data[2] = tan(val);
    data[3] = asin(val);
    data[4] = acos(val);
    data[5] = atan(val);
    data[6] = sinh(val);
    data[7] = cosh(val);
    data[8] = tanh(val);
    data[9] = asinh(val);
    data[10] = acosh(val);
    data[11] = atanh(val);
}
int main(int argc, char *argv[]) {
    srand(time(0));
    // Loop until we only get 0->11
    for (;;) {
        // Generate a random double near 1.0 but less than it
        // (experimentally this produced good results)
        double val = 1.0 - ((double)(((rand()%1000)+1)))/10000.0;
        initdata(val);
        int i = 0;
        int m;
        // Find the smallest m that works
        do {
            m = test(++i);
        } while (m < 0 && i < 15);
        // We got there!
        if (m == 12) {
            TEST(val,m);
            break;
        }
    }
    return 0;
}
```
If you run that (which needs to be compiled with -lm) it will spit out that with
a value of 0.9247 you get unique values.
Next I reinterpeted as integers, applied modulo by 12, and took the absolute
value. This gave each function an index. They were (from 0 -> 11): acosh, sinh,
asinh, atanh, tan, cosh, asin, sin, cos, atan, tanh, acos.
Now I could just index into an array of strings, but the names are very long and
very similar, so instead I take them out of slices of a string.
To do this I construct the string "asinhacoshatanh" and two arrays. The first
array indicates which character in the string to set to the null terminator,
while the second indicates which character in the string should be the first
one. These arrays contain: 10,5,5,0,14,10,4,4,9,14,0,9 and
5,1,0,10,11,6,0,1,6,10,11,5 respectively.
Finally it was just a matter of implementing the reinterpretation algorithm
efficiently in C. Sadly I had to use the double type, and with exactly 3 uses,
it was quicker to just use `double` three times then to use `#define D double\nDDD`
by just 2 characters. The result is above, a description is below:
```
double d;_;                                 // declare d as a double and _ as an int
f(double(*x)(double)){                      // f takes a function from double to double
    char n[]="asinhacoshatanh";             // n is the string we will manipulate
    int a[]={10,5,5,0,14,10,4,4,9,14,0,9};  // a is the truncation index
    int b[]={5,1,0,10,11,6,0,1,6,10,11,5};  // b is the start index
    d=x(0.9247);                            // d is the value of x at 0.9247
    _=*(int*)&d%12;                         // _ is the remainder of reinterpreting d as an int and dividing by 12
    _=(_<0?-_:_);                           // make _ non-negative
    n[a[_]]=0;                              // truncate the string
    puts(n+b[_]);}                          // print the string starting from the correct location
```
Edit: Unfortunately just using a raw array is actually shorter, so the code becomes much simpler. Nonetheless the string slicing was fun. In theory an appropriate argument might actually come up with the right slices on its own with some math.
[Answer]
# Python 3.6.5 on Linux, ~~90~~ 85 bytes
```
h=hash;lambda f:h(f(.0869))%3%2*"a"+"tscaionns"[h(f(.14864))%3::3]+h(f(.511))%5%2*"h"
```
This builds upon [orlp's answer](https://codegolf.stackexchange.com/a/168371/81278); but instead of finding 1 magic number, we find 3! This basically just saves bytes by avoiding putting the string literals for "sin", "cos", and "tan" multiple times, instead building the answer one part at a time.
The first magic number is used to determine whether it's one of the "arc" trigonometric functions, prepending an "a" accordingly, the second for whether it's one of the "sin", "cos", or "tan" based functions, selecting the appropriate string, and the third for whether it's one of the hyperbolic functions, appending a "h" accordingly.
Like orlp's answer, it uses the functions from Python's built-in `cmath` module as input.
*Saved 5 bytes by using slice indexing into the middle string*
## Finding the Magic Numbers
For completeness, here's (more or less) the script I used to find these magic numbers. I mostly just worked straight in a python terminal, so the code is messy, but it gets the job done.
```
import cmath
fns = [(fn, getattr(cmath, fn)) for fn in ["sin","cos","tan","asin","acos","atan","sinh","cosh","tanh","asinh","acosh","atanh"]]
count_length = lambda num, modulus, base_modulus : len(str(num).rstrip('0').lstrip('0')) + (1 + len(str(modulus)) if modulus != base_modulus else 0)
min_length = float("inf")
min_choice = None
for modulus in range(2,10):
   for i in range(1,100000):
      num = i/100000.
      is_valid = True
      for fn in fns:
         val = hash(fn[1](num))%modulus%2
         if (val == 0 and fn[0][0]=="a") or (val == 1 and fn[0][0]!="a"):
            is_valid = False
      if is_valid:
         length = count_length(num, modulus, 2)
         if length < min_length:
            min_length = length
            min_choice = (modulus,num)
print(min_choice)
min_length = float("inf")
min_choice = None
for modulus in range(3,10):
   for i in range(100000):
      num = i/100000.
      mapping = {}
      is_valid = True
      for fn in fns:
         fn_type = "sin" if "sin" in fn[0] else "cos" if "cos" in fn[0] else "tan"
         val = hash(fn[1](num))%modulus%3
         if val in mapping and mapping[val] != fn_type:
            is_valid = False
            break
         mapping[val] = fn_type
      if is_valid:
         length = count_length(num, modulus, 3)
         if length < min_length:
            min_length = length
            min_choice = (modulus, num, mapping)
print(min_choice)
min_length = float("inf")
min_choice = None
for modulus in range(2,10):
   for i in range(1,100000):
      num = i/100000.
      is_valid = True
      for fn in fns:
         val = hash(fn[1](num))%modulus%2
         if (val == 0 and fn[0][-1]=="a") or (val == 1 and fn[0][-1]!="a"):
            is_valid = False
      if is_valid:
         length = count_length(num, modulus, 2)
         if length < min_length:
            min_length = length
            min_choice = (modulus,num)
print(min_choice)
```
[Answer]
# [Python](https://docs.python.org/2/), ~~108~~ ~~94~~ 90 bytes
Compares the result of the input function to the results of all of the functions for the value `.2`.
```
from cmath import*
lambda f:[w for w in globals()if w[-1]in'shn'and eval(w)(.2)==f(.2)][0]
```
[**Try it online**](https://tio.run/##PYwxbsMwDEXn8BQEMlgKkKLOaMBjvOYArgfakSIhMiVIStWc3rWNogM//ycfGd7ZeL4sXfu1OJrHO6Fu@oLaRyxoGR/Oj@SSkFZj6c/1YLlKhiviO6pvcqJI8XGRbau3NvSfA@joZ5xmygbtHHzMp@W4/bMcXhkAirFOYd3AIcd3E6LljJ3Yt0JKOKifSYWM11t3jXG9o4SqGaOi50LJsgGafIK/WlMm3sXA5lYCNgz2yT9vfgE)
*-14 bytes by [Jonathan Allen](https://codegolf.stackexchange.com/users/53748/jonathan-allan)*  
*-4 bytes by [Rod](https://codegolf.stackexchange.com/users/47120/rod)*
[Answer]
# [Dyalog APL](https://www.dyalog.com/), ~~25~~ ~~21~~ 19 bytes
```
(8-(2○⍨8-⍳15)⍳⎕2)∘○
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKM97b@Gha6G0aPp3Y96V1joPurdbGiqCSQf9U010nzUMQMoAVL2P43LEMLjSuMygrOM4SxTOMsMzjKHsw6tN0RiGyGxjZHYpkhsMyQ21BwA "APL (Dyalog Unicode) – Try It Online")
-3 thanks to [H.PWiz](https://codegolf.stackexchange.com/users/71256/h-pwiz)  
-2 thanks to [ngn](https://codegolf.stackexchange.com/users/24908/ngn)
Goes trough all the required trig functions (which in APL are `1 2 3 5 6 7 ¯1 ¯2 ¯3 ¯5 ¯6 ¯7○2`) plus some more things (this goes trough `-7..7`), finds which one matches `input○2`, and outputs that "with" `○`, which outputs as `num∘○`
[Answer]
# JavaScript, ~~76~~ ~~67~~ 66 bytes
Not pretty but I went far too far down the rabbit hole with this over a few beers to *not* post it. Derived independently from Nit's solution.
```
b=>Object.getOwnPropertyNames(M=Math).find(x=>M[x](.8)+M==b(.8)+M)
```
[Try it online](https://tio.run/##Jc1LDoMgFIXhrTSOIKWMO7nugNq5MeGKqBh5REhrV08Lnfw5yTc4G74wqsOEdHN@0nmGPELbjZtWiS86dW/3PHzQR/o80OpIBAhMK@WzcRM5oRX9ORB@p1cBMP4Hzcq76HfNd7@QBpWPrGRlGI2r@c2ErmZlxSsXrVisUMNj2E2STHKLgVhoZ1LueztQyjdvnGQXSfMX)
* Saved 6 bytes thanks to [Neil](https://codegolf.stackexchange.com/users/17602/)
* Saved 1 bye thanks to [l4m2](https://codegolf.stackexchange.com/users/76323/l4m2)
[Answer]
# [C (gcc)](https://gcc.gnu.org/) with `-lm`, ~~374~~ ~~346~~ ~~324~~ 310 bytes
Thanks to Giacomo Garabello and ceilingcat for the suggestions.
I was able to save a bit more space by having a helper macro do token-pasting in addition to my original macro which does stringizing.
In the tests, I used a couple of non-library trig functions to confirm the validity of the results. As the results between the library and non-library functions weren't *exactly* the same floating-point value, I compared the difference of the results against a small value ε instead of using equality.
```
#import<math.h>
#define q(f)f,#f,
#define _(f,g)q(f##sin##g)q(f##cos##g)q(f##tan##g)
#define p for(i=0;i<24;i+=2)!j[i]
typedef double(*z)(double);*y[]={_(,)_(a,)_(,h)_(a,h)};i,x;*f(z g){int j[24]={x=0};char*c;for(double w;x++<9;)p&isnan(w=((z)y[i])(x))-isnan(g(x))|fabs(w-g(x))>1E-9?j[i]=1:0;p?c=y[i+1]:0;g=c;}
```
[Try it online!](https://tio.run/##bVFdc5swEHznV1zDTEcC0RonL4kgfuqv8Hg8ikCgDF9BIsZ2@eulJ3A8fejLabW6u10WGRVSzrOv667tbVILW/4oXz0/y5VucvggiirmK3ZnjkSxgiLv@0Y3vn/DsjV3bMXC30c6UG1PdLrhOtk@cR2mW/rtfa8Pnj13OTZB1g5vVU6CCyUrpDw47w/p9UgYPRLhCisXVNKJazbyQJELFPSqGwvv@@0TNo/pZuKyFH0guVNcV8GJj2GYPHPafdemEQ05pYRc6BkNUDJSGq1s4fBvJd4MOUXL5TX@FT3vnNE0ftnwbidTHArjA16KVPIJY2tkNWQ5JMZmunXJeTfV@nzEHL48jBSuHkCf26FvAIPD/T8xMzy4N/07JPCx/P9Y1aKt0Hz0lozBGMZ0nXUJ1AJXfrY6WwcuoIZGmv0BUrg6OQYoxm6mGIiFEgsnFsapLk1YkSjZ3cvaV66NeLiEYOKo4oS1Ay5zCAz3EH/9atBJ/Ig1DFdLAAbNKLIaw@j5QnaDNcTszMtD0@JXWFk@LC@TN81/pKpEYeaoqufo9Bc "C (gcc) – Try It Online")
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 86 bytes
```
#&@@Nearest[a=Join[a={Sin,Cos,Tan,Sinh,Cosh,Tanh},InverseFunction/@a];#@2&/@a->a,#@2]&
```
[Try it online!](https://tio.run/##jZHPaoQwEMbveQohILomiF6XXSylhZRSFtqbZCGI23jYCGp7WfbeZ@jj9UXsTLL2j67benAmyff7ZjLZq06Xe9VVhep3q6CnfpY9lKop2y5Xq7u6MhAOj5Vh13XLnpRhkGtcaFzpIxPmtWza8vbFFF1VmzhTckmz1IeErxWDVPp9uCSbpjJdTvl6l1EJpwdC0JagL0FjYp2JtcYN@F81hdVAtDKIVun29XCghxNIiAhutgEXNOQQIYRx6jNv/AULDxy8RUgGeXRJjnoohPqp/9gBedBDPyd/ClJOZ5x/9qMHIPoPgDcfVfhmJ6TryAL39XMuaPTx9h4knG7TUMZi5tJu0ghtqjiNhDdlR6SDTsNCNU94KuKAcgF1UnH@Mdz7DcjJPzrnP2lO/6aA4ckf1NfkHJZIjgncR@LMZ9uzDDn2nw "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~71~~ 67 bytes
```
->g{Math.methods.find{|h|g[0.5]==Math.send(h,0.5)rescue p}||:acosh}
```
[Try it online!](https://tio.run/##ZZA7a8MwFIV3/4qzKYFGdMkSUDN1KiXgNQ1FteVch0Qyegwlym93rzS4hW767neOXj59fc@Dmjcv5/u7jiRvJpLrgxxG298z5fPxWW5PSlUZjO1X9MSTtTehSwbTI@ed7lygxzylGCAAjBYbuBR5mXHTsSPRFNmIwIrDiNpCFyhV6IJMVBwVSdVS1VQ9CRmm6xil0R2hd8hDsrkBJj/aCAbpLylEbJeZ4FsIJg@F4fjndStOr08yus@whL28/qvnWl8OgFK81x7i8Cawg3ht20P7m9h/2Ib/Z/4B "Ruby – Try It Online")
[Answer]
# JavaScript, ~~108~~ 70 bytes
I haven't tried golfing in pure Javascript in ages, so I'm sure there's stuff to improve here.
```
t=>Object.getOwnPropertyNames(m=Math).find(f=>m[f](.9,0)+''==t(.9)+'')
```
Pretty straightforward, checks every function on the `Math` prototype against an arbitrary value (0.9, many other values probably work) and compares with the result of the black box function.  
Tested in Google Chrome, will break if the input black box function is not one of the trigs.
Cut off a ton of bytes thanks to Shaggy and Neil.
```
const answer = t=>Object.getOwnPropertyNames(m=Math).find(f=>m[f](.9,0)+''==t(.9)+'');
const tests = [Math.sin, Math.cos, Math.tan, Math.asin, Math.acos, Math.atan, Math.sinh, Math.cosh, Math.tanh, Math.asinh, Math.acosh, Math.atanh];
tests.forEach(test => console.log(test + ' yields ' + answer(test)));
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 39 bytes
```
{i.^methods.first({try $^a.(i)==.(i)})}
```
[Try it online!](https://tio.run/##JcfBCoQgGEXhvU9xiRAFcTmbsEcphP5QGGtQNyI@uyWzOR/nR/H76aFwMr16vQXK7j6SPn1MWdQcC@bNauGlMaNNtr6w844QPPlLYdS92P8NnERlAJIt0JcNpCaYFZPiJOZdLqz1Bw "Perl 6 – Try It Online")
By the looks of things, one of the few to use introspection. `i` here is the complex number, whose value is unique for each trig function, so by iterating through all the methods we can find the matching method and implicitly spit out its name. The `try` is needed as some (unwanted) methods have the a different signature.
[Answer]
# [R](https://www.r-project.org/), 73 bytes
```
function(b)Find(function(x)get(x)(1i)==b(1i),apropos('(sin|cos|tan)h?$'))
```
[Try it online!](https://tio.run/##PYtLCoAwDET3nkMwATceoLjzHvFT001abAUX3r22kLrJI29mrmxNtrdsyXmBFRcnO/z/g@eRyoXJoTFrxUjh8sFHGCA6eTcf30SCPPcDYrZVYmeh@IoaFZBaUk3qi2Zts9a59bkNuC0Y8wc "R – Try It Online")
For the moment (R v3.5) it works.  
If in a future R version it will be added a function matching this regex, then who knows :P
* -4 bytes thanks to @Giuseppe
* -9 bytes thanks to @JayCe
* -2 bytes using `Find` instead of `for`
[Answer]
# HP 49G RPL, 88.0 bytes excluding 10 byte program header
Another solution using complex numbers! Enter and execute it in COMPLEX, APPROX mode. Takes the function on the stack.
```
2. SWAP EVAL { SIN COS TAN ASIN ACOS ATAN SINH COSH TANH ASINH ACOSH ATANH }
DUP 1. << 2. SWAP EVAL >> DOLIST ROT - ABS 0. POS GET
```
(the newlines don't matter)
For the constant 2.0, all twelve trig functions are defined in the complex plane, so we just evaluate all twelve and see which one matches. This time, the iterative solution is longer (111.5 bytes) because of the stack shuffling needed to get it. RPL, as far as I know, doesn't let you break out of a loop early.
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 72 bytes
```
f=>eval('for(s=i=0;!s||s(.8)+s!=f(.8)+s;i++)s=Math[t=i.toString(30)];t')
```
[Try it online!](https://tio.run/##Jcy9CoMwEADgV6ku3qENQpeCnKNbp45FSLD@nMSceKGT755Cu33Tt7qP0@HgPV6DvMfUUZqoHT/OQzHJAUpMdZPpeSqYO5aa0fRHw2WJSg8Xl1ckNlGe8eAww63GvokFpkGCih@NlxlyN4guudHdc7SVNZvbYaO2g1@w9YhmFQ62ulhMXw "JavaScript (Node.js) – Try It Online")
]