I know it's more about programming, but I can use arithmetic operators only so I think it fits the math community.
Asked
Active
Viewed 18 times
0
-
$\frac{|xy|}{x}=\frac{\sqrt{x^2y^2}}x$ works if $x \not =0$ – Henry Jun 10 '20 at 13:55
-
thank you soooo soooo much! – Code Newbie Jun 10 '20 at 14:19
1 Answers
0
If $x$ is not zero, its sign is $|x|/x$. Thus you'd just need to return $|xy|/x$, where $x$ is the first number, and $y$ is the second number (assuming we don't care about the second number's sign).
E.g. $x=5$ and $y=-3$ gives $|5(-3)|/5 = 3$.
If one of them is zero, I guess it would depend on the application. Do you have a positive/negative zero?
Luke Collins
- 8,748