author | sl |
Tue, 10 Jun 2014 14:32:02 +0200 | |
changeset 1 | 260cb5ec6c19 |
permissions | -rw-r--r-- |
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
7 //
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
10 //
11 // Contributors:
12 //
13 // Description:
14 // Name : strtof.cpp
15 // Part of : MRT
16 // Implementation for wcpcpy API
17 // Version : 1.0
18 //
23 #include <e32math.h>
24 #include <stdlib.h>
25 #include <errno.h>
26 #include <math.h>
28 extern "C" {
30 EXPORT_C float strtof(const char* s, char** tail)
31 {
32 double d ;
33 d = strtod(s, tail);
35 if ( d > KMaxTReal32 )
36 {
37 errno = ERANGE;
38 return -HUGE_VALF ;
39 }
40 if ( d < 0.0)
41 {
42 d *= -1;
43 if (d < KMinTReal32)
44 {
45 errno = ERANGE;
46 return HUGE_VALF ;
47 }
48 d *= -1;
49 }
50 return d;
51 }
53 } //extern "C"