[ create a new paste ] login | about

Link: http://codepad.org/PatrqlpE    [ raw code | output | fork ]

C++, pasted on Nov 8:
#include <iostream>
using namespace std;

float f(float x);

int main(){
    float x = 1000;
    cout<<"x = "<<x<<endl;
    x = x + 1E-5;
    cout<<"x = "<<x<<endl;
    return 0;
}

float f(float x){
    float y = 0;
    if( x < -3 )
        y = (x*x - 3*x + 2) / 2;
    else
    if( x > 3 )
        y = x*x*x;
    else
        y = x;
    return y;
}


Output:
1
2
x = 1000
x = 1000


Create a new paste based on this one


Comments: