Skip to content

atof() does not grok sci notation #2515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Sep 14, 2016 · 4 comments
Closed

atof() does not grok sci notation #2515

ghost opened this issue Sep 14, 2016 · 4 comments
Labels
waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.

Comments

@ghost
Copy link

ghost commented Sep 14, 2016

Basic Infos

Hardware

Hardware: ?ESP-12?
Core Version: ?2.1.0-rc2?

Description

Problem description

Settings in IDE

Module: Adafruit HUZZAH ESP
Flash Size: ?4MB/1MB?
CPU Frequency: ?80Mhz?
Flash Mode: ?qio?
Flash Frequency: ?40Mhz?
Upload Using: ?OTA / SERIAL?
Reset Method: ?ck / nodemcu?

Sketch

#include <Arduino.h>

void setup() {
    Serial.begin(9600);
    while (!Serial);

    char *sci = "1.0e-7";
    Serial.println (sci);
    Serial.println (1e7*atof(sci));

}

void loop() {

}

Debug Messages

messages here

Output is:

1.0e-7
10000000.00

should be
1.0e7
1.00

@ghost
Copy link
Author

ghost commented Sep 14, 2016

I also tried

Serial.println (strtod(sci,(char**)NULL));

but same result.

I forgot to mention, both tests also had #include <stdlib.h>

@devyte
Copy link
Collaborator

devyte commented Oct 13, 2017

@pidloop is this issue still valid with latest git? still valid with #3215 ?

@devyte devyte added the waiting for feedback Waiting on additional info. If it's not received, the issue may be closed. label Oct 13, 2017
@ghost
Copy link
Author

ghost commented Oct 13, 2017

Arduino Board Manager says I am running ESP8266 Community version 2.3.0 and yes, this error report is still valid.

@earlephilhower
Copy link
Collaborator

This works in git head, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.
Projects
None yet
Development

No branches or pull requests

2 participants