Hacker News new | ask | show | jobs
by gh0zt 4650 days ago
I like the idea but i don't like the actual implementation. For example: Number::tan takes an array of flags as an argument but only one flag is ever used to determine which kind of tangent method is eventually executed. For me as a user this does not only complicate the usage but it is also potentially (microoptimizationwise) slower because of the necessary condition check.

So instead of

  $number = new Number(4.2);
  $number->tan(array(Number::TRIG_ARC))
why not just implementing it as a separate method?

  $number->atan();
1 comments

Well, PHP has four 'tan' functions, and in all fairness, I might just remove those functions altogether and leave the basic ones. I do agree that its longer to type now, but at the expense of remembering WTF atan() does.
Well, if you need the atan function you probably know what it should do and apart from that why does the Number:tan method take an array of arguments when only one is ever used? So at least it should be usable like tan(Number::Number::TRIG_ARC).