Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #66230

Re: Floating point to string, and back via `%a'...

From "Chris M. Thomasson" <nospam@nospam.nospam>
Newsgroups comp.lang.c
Subject Re: Floating point to string, and back via `%a'...
Date 2015-07-22 19:40 -0700
Organization Aioe.org NNTP Server
Message-ID <mopk6n$i8k$1@speranza.aioe.org> (permalink)
References <moorva$su7$1@speranza.aioe.org> <87mvyn51bm.fsf@bsb.me.uk><mop2i6$bkq$1@speranza.aioe.org> <87h9ov4x0f.fsf@bsb.me.uk>

Show all headers | View raw


>"Ben Bacarisse"  wrote in message news:87h9ov4x0f.fsf@bsb.me.uk... 

>>"Chris M. Thomasson" <nospam@nospam.nospam> writes:
<snip>
>> Right. FWIW, %a does not work on MSVC for sscanf always returns zero.

>It's %la for sscanf (I'm sure I've seen that mentioned already).  If
>that returns zero, things are much worse than I thought.

Unfortunately, it returns zero. It's just not going to work 
with MSVC or MINGW on Windows.

;^(


>>So, I am going to use %lf and stick to a precision of %.10 for now. I
>>do not care if the double to string back to double conversion looses
>>precision because the fractal can be generated on the end result of the
>>conversion, not the original double.

>If that works, OK, but it sounds odd.  Fractals are often very sensitive
>to initial conditions, but I've not seen how these numbers are used.

It should work. Here is a simple scenario that I am hoping works 
out...

Lets say Alice gets a number that is part of the public key 
generated from the cleartext she just typed in on here computer: 
1.0123456789

Alice then runs it through a local round trip from double-to-
string-to-double, and gets back:

1.0123456

Fine... Alice then uses this new value for the public key, 
generates the fractal cipher based on the private key, encrypts 
the cleartext and sends both 1.0123456 and the ciphertext across
the wire to Bob.

Bob converts the public key string to a double. I am HOPING that 
Bob gets exactly:

1.0123456

If Alice and Bob are using a std floating point representation 
(e.g., IEEE).

Shi% should hit the fan if Bob cannot get this string to convert 
into 1.0123456! The fractal that Bob creates should be using  
1.0123456 damn it!  ;^/

Assume that both Bob and Alice are using a program compiled with 
the same compiler, have different archs but still use the same 
floating point standard that the program depends on.

What can possibly go wrong Ben?!

Tick, tick, tick... What is that? Oh, well, now I hear a bang and 
see a lot of fire with many fierce looking demons disseminating 
from it!

Oh shi%!

;^O

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-22 12:46 -0700
  Re: Floating point to string, and back via `%a'... James Kuyper <jameskuyper@verizon.net> - 2015-07-22 16:19 -0400
    Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-22 13:49 -0700
      Re: Floating point to string, and back via `%a'... Keith Thompson <kst-u@mib.org> - 2015-07-22 14:01 -0700
      Re: Floating point to string, and back via `%a'... James Kuyper <jameskuyper@verizon.net> - 2015-07-22 17:18 -0400
        Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-22 14:22 -0700
  Re: Floating point to string, and back via `%a'... Keith Thompson <kst-u@mib.org> - 2015-07-22 13:40 -0700
    Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-22 14:01 -0700
      Re: Floating point to string, and back via `%a'... Keith Thompson <kst-u@mib.org> - 2015-07-22 14:12 -0700
        Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-22 14:20 -0700
          Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-22 14:24 -0700
          Re: Floating point to string, and back via `%a'... glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-22 21:30 +0000
            Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-22 14:39 -0700
          Re: Floating point to string, and back via `%a'... Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2015-07-22 19:49 -0600
  Re: Floating point to string, and back via `%a'... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-22 22:28 +0100
    Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-22 14:34 -0700
      Re: Floating point to string, and back via `%a'... Keith Thompson <kst-u@mib.org> - 2015-07-22 14:58 -0700
        Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-22 15:43 -0700
        Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-22 15:45 -0700
        Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-22 15:51 -0700
          Re: Floating point to string, and back via `%a'... Robert Wessel <robertwessel2@yahoo.com> - 2015-07-22 18:21 -0500
            Re: Floating point to string, and back via `%a'... Keith Thompson <kst-u@mib.org> - 2015-07-22 16:58 -0700
        Re: Floating point to string, and back via `%a'... Keith Thompson <kst-u@mib.org> - 2015-07-22 16:52 -0700
        Re: Floating point to string, and back via `%a'... Keith Thompson <kst-u@mib.org> - 2015-07-22 17:08 -0700
      Re: Floating point to string, and back via `%a'... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-23 00:01 +0100
        Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-22 19:40 -0700
          Re: Floating point to string, and back via `%a'... Keith Thompson <kst-u@mib.org> - 2015-07-22 22:32 -0700
          Re: Floating point to string, and back via `%a'... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-23 11:07 +0100
            Re: Floating point to string, and back via `%a'... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-23 11:25 +0100
              Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-24 11:44 -0700
            Re: Floating point to string, and back via `%a'... "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-07-24 11:47 -0700

csiph-web