News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Help on simple mathematics

Started by clamicun, November 05, 2015, 07:23:30 AM

Previous topic - Next topic

MichaelW

Why use _atodbl?

Per this page the special feature is that the function does not generate floating-point code.

And the double is packed in a _CRT_DOUBLE structure:


  typedef struct {
    double x;
  } _CRT_DOUBLE;


Sorry about the C code, but it's the only way I have to test this ATM:


#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
_CRT_DOUBLE value;

printf("%d\n", _atodbl( &value, "3.14159265358979323846264"));
printf("%.20f\n", value.x);

_getch();
}



0
3.14159265358979310000

Well Microsoft, here's another nice mess you've gotten us into.

jj2007

Quote from: MichaelW on January 12, 2016, 07:53:40 PMSorry about the C code

POLINK: error: Unresolved external symbol '__atodbl' ::)

MichaelW

Quote from: jj2007 on January 12, 2016, 09:13:12 PM
POLINK: error: Unresolved external symbol '__atodbl' ::)

I used a recent 64-bit MinGW, selected originally because it supports 64-bit code in inline assembly. The function I could not make work was  _atoldbl, no error but the _LDOUBLE value returned doesn't make sense.
Well Microsoft, here's another nice mess you've gotten us into.

TWell

Difference
C90FDAA22168C235
C90FDAA22168C233

.386
.model flat, stdcall
option casemap:none

printf proto cdecl :vararg
exit proto cdecl :dword
_atoldbl proto cdecl :dword, :dword
includelib msvcr100.lib


.data
sPI db "3.14159265358979323846264", 0
nPI dt 3.14159265358979323846264;338327
fmt db "%llX", 13, 10, 0
re10 real10 0

.code
start proc
invoke _atoldbl, addr re10, addr sPI
invoke printf, addr fmt, re10
invoke printf, addr fmt, nPI
invoke exit, 0
start endp
end start