Author Topic: print floating point stuff with 'printf"?  (Read 1458 times)

deeR44

  • Member
  • **
  • Posts: 101
print floating point stuff with 'printf"?
« on: April 28, 2022, 04:36:00 PM »
Just starting to do floating point stuff. Where do I find printf stuff for that?

What's the difference between "printf" and "crt_printf"?

jj2007

  • Member
  • *****
  • Posts: 13957
  • Assembly is fun ;-)
    • MasmBasic
Re: print floating point stuff with 'printf"?
« Reply #1 on: April 28, 2022, 05:27:24 PM »
Just starting to do floating point stuff. Where do I find printf stuff for that?

On the web, all over the place

Quote
What's the difference between "printf" and "crt_printf"?

printf(...) is a macro
invoke crt_printf, ... behaves identically

deeR44

  • Member
  • **
  • Posts: 101
Re: print floating point stuff with 'printf"?
« Reply #2 on: April 29, 2022, 06:48:46 AM »
Quote
On the web, all over the place

Well then, I'll keep looking.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: print floating point stuff with 'printf"?
« Reply #3 on: April 29, 2022, 09:26:35 AM »
The C function "printf" is part of the C runtime library and as such, the reference you are looking for is with C documentation from a variety of sources, Microsoft, universities and online publications etc ....

It is by no means the only choice for displaying floating point to a console but as you have made that choice to use "printf", its C documentation you are looking for.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

deeR44

  • Member
  • **
  • Posts: 101
Re: print floating point stuff with 'printf"?
« Reply #4 on: April 29, 2022, 04:08:04 PM »
Quote
you have made that choice to use "printf", its C documentation you are looking for.
Thank you, Hutch.

caballero

  • Member
  • *****
  • Posts: 2160
  • Matrix - Noah
    • abre ojos ensamblador
Re: print floating point stuff with 'printf"?
« Reply #5 on: April 29, 2022, 05:35:54 PM »
Writing a float number without using external libs, masm, fasm and nasm version

http://abreojosensamblador.epizy.com/?Tarea=1&SubTarea=20&Lang=1#EscribeFloat
The logic of the error is hidden among the most unexpected lines of the program

jj2007

  • Member
  • *****
  • Posts: 13957
  • Assembly is fun ;-)
    • MasmBasic
Re: print floating point stuff with 'printf"?
« Reply #6 on: April 29, 2022, 06:33:42 PM »
Writing a float number without using external libs, masm, fasm and nasm version

http://abreojosensamblador.epizy.com/?Tarea=1&SubTarea=20&Lang=1#EscribeFloat

Looks good but is a bit difficult to find, therefore I attach your source :thumbsup:

jack

  • Member
  • **
  • Posts: 231
Re: print floating point stuff with 'printf"?
« Reply #7 on: April 30, 2022, 03:14:37 AM »
is that your site caballero?
I attempted to write my own multi-precision floating-point math routines in FreeBasic and some of the more painfully difficult routines to implement were the conversion functions
it's easy if the number base is a power of 10 but it's a different story if the number base is a power of 2
what I wound up doing is to multiply or divide the mp-float by powers of 10 until you can start extracting decimal digits, it's rather slow but I am not motivated to pursue this any further

caballero

  • Member
  • *****
  • Posts: 2160
  • Matrix - Noah
    • abre ojos ensamblador
Re: print floating point stuff with 'printf"?
« Reply #8 on: April 30, 2022, 03:24:53 AM »
> is that your site caballero?

Yes, it is. I made it on my own with php, including the forum, an example of using linked lists.
The logic of the error is hidden among the most unexpected lines of the program

jack

  • Member
  • **
  • Posts: 231
Re: print floating point stuff with 'printf"?
« Reply #9 on: April 30, 2022, 03:27:58 AM »
I like your site, I think it's well done  :smiley:

caballero

  • Member
  • *****
  • Posts: 2160
  • Matrix - Noah
    • abre ojos ensamblador
Re: print floating point stuff with 'printf"?
« Reply #10 on: April 30, 2022, 03:33:41 AM »
 :thumbsup: Thank you. Just to learn Php a bit
The logic of the error is hidden among the most unexpected lines of the program

Gunther

  • Member
  • *****
  • Posts: 4198
  • Forgive your enemies, but never forget their names
Re: print floating point stuff with 'printf"?
« Reply #11 on: April 30, 2022, 06:11:31 AM »
Caballero,

your site is well done and the content is also good.
You have to know the facts before you can distort them.

caballero

  • Member
  • *****
  • Posts: 2160
  • Matrix - Noah
    • abre ojos ensamblador
Re: print floating point stuff with 'printf"?
« Reply #12 on: April 30, 2022, 07:39:16 AM »
 :thumbsup:
The logic of the error is hidden among the most unexpected lines of the program

NoCforMe

  • Member
  • *****
  • Posts: 1124
Re: print floating point stuff with 'printf"?
« Reply #13 on: June 27, 2022, 12:13:39 PM »
Is there a Win32 function that'll format floating-point values? I use wsprintf() all the time*, but it only handles integer values.

When I need printable representations of FP values, I use Raymond's library (specifically, FpFLtoA() ).

* I probably shouldn't be using this function, as it's not "safe" (can be used to hack code via buffer overruns), but since I'm not creating "production" code that anyone else is gonna use, it's not much of a problem ...

Greenhorn

  • Member
  • ***
  • Posts: 493
Re: print floating point stuff with 'printf"?
« Reply #14 on: June 27, 2022, 05:00:50 PM »
You may have a look at StringCchPrintf or one of the function that it replaces.
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.