← 返回 amazon 的题目列表Implement the Sigmoid Function
类型:online_judge
Problem: Implement the Sigmoid Function
Implement sigmoid(x):
[ \operatorname{sigmoid}(x) = \frac{1}{1 + e^{-x}} ]
Given a floating-point number x, output its sigmoid value rounded to 6 decimal places.
Your implementation should avoid numerical overflow for very large positive or negative inputs.
Input Format
One line containing one floating-point number x.
Output Format
Print sigmoid(x) rounded to 6 decimal places.
Constraints
-1000 <= x <= 1000
Example
Input
0
Output
0.500000
Example
Input
0
Output
0.500000