Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- double sigmoid(double x)
- {
- return 1 / (1 + exp(-x));
- }
- int main()
- {
- double result;
- result = sigmoid(-10.0);
- printf("Sigmoid of -10.0: %f\n", result);
- result = sigmoid(0.0);
- printf("Sigmoid of 0.0: %f\n", result);
- result = sigmoid(10.0);
- printf("Sigmoid of 10.0: %f\n", result);
- return 0;
- }
- /*
- Sigmoid of -10.0: 0.000045
- Sigmoid of 0.0: 0.500000
- Sigmoid of 10.0: 0.999955
- */
Advertisement